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/system/status_area_widget.h" | 10 #include "ash/system/status_area_widget.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 virtual void ShowSettings(const std::string& notifcation_id) OVERRIDE { | 68 virtual void ShowSettings(const std::string& notifcation_id) OVERRIDE { |
69 } | 69 } |
70 | 70 |
71 virtual void ShowSettingsDialog(gfx::NativeView context) OVERRIDE { | 71 virtual void ShowSettingsDialog(gfx::NativeView context) OVERRIDE { |
72 } | 72 } |
73 | 73 |
74 virtual void OnClicked(const std::string& notifcation_id) OVERRIDE { | 74 virtual void OnClicked(const std::string& notifcation_id) OVERRIDE { |
75 } | 75 } |
76 | 76 |
| 77 virtual void OnButtonClicked(const std::string& id, |
| 78 int button_index) OVERRIDE { |
| 79 } |
| 80 |
77 void AddNotification(WebNotificationTray* tray, const std::string& id) { | 81 void AddNotification(WebNotificationTray* tray, const std::string& id) { |
78 notification_ids_.insert(id); | 82 notification_ids_.insert(id); |
79 get_message_center()->AddNotification( | 83 get_message_center()->AddNotification( |
80 message_center::NOTIFICATION_TYPE_SIMPLE, | 84 message_center::NOTIFICATION_TYPE_SIMPLE, |
81 id, | 85 id, |
82 ASCIIToUTF16("Test Web Notification"), | 86 ASCIIToUTF16("Test Web Notification"), |
83 ASCIIToUTF16("Notification message body."), | 87 ASCIIToUTF16("Notification message body."), |
84 ASCIIToUTF16("www.test.org"), | 88 ASCIIToUTF16("www.test.org"), |
85 "" /* extension id */, | 89 "" /* extension id */, |
86 NULL /* optional_fields */); | 90 NULL /* optional_fields */); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 std::string id = StringPrintf("test_id%d", static_cast<int>(i)); | 219 std::string id = StringPrintf("test_id%d", static_cast<int>(i)); |
216 delegate->AddNotification(tray, id); | 220 delegate->AddNotification(tray, id); |
217 } | 221 } |
218 // Hide and reshow the bubble so that it is updated immediately, not delayed. | 222 // Hide and reshow the bubble so that it is updated immediately, not delayed. |
219 tray->SetHidePopupBubble(true); | 223 tray->SetHidePopupBubble(true); |
220 tray->SetHidePopupBubble(false); | 224 tray->SetHidePopupBubble(false); |
221 EXPECT_TRUE(tray->IsPopupVisible()); | 225 EXPECT_TRUE(tray->IsPopupVisible()); |
222 EXPECT_EQ(notifications_to_add, | 226 EXPECT_EQ(notifications_to_add, |
223 get_message_center()->NotificationCount()); | 227 get_message_center()->NotificationCount()); |
224 if (message_center::IsRichNotificationEnabled()) { | 228 if (message_center::IsRichNotificationEnabled()) { |
225 NotificationList::Delegate* list_delegate = | |
226 tray->popup_collection_.get()->list_delegate_; | |
227 NotificationList::PopupNotifications popups = | 229 NotificationList::PopupNotifications popups = |
228 list_delegate->GetNotificationList()->GetPopupNotifications(); | 230 get_message_center()->notification_list()->GetPopupNotifications(); |
229 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, popups.size()); | 231 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, popups.size()); |
230 } else { | 232 } else { |
231 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, | 233 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, |
232 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); | 234 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); |
233 } | 235 } |
234 get_message_center()->SetDelegate(NULL); | 236 get_message_center()->SetDelegate(NULL); |
235 get_message_center()->notification_list()->RemoveAllNotifications(); | 237 get_message_center()->notification_list()->RemoveAllNotifications(); |
236 } | 238 } |
237 | 239 |
238 } // namespace ash | 240 } // namespace ash |
OLD | NEW |