OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/system/web_notification/web_notification_tray.h" | 5 #include "ash/system/web_notification/web_notification_tray.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 WebNotificationTrayTest() {} | 49 WebNotificationTrayTest() {} |
50 virtual ~WebNotificationTrayTest() {} | 50 virtual ~WebNotificationTrayTest() {} |
51 | 51 |
52 virtual void TearDown() OVERRIDE { | 52 virtual void TearDown() OVERRIDE { |
53 GetMessageCenter()->RemoveAllNotifications(false); | 53 GetMessageCenter()->RemoveAllNotifications(false); |
54 test::AshTestBase::TearDown(); | 54 test::AshTestBase::TearDown(); |
55 } | 55 } |
56 | 56 |
57 protected: | 57 protected: |
58 void AddNotification(const std::string& id) { | 58 void AddNotification(const std::string& id) { |
59 GetMessageCenter()->AddNotification( | 59 scoped_ptr<message_center::Notification> notification; |
| 60 notification.reset(new message_center::Notification( |
60 message_center::NOTIFICATION_TYPE_SIMPLE, | 61 message_center::NOTIFICATION_TYPE_SIMPLE, |
61 id, | 62 id, |
62 ASCIIToUTF16("Test Web Notification"), | 63 ASCIIToUTF16("Test Web Notification"), |
63 ASCIIToUTF16("Notification message body."), | 64 ASCIIToUTF16("Notification message body."), |
| 65 gfx::Image(), |
64 ASCIIToUTF16("www.test.org"), | 66 ASCIIToUTF16("www.test.org"), |
65 "" /* extension id */, | 67 "" /* extension id */, |
66 NULL /* optional_fields */, | 68 NULL /* optional_fields */, |
67 NULL /* delegate */); | 69 NULL /* delegate */)); |
| 70 GetMessageCenter()->AddNotification(notification.Pass()); |
68 } | 71 } |
69 | 72 |
70 void UpdateNotification(const std::string& old_id, | 73 void UpdateNotification(const std::string& old_id, |
71 const std::string& new_id) { | 74 const std::string& new_id) { |
72 GetMessageCenter()->UpdateNotification( | 75 scoped_ptr<message_center::Notification> notification; |
73 old_id, | 76 notification.reset(new message_center::Notification( |
| 77 message_center::NOTIFICATION_TYPE_SIMPLE, |
74 new_id, | 78 new_id, |
75 ASCIIToUTF16("Updated Web Notification"), | 79 ASCIIToUTF16("Updated Web Notification"), |
76 ASCIIToUTF16("Updated message body."), | 80 ASCIIToUTF16("Updated message body."), |
77 NULL, | 81 gfx::Image(), |
78 NULL); | 82 ASCIIToUTF16("www.test.org"), |
| 83 "" /* extension id */, |
| 84 NULL /* optional_fields */, |
| 85 NULL /* delegate */)); |
| 86 GetMessageCenter()->UpdateNotification(old_id, notification.Pass()); |
79 } | 87 } |
80 | 88 |
81 void RemoveNotification(const std::string& id) { | 89 void RemoveNotification(const std::string& id) { |
82 GetMessageCenter()->RemoveNotification(id, false); | 90 GetMessageCenter()->RemoveNotification(id, false); |
83 } | 91 } |
84 | 92 |
85 views::Widget* GetWidget() { | 93 views::Widget* GetWidget() { |
86 return GetTray()->GetWidget(); | 94 return GetTray()->GetWidget(); |
87 } | 95 } |
88 | 96 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 NotificationList::PopupNotifications popups = | 194 NotificationList::PopupNotifications popups = |
187 GetMessageCenter()->GetPopupNotifications(); | 195 GetMessageCenter()->GetPopupNotifications(); |
188 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size()); | 196 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size()); |
189 } else { | 197 } else { |
190 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, | 198 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, |
191 GetTray()->GetPopupBubbleForTest()->NumMessageViewsForTest()); | 199 GetTray()->GetPopupBubbleForTest()->NumMessageViewsForTest()); |
192 } | 200 } |
193 } | 201 } |
194 | 202 |
195 } // namespace ash | 203 } // namespace ash |
OLD | NEW |