OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_win.h" | 5 #include "chrome/browser/ui/views/message_center/web_notification_tray_win.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" |
11 #include "ash/system/tray/system_tray_item.h" | 11 #include "ash/system/tray/system_tray_item.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "content/public/test/test_utils.h" | 15 #include "content/public/test/test_utils.h" |
16 #include "ui/message_center/message_center_bubble.h" | 16 #include "ui/message_center/message_center_bubble.h" |
17 #include "ui/message_center/message_center_tray.h" | 17 #include "ui/message_center/message_center_tray.h" |
18 #include "ui/message_center/message_popup_bubble.h" | 18 #include "ui/message_center/message_popup_bubble.h" |
19 #include "ui/message_center/notification_list.h" | 19 #include "ui/message_center/notification_list.h" |
20 #include "ui/notifications/notification_types.h" | 20 #include "ui/message_center/notification_types.h" |
21 #include "ui/views/controls/label.h" | 21 #include "ui/views/controls/label.h" |
22 #include "ui/views/layout/fill_layout.h" | 22 #include "ui/views/layout/fill_layout.h" |
23 #include "ui/views/view.h" | 23 #include "ui/views/view.h" |
24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
25 | 25 |
26 namespace message_center { | 26 namespace message_center { |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 class TestDelegate : public message_center::MessageCenter::Delegate { | 30 class TestDelegate : public message_center::MessageCenter::Delegate { |
(...skipping 20 matching lines...) Expand all Loading... |
51 | 51 |
52 virtual void DisableExtension(const std::string& notification_id) OVERRIDE { } | 52 virtual void DisableExtension(const std::string& notification_id) OVERRIDE { } |
53 virtual void ShowSettings(const std::string& notification_id) OVERRIDE { } | 53 virtual void ShowSettings(const std::string& notification_id) OVERRIDE { } |
54 virtual void OnClicked(const std::string& notification_id) OVERRIDE { } | 54 virtual void OnClicked(const std::string& notification_id) OVERRIDE { } |
55 virtual void ShowSettingsDialog(gfx::NativeView context) OVERRIDE { } | 55 virtual void ShowSettingsDialog(gfx::NativeView context) OVERRIDE { } |
56 | 56 |
57 | 57 |
58 void AddNotification(const std::string& id) { | 58 void AddNotification(const std::string& id) { |
59 notification_ids_.insert(id); | 59 notification_ids_.insert(id); |
60 message_center_->AddNotification( | 60 message_center_->AddNotification( |
61 ui::notifications::NOTIFICATION_TYPE_SIMPLE, | 61 message_center::NOTIFICATION_TYPE_SIMPLE, |
62 id, | 62 id, |
63 ASCIIToUTF16("Test Web Notification"), | 63 ASCIIToUTF16("Test Web Notification"), |
64 ASCIIToUTF16("Notification message body."), | 64 ASCIIToUTF16("Notification message body."), |
65 ASCIIToUTF16("www.test.org"), | 65 ASCIIToUTF16("www.test.org"), |
66 "" /* extension id */, | 66 "" /* extension id */, |
67 NULL /* optional_fields */); | 67 NULL /* optional_fields */); |
68 } | 68 } |
69 | 69 |
70 void UpdateNotification(const std::string& old_id, | 70 void UpdateNotification(const std::string& old_id, |
71 const std::string& new_id) { | 71 const std::string& new_id) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); | 205 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); |
206 EXPECT_EQ(notifications_to_add, | 206 EXPECT_EQ(notifications_to_add, |
207 message_center->NotificationCount()); | 207 message_center->NotificationCount()); |
208 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, | 208 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, |
209 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); | 209 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); |
210 message_center->SetDelegate(NULL); | 210 message_center->SetDelegate(NULL); |
211 message_center->notification_list()->RemoveAllNotifications(); | 211 message_center->notification_list()->RemoveAllNotifications(); |
212 } | 212 } |
213 | 213 |
214 } // namespace message_center | 214 } // namespace message_center |
OLD | NEW |