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/common/system/web_notification/web_notification_tray.h" | 5 #include "ash/common/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/common/shelf/shelf_layout_manager.h" | 10 #include "ash/common/shelf/shelf_layout_manager.h" |
11 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
12 #include "ash/common/system/status_area_widget.h" | 12 #include "ash/common/system/status_area_widget.h" |
13 #include "ash/common/system/tray/system_tray.h" | 13 #include "ash/common/system/tray/system_tray.h" |
14 #include "ash/common/system/tray/system_tray_item.h" | 14 #include "ash/common/system/tray/system_tray_item.h" |
15 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h" | 15 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h" |
16 #include "ash/common/test/test_system_tray_delegate.h" | 16 #include "ash/common/test/test_system_tray_delegate.h" |
17 #include "ash/common/wm/window_state.h" | 17 #include "ash/common/wm/window_state.h" |
18 #include "ash/common/wm_lookup.h" | 18 #include "ash/common/wm_lookup.h" |
19 #include "ash/common/wm_window.h" | 19 #include "ash/common/wm_window.h" |
20 #include "ash/display/display_manager.h" | |
21 #include "ash/public/cpp/shell_window_ids.h" | 20 #include "ash/public/cpp/shell_window_ids.h" |
22 #include "ash/shell.h" | 21 #include "ash/shell.h" |
23 #include "ash/test/ash_md_test_base.h" | 22 #include "ash/test/ash_md_test_base.h" |
24 #include "ash/test/status_area_widget_test_helper.h" | 23 #include "ash/test/status_area_widget_test_helper.h" |
25 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
26 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
27 #include "ui/display/display.h" | 26 #include "ui/display/display.h" |
| 27 #include "ui/display/manager/display_manager.h" |
28 #include "ui/display/screen.h" | 28 #include "ui/display/screen.h" |
29 #include "ui/events/test/event_generator.h" | 29 #include "ui/events/test/event_generator.h" |
30 #include "ui/gfx/geometry/point.h" | 30 #include "ui/gfx/geometry/point.h" |
31 #include "ui/gfx/geometry/rect.h" | 31 #include "ui/gfx/geometry/rect.h" |
32 #include "ui/message_center/message_center_style.h" | 32 #include "ui/message_center/message_center_style.h" |
33 #include "ui/message_center/message_center_tray.h" | 33 #include "ui/message_center/message_center_tray.h" |
34 #include "ui/message_center/notification_list.h" | 34 #include "ui/message_center/notification_list.h" |
35 #include "ui/message_center/notification_types.h" | 35 #include "ui/message_center/notification_types.h" |
36 #include "ui/message_center/views/message_center_bubble.h" | 36 #include "ui/message_center/views/message_center_bubble.h" |
37 #include "ui/message_center/views/message_popup_collection.h" | 37 #include "ui/message_center/views/message_popup_collection.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // UpdateDisplay() creates the display notifications, so popup is visible. | 280 // UpdateDisplay() creates the display notifications, so popup is visible. |
281 EXPECT_TRUE(GetTray()->IsPopupVisible()); | 281 EXPECT_TRUE(GetTray()->IsPopupVisible()); |
282 WebNotificationTray* secondary_tray = GetSecondaryTray(); | 282 WebNotificationTray* secondary_tray = GetSecondaryTray(); |
283 ASSERT_TRUE(secondary_tray); | 283 ASSERT_TRUE(secondary_tray); |
284 EXPECT_TRUE(secondary_tray->IsPopupVisible()); | 284 EXPECT_TRUE(secondary_tray->IsPopupVisible()); |
285 | 285 |
286 // Transition to mirroring and then back to extended display, which recreates | 286 // Transition to mirroring and then back to extended display, which recreates |
287 // root window controller and shelf with having notifications. This code | 287 // root window controller and shelf with having notifications. This code |
288 // verifies it doesn't cause crash and popups are still visible. See | 288 // verifies it doesn't cause crash and popups are still visible. See |
289 // http://crbug.com/263664 | 289 // http://crbug.com/263664 |
290 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | |
291 | 290 |
292 display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); | 291 display_manager()->SetMultiDisplayMode(display::DisplayManager::MIRRORING); |
293 UpdateDisplay("400x400,200x200"); | 292 UpdateDisplay("400x400,200x200"); |
294 EXPECT_TRUE(GetTray()->IsPopupVisible()); | 293 EXPECT_TRUE(GetTray()->IsPopupVisible()); |
295 EXPECT_FALSE(GetSecondaryTray()); | 294 EXPECT_FALSE(GetSecondaryTray()); |
296 | 295 |
297 display_manager->SetMultiDisplayMode(DisplayManager::EXTENDED); | 296 display_manager()->SetMultiDisplayMode(display::DisplayManager::EXTENDED); |
298 UpdateDisplay("400x400,200x200"); | 297 UpdateDisplay("400x400,200x200"); |
299 EXPECT_TRUE(GetTray()->IsPopupVisible()); | 298 EXPECT_TRUE(GetTray()->IsPopupVisible()); |
300 secondary_tray = GetSecondaryTray(); | 299 secondary_tray = GetSecondaryTray(); |
301 ASSERT_TRUE(secondary_tray); | 300 ASSERT_TRUE(secondary_tray); |
302 EXPECT_TRUE(secondary_tray->IsPopupVisible()); | 301 EXPECT_TRUE(secondary_tray->IsPopupVisible()); |
303 } | 302 } |
304 | 303 |
305 #endif // defined(OS_CHROMEOS) | 304 #endif // defined(OS_CHROMEOS) |
306 | 305 |
307 // PopupAndSystemTray may fail in platforms other than ChromeOS because the | 306 // PopupAndSystemTray may fail in platforms other than ChromeOS because the |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 EXPECT_FALSE(tray->draw_background_as_active()); | 514 EXPECT_FALSE(tray->draw_background_as_active()); |
516 | 515 |
517 generator.ReleaseTouch(); | 516 generator.ReleaseTouch(); |
518 EXPECT_FALSE(tray->draw_background_as_active()); | 517 EXPECT_FALSE(tray->draw_background_as_active()); |
519 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 518 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
520 } | 519 } |
521 | 520 |
522 #endif // OS_CHROMEOS | 521 #endif // OS_CHROMEOS |
523 | 522 |
524 } // namespace ash | 523 } // namespace ash |
OLD | NEW |