| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/message_center/web_notification_tray.h" | 5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 virtual ~TestNotificationDelegate() {} | 59 virtual ~TestNotificationDelegate() {} |
| 60 | 60 |
| 61 std::string id_; | 61 std::string id_; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 void AddNotification(const std::string& id, const std::string& replace_id) { | 64 void AddNotification(const std::string& id, const std::string& replace_id) { |
| 65 ::Notification notification(GURL("chrome-extension://abbccedd"), | 65 ::Notification notification(GURL("chrome-extension://abbccedd"), |
| 66 GURL(), | 66 GURL(), |
| 67 ASCIIToUTF16("Test Web Notification"), | 67 ASCIIToUTF16("Test Web Notification"), |
| 68 ASCIIToUTF16("Notification message body."), | 68 ASCIIToUTF16("Notification message body."), |
| 69 WebKit::WebTextDirectionDefault, | 69 blink::WebTextDirectionDefault, |
| 70 string16(), | 70 string16(), |
| 71 ASCIIToUTF16(replace_id), | 71 ASCIIToUTF16(replace_id), |
| 72 new TestNotificationDelegate(id)); | 72 new TestNotificationDelegate(id)); |
| 73 | 73 |
| 74 g_browser_process->notification_ui_manager()->Add( | 74 g_browser_process->notification_ui_manager()->Add( |
| 75 notification, browser()->profile()); | 75 notification, browser()->profile()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void UpdateNotification(const std::string& replace_id, | 78 void UpdateNotification(const std::string& replace_id, |
| 79 const std::string& new_id) { | 79 const std::string& new_id) { |
| 80 ::Notification notification(GURL("chrome-extension://abbccedd"), | 80 ::Notification notification(GURL("chrome-extension://abbccedd"), |
| 81 GURL(""), | 81 GURL(""), |
| 82 ASCIIToUTF16("Updated Web Notification"), | 82 ASCIIToUTF16("Updated Web Notification"), |
| 83 ASCIIToUTF16("Updated message body."), | 83 ASCIIToUTF16("Updated message body."), |
| 84 WebKit::WebTextDirectionDefault, | 84 blink::WebTextDirectionDefault, |
| 85 string16(), | 85 string16(), |
| 86 ASCIIToUTF16(replace_id), | 86 ASCIIToUTF16(replace_id), |
| 87 new TestNotificationDelegate(new_id)); | 87 new TestNotificationDelegate(new_id)); |
| 88 | 88 |
| 89 g_browser_process->notification_ui_manager()->Add( | 89 g_browser_process->notification_ui_manager()->Add( |
| 90 notification, browser()->profile()); | 90 notification, browser()->profile()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void RemoveNotification(const std::string& id) { | 93 void RemoveNotification(const std::string& id) { |
| 94 g_browser_process->notification_ui_manager()->CancelById(id); | 94 g_browser_process->notification_ui_manager()->CancelById(id); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 tray->message_center_tray_->HidePopupBubble(); | 203 tray->message_center_tray_->HidePopupBubble(); |
| 204 tray->message_center_tray_->ShowPopupBubble(); | 204 tray->message_center_tray_->ShowPopupBubble(); |
| 205 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); | 205 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); |
| 206 EXPECT_EQ(notifications_to_add, message_center->NotificationCount()); | 206 EXPECT_EQ(notifications_to_add, message_center->NotificationCount()); |
| 207 NotificationList::PopupNotifications popups = | 207 NotificationList::PopupNotifications popups = |
| 208 message_center->GetPopupNotifications(); | 208 message_center->GetPopupNotifications(); |
| 209 EXPECT_EQ(kMaxVisiblePopupNotifications, popups.size()); | 209 EXPECT_EQ(kMaxVisiblePopupNotifications, popups.size()); |
| 210 } | 210 } |
| 211 | 211 |
| 212 } // namespace message_center | 212 } // namespace message_center |
| OLD | NEW |