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 TEST_F(NotificationConversionHelperTest, NotificationToNotificationOptions) { | 80 // TODO(liyanhou): This test is disabled due to memory leaks. Fix and re-enable. |
| 81 // http://crbug.com/403759 |
| 82 TEST_F(NotificationConversionHelperTest, |
| 83 DISABLED_NotificationToNotificationOptions) { |
81 // Create a notification of image type | 84 // Create a notification of image type |
82 scoped_ptr<Notification> notification1 = | 85 scoped_ptr<Notification> notification1 = |
83 CreateNotification(message_center::NOTIFICATION_TYPE_IMAGE); | 86 CreateNotification(message_center::NOTIFICATION_TYPE_IMAGE); |
84 scoped_ptr<extensions::api::notifications::NotificationOptions> options1( | 87 scoped_ptr<extensions::api::notifications::NotificationOptions> options1( |
85 new extensions::api::notifications::NotificationOptions()); | 88 new extensions::api::notifications::NotificationOptions()); |
86 NotificationConversionHelper::NotificationToNotificationOptions( | 89 NotificationConversionHelper::NotificationToNotificationOptions( |
87 *(notification1), options1.get()); | 90 *(notification1), options1.get()); |
88 | 91 |
89 EXPECT_EQ(options1->type, | 92 EXPECT_EQ(options1->type, |
90 extensions::api::notifications::TEMPLATE_TYPE_IMAGE); | 93 extensions::api::notifications::TEMPLATE_TYPE_IMAGE); |
(...skipping 26 matching lines...) Expand all Loading... |
117 scoped_ptr<extensions::api::notifications::NotificationOptions> options3( | 120 scoped_ptr<extensions::api::notifications::NotificationOptions> options3( |
118 new extensions::api::notifications::NotificationOptions()); | 121 new extensions::api::notifications::NotificationOptions()); |
119 NotificationConversionHelper::NotificationToNotificationOptions( | 122 NotificationConversionHelper::NotificationToNotificationOptions( |
120 *(notification3), options3.get()); | 123 *(notification3), options3.get()); |
121 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST); | 124 EXPECT_EQ(options3->type, extensions::api::notifications::TEMPLATE_TYPE_LIST); |
122 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title"); | 125 EXPECT_EQ(options3->items->at(0)->title, "Item 1 Title"); |
123 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message"); | 126 EXPECT_EQ(options3->items->at(0)->message, "Item 1 Message"); |
124 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title"); | 127 EXPECT_EQ(options3->items->at(1)->title, "Item 2 Title"); |
125 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message"); | 128 EXPECT_EQ(options3->items->at(1)->message, "Item 2 Message"); |
126 } | 129 } |
OLD | NEW |