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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "ash/public/cpp/config.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
11 #include "ash/shelf/shelf_layout_manager.h" | 12 #include "ash/shelf/shelf_layout_manager.h" |
12 #include "ash/shelf/wm_shelf.h" | 13 #include "ash/shelf/wm_shelf.h" |
13 #include "ash/shell.h" | 14 #include "ash/shell.h" |
14 #include "ash/shell_port.h" | |
15 #include "ash/system/screen_layout_observer.h" | 15 #include "ash/system/screen_layout_observer.h" |
16 #include "ash/system/status_area_widget.h" | 16 #include "ash/system/status_area_widget.h" |
17 #include "ash/system/tray/system_tray.h" | 17 #include "ash/system/tray/system_tray.h" |
18 #include "ash/system/tray/system_tray_item.h" | 18 #include "ash/system/tray/system_tray_item.h" |
19 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" | 19 #include "ash/system/web_notification/ash_popup_alignment_delegate.h" |
20 #include "ash/test/ash_test_base.h" | 20 #include "ash/test/ash_test_base.h" |
21 #include "ash/test/status_area_widget_test_helper.h" | 21 #include "ash/test/status_area_widget_test_helper.h" |
22 #include "ash/test/test_system_tray_delegate.h" | 22 #include "ash/test/test_system_tray_delegate.h" |
23 #include "ash/wm/window_state.h" | 23 #include "ash/wm/window_state.h" |
24 #include "ash/wm_window.h" | 24 #include "ash/wm_window.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 EXPECT_TRUE(GetTray()->IsPopupVisible()); | 247 EXPECT_TRUE(GetTray()->IsPopupVisible()); |
248 EXPECT_EQ(notifications_to_add, GetMessageCenter()->NotificationCount()); | 248 EXPECT_EQ(notifications_to_add, GetMessageCenter()->NotificationCount()); |
249 NotificationList::PopupNotifications popups = | 249 NotificationList::PopupNotifications popups = |
250 GetMessageCenter()->GetPopupNotifications(); | 250 GetMessageCenter()->GetPopupNotifications(); |
251 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size()); | 251 EXPECT_EQ(message_center::kMaxVisiblePopupNotifications, popups.size()); |
252 } | 252 } |
253 | 253 |
254 // Verifies if the notification appears on both displays when extended mode. | 254 // Verifies if the notification appears on both displays when extended mode. |
255 TEST_F(WebNotificationTrayTest, PopupShownOnBothDisplays) { | 255 TEST_F(WebNotificationTrayTest, PopupShownOnBothDisplays) { |
256 // TODO: needs ScreenLayoutObserver, http://crbug.com/696752. | 256 // TODO: needs ScreenLayoutObserver, http://crbug.com/696752. |
257 if (ShellPort::Get()->IsRunningInMash()) | 257 if (Shell::GetAshConfig() == Config::MASH) |
258 return; | 258 return; |
259 | 259 |
260 Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( | 260 Shell::Get()->screen_layout_observer()->set_show_notifications_for_testing( |
261 true); | 261 true); |
262 UpdateDisplay("400x400,200x200"); | 262 UpdateDisplay("400x400,200x200"); |
263 // UpdateDisplay() creates the display notifications, so popup is visible. | 263 // UpdateDisplay() creates the display notifications, so popup is visible. |
264 EXPECT_TRUE(GetTray()->IsPopupVisible()); | 264 EXPECT_TRUE(GetTray()->IsPopupVisible()); |
265 WebNotificationTray* secondary_tray = GetSecondaryTray(); | 265 WebNotificationTray* secondary_tray = GetSecondaryTray(); |
266 ASSERT_TRUE(secondary_tray); | 266 ASSERT_TRUE(secondary_tray); |
267 EXPECT_TRUE(secondary_tray->IsPopupVisible()); | 267 EXPECT_TRUE(secondary_tray->IsPopupVisible()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray()); | 389 int bottom_second = GetPopupWorkAreaBottomForTray(GetSecondaryTray()); |
390 | 390 |
391 // System tray is created on the primary display. The popups in the secondary | 391 // System tray is created on the primary display. The popups in the secondary |
392 // tray aren't affected. | 392 // tray aren't affected. |
393 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); | 393 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); |
394 EXPECT_GT(bottom, GetPopupWorkAreaBottom()); | 394 EXPECT_GT(bottom, GetPopupWorkAreaBottom()); |
395 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray())); | 395 EXPECT_EQ(bottom_second, GetPopupWorkAreaBottomForTray(GetSecondaryTray())); |
396 } | 396 } |
397 | 397 |
398 } // namespace ash | 398 } // namespace ash |
OLD | NEW |