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" |
11 #include "ash/system/tray/system_tray_item.h" | 11 #include "ash/system/tray/system_tray_item.h" |
12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "ui/message_center/message_center_tray.h" | 15 #include "ui/message_center/message_center_tray.h" |
| 16 #include "ui/message_center/message_center_util.h" |
16 #include "ui/message_center/notification_list.h" | 17 #include "ui/message_center/notification_list.h" |
17 #include "ui/message_center/notification_types.h" | 18 #include "ui/message_center/notification_types.h" |
18 #include "ui/message_center/views/message_center_bubble.h" | 19 #include "ui/message_center/views/message_center_bubble.h" |
19 #include "ui/message_center/views/message_popup_bubble.h" | 20 #include "ui/message_center/views/message_popup_bubble.h" |
| 21 #include "ui/message_center/views/message_popup_collection.h" |
20 #include "ui/views/controls/label.h" | 22 #include "ui/views/controls/label.h" |
21 #include "ui/views/layout/fill_layout.h" | 23 #include "ui/views/layout/fill_layout.h" |
22 #include "ui/views/view.h" | 24 #include "ui/views/view.h" |
23 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
24 | 26 |
25 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
26 #include "base/win/windows_version.h" | 28 #include "base/win/windows_version.h" |
27 #endif | 29 #endif |
28 | 30 |
29 namespace ash { | 31 namespace ash { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 for (size_t i = 0; i < notifications_to_add; ++i) { | 214 for (size_t i = 0; i < notifications_to_add; ++i) { |
213 std::string id = StringPrintf("test_id%d", static_cast<int>(i)); | 215 std::string id = StringPrintf("test_id%d", static_cast<int>(i)); |
214 delegate->AddNotification(tray, id); | 216 delegate->AddNotification(tray, id); |
215 } | 217 } |
216 // Hide and reshow the bubble so that it is updated immediately, not delayed. | 218 // Hide and reshow the bubble so that it is updated immediately, not delayed. |
217 tray->SetHidePopupBubble(true); | 219 tray->SetHidePopupBubble(true); |
218 tray->SetHidePopupBubble(false); | 220 tray->SetHidePopupBubble(false); |
219 EXPECT_TRUE(tray->IsPopupVisible()); | 221 EXPECT_TRUE(tray->IsPopupVisible()); |
220 EXPECT_EQ(notifications_to_add, | 222 EXPECT_EQ(notifications_to_add, |
221 get_message_center()->NotificationCount()); | 223 get_message_center()->NotificationCount()); |
222 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, | 224 if (message_center::IsRichNotificationEnabled()) { |
223 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); | 225 NotificationList::Delegate* list_delegate = |
| 226 tray->popup_collection_.get()->list_delegate_; |
| 227 NotificationList::PopupNotifications popups = |
| 228 list_delegate->GetNotificationList()->GetPopupNotifications(); |
| 229 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, popups.size()); |
| 230 } else { |
| 231 EXPECT_EQ(NotificationList::kMaxVisiblePopupNotifications, |
| 232 tray->GetPopupBubbleForTest()->NumMessageViewsForTest()); |
| 233 } |
224 get_message_center()->SetDelegate(NULL); | 234 get_message_center()->SetDelegate(NULL); |
225 get_message_center()->notification_list()->RemoveAllNotifications(); | 235 get_message_center()->notification_list()->RemoveAllNotifications(); |
226 } | 236 } |
227 | 237 |
228 } // namespace ash | 238 } // namespace ash |
OLD | NEW |