| 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" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/system/status_area_widget.h" | 12 #include "ash/system/status_area_widget.h" |
| 13 #include "ash/system/tray/system_tray_item.h" | 13 #include "ash/system/tray/system_tray_item.h" |
| 14 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "ui/message_center/message_center_style.h" | 17 #include "ui/message_center/message_center_style.h" |
| 18 #include "ui/message_center/message_center_tray.h" | 18 #include "ui/message_center/message_center_tray.h" |
| 19 #include "ui/message_center/message_center_util.h" | 19 #include "ui/message_center/message_center_util.h" |
| 20 #include "ui/message_center/notification_list.h" | 20 #include "ui/message_center/notification_list.h" |
| 21 #include "ui/message_center/notification_types.h" | 21 #include "ui/message_center/notification_types.h" |
| 22 #include "ui/message_center/views/message_center_bubble.h" | 22 #include "ui/message_center/views/message_center_bubble.h" |
| 23 #include "ui/message_center/views/message_popup_bubble.h" | |
| 24 #include "ui/message_center/views/message_popup_collection.h" | 23 #include "ui/message_center/views/message_popup_collection.h" |
| 25 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
| 26 #include "ui/views/layout/fill_layout.h" | 25 #include "ui/views/layout/fill_layout.h" |
| 27 #include "ui/views/view.h" | 26 #include "ui/views/view.h" |
| 28 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 29 | 28 |
| 30 #if defined(OS_WIN) | |
| 31 #include "base/win/windows_version.h" | |
| 32 #endif | |
| 33 | |
| 34 namespace ash { | 29 namespace ash { |
| 35 | 30 |
| 36 namespace { | 31 namespace { |
| 37 | 32 |
| 38 WebNotificationTray* GetTray() { | 33 WebNotificationTray* GetTray() { |
| 39 return Shell::GetPrimaryRootWindowController()->shelf()-> | 34 return Shell::GetPrimaryRootWindowController()->shelf()-> |
| 40 status_area_widget()->web_notification_tray(); | 35 status_area_widget()->web_notification_tray(); |
| 41 } | 36 } |
| 42 | 37 |
| 43 message_center::MessageCenter* GetMessageCenter() { | 38 message_center::MessageCenter* GetMessageCenter() { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 for (size_t i = 0; i < notifications_to_add; ++i) { | 178 for (size_t i = 0; i < notifications_to_add; ++i) { |
| 184 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); | 179 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); |
| 185 AddNotification(id); | 180 AddNotification(id); |
| 186 } | 181 } |
| 187 // Hide and reshow the bubble so that it is updated immediately, not delayed. | 182 // Hide and reshow the bubble so that it is updated immediately, not delayed. |
| 188 GetTray()->SetHidePopupBubble(true); | 183 GetTray()->SetHidePopupBubble(true); |
| 189 GetTray()->SetHidePopupBubble(false); | 184 GetTray()->SetHidePopupBubble(false); |
| 190 EXPECT_TRUE(GetTray()->IsPopupVisible()); | 185 EXPECT_TRUE(GetTray()->IsPopupVisible()); |
| 191 EXPECT_EQ(notifications_to_add, | 186 EXPECT_EQ(notifications_to_add, |
| 192 GetMessageCenter()->NotificationCount()); | 187 GetMessageCenter()->NotificationCount()); |
| 193 if (message_center::IsRichNotificationEnabled()) { | 188 NotificationList::PopupNotifications popups = |
| 194 NotificationList::PopupNotifications popups = | 189 GetMessageCenter()->GetPopupNotifications(); |
| 195 GetMessageCenter()->GetPopupNotifications(); | 190 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size()); |
| 196 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size()); | |
| 197 } else { | |
| 198 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, | |
| 199 GetTray()->GetPopupBubbleForTest()->NumMessageViewsForTest()); | |
| 200 } | |
| 201 } | 191 } |
| 202 | 192 |
| 203 } // namespace ash | 193 } // namespace ash |
| OLD | NEW |