| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 180 } |
| 181 bool shown = tray->message_center_tray_->ShowMessageCenterBubble(); | 181 bool shown = tray->message_center_tray_->ShowMessageCenterBubble(); |
| 182 EXPECT_TRUE(shown); | 182 EXPECT_TRUE(shown); |
| 183 content::RunAllPendingInMessageLoop(); | 183 content::RunAllPendingInMessageLoop(); |
| 184 EXPECT_TRUE(tray->message_center_delegate_ != NULL); | 184 EXPECT_TRUE(tray->message_center_delegate_ != NULL); |
| 185 EXPECT_EQ(notifications_to_add, message_center->NotificationCount()); | 185 EXPECT_EQ(notifications_to_add, message_center->NotificationCount()); |
| 186 EXPECT_EQ(kMaxVisibleMessageCenterNotifications, | 186 EXPECT_EQ(kMaxVisibleMessageCenterNotifications, |
| 187 tray->message_center_delegate_->NumMessageViewsForTest()); | 187 tray->message_center_delegate_->NumMessageViewsForTest()); |
| 188 } | 188 } |
| 189 | 189 |
| 190 IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, ManyPopupNotifications) { | 190 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) |
| 191 // TODO(erg): linux_aura bringup: http://crbug.com/163931 |
| 192 #define MAYBE_ManyPopupNotifications DISABLED_ManyPopupNotifications |
| 193 #else |
| 194 #define MAYBE_ManyPopupNotifications ManyPopupNotifications |
| 195 #endif |
| 196 |
| 197 IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, MAYBE_ManyPopupNotifications) { |
| 191 scoped_ptr<WebNotificationTray> tray(new WebNotificationTray()); | 198 scoped_ptr<WebNotificationTray> tray(new WebNotificationTray()); |
| 192 message_center::MessageCenter* message_center = tray->message_center(); | 199 message_center::MessageCenter* message_center = tray->message_center(); |
| 193 | 200 |
| 194 // Add the max visible popup notifications +1, ensure the correct num visible. | 201 // Add the max visible popup notifications +1, ensure the correct num visible. |
| 195 size_t notifications_to_add = kMaxVisiblePopupNotifications + 1; | 202 size_t notifications_to_add = kMaxVisiblePopupNotifications + 1; |
| 196 for (size_t i = 0; i < notifications_to_add; ++i) { | 203 for (size_t i = 0; i < notifications_to_add; ++i) { |
| 197 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); | 204 std::string id = base::StringPrintf("test_id%d", static_cast<int>(i)); |
| 198 std::string replace_id = | 205 std::string replace_id = |
| 199 base::StringPrintf("replace_id%d", static_cast<int>(i)); | 206 base::StringPrintf("replace_id%d", static_cast<int>(i)); |
| 200 AddNotification(id, replace_id); | 207 AddNotification(id, replace_id); |
| 201 } | 208 } |
| 202 // Hide and reshow the bubble so that it is updated immediately, not delayed. | 209 // Hide and reshow the bubble so that it is updated immediately, not delayed. |
| 203 tray->message_center_tray_->HidePopupBubble(); | 210 tray->message_center_tray_->HidePopupBubble(); |
| 204 tray->message_center_tray_->ShowPopupBubble(); | 211 tray->message_center_tray_->ShowPopupBubble(); |
| 205 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); | 212 EXPECT_TRUE(tray->message_center_tray_->popups_visible()); |
| 206 EXPECT_EQ(notifications_to_add, message_center->NotificationCount()); | 213 EXPECT_EQ(notifications_to_add, message_center->NotificationCount()); |
| 207 NotificationList::PopupNotifications popups = | 214 NotificationList::PopupNotifications popups = |
| 208 message_center->GetPopupNotifications(); | 215 message_center->GetPopupNotifications(); |
| 209 EXPECT_EQ(kMaxVisiblePopupNotifications, popups.size()); | 216 EXPECT_EQ(kMaxVisiblePopupNotifications, popups.size()); |
| 210 } | 217 } |
| 211 | 218 |
| 212 } // namespace message_center | 219 } // namespace message_center |
| OLD | NEW |