| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/notifications/notification_conversion_helper.h" | 5 #include "chrome/browser/notifications/notification_conversion_helper.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/notifications/notification.h" | 8 #include "chrome/browser/notifications/notification.h" |
| 9 #include "chrome/browser/notifications/notification_test_util.h" | 9 #include "chrome/browser/notifications/notification_test_util.h" |
| 10 #include "chrome/common/extensions/api/notifications.h" | 10 #include "chrome/common/extensions/api/notifications.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 optional_fields, | 70 optional_fields, |
| 71 delegate)); | 71 delegate)); |
| 72 | 72 |
| 73 return notification.Pass(); | 73 return notification.Pass(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 DISALLOW_COPY_AND_ASSIGN(NotificationConversionHelperTest); | 77 DISALLOW_COPY_AND_ASSIGN(NotificationConversionHelperTest); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 // TODO(liyanhou): This test is disabled due to memory leaks. Fix and re-enable. | 80 TEST_F(NotificationConversionHelperTest, NotificationToNotificationOptions) { |
| 81 // http://crbug.com/403759 | |
| 82 TEST_F(NotificationConversionHelperTest, | |
| 83 DISABLED_NotificationToNotificationOptions) { | |
| 84 // Create a notification of image type | 81 // Create a notification of image type |
| 85 scoped_ptr<Notification> notification1 = | 82 scoped_ptr<Notification> notification1 = |
| 86 CreateNotification(message_center::NOTIFICATION_TYPE_IMAGE); | 83 CreateNotification(message_center::NOTIFICATION_TYPE_IMAGE); |
| 87 scoped_ptr<extensions::api::notifications::NotificationOptions> options1( | 84 scoped_ptr<extensions::api::notifications::NotificationOptions> options1( |
| 88 new extensions::api::notifications::NotificationOptions()); | 85 new extensions::api::notifications::NotificationOptions()); |
| 89 NotificationConversionHelper::NotificationToNotificationOptions( | 86 NotificationConversionHelper::NotificationToNotificationOptions( |
| 90 *(notification1), options1.get()); | 87 *(notification1), options1.get()); |
| 91 | 88 |
| 92 EXPECT_EQ(options1->type, | 89 EXPECT_EQ(options1->type, |
| 93 extensions::api::notifications::TEMPLATE_TYPE_IMAGE); | 90 extensions::api::notifications::TEMPLATE_TYPE_IMAGE); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 120 scoped_ptr<extensions::api::notifications::NotificationOptions> options3( | 117 scoped_ptr<extensions::api::notifications::NotificationOptions> options3( |
| 121 new extensions::api::notifications::NotificationOptions()); | 118 new extensions::api::notifications::NotificationOptions()); |
| 122 NotificationConversionHelper::NotificationToNotificationOptions( | 119 NotificationConversionHelper::NotificationToNotificationOptions( |
| 123 *(notification3), options3.get()); | 120 *(notification3), options3.get()); |
| 124 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST); | 121 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST); |
| 125 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title"); | 122 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title"); |
| 126 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message"); | 123 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message"); |
| 127 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title"); | 124 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title"); |
| 128 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message"); | 125 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message"); |
| 129 } | 126 } |
| OLD | NEW |