| 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/shell_window_ids.h" | 12 #include "ash/common/shell_window_ids.h" |
| 13 #include "ash/common/system/status_area_widget.h" | 13 #include "ash/common/system/status_area_widget.h" |
| 14 #include "ash/common/system/tray/system_tray.h" | 14 #include "ash/common/system/tray/system_tray.h" |
| 15 #include "ash/common/system/tray/system_tray_item.h" | 15 #include "ash/common/system/tray/system_tray_item.h" |
| 16 #include "ash/common/system/web_notification/ash_popup_alignment_delegate.h" | 16 #include "ash/common/system/web_notification/ash_popup_alignment_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" | 20 #include "ash/display/display_manager.h" |
| 21 #include "ash/shell.h" | 21 #include "ash/shell.h" |
| 22 #include "ash/test/ash_md_test_base.h" | 22 #include "ash/test/ash_md_test_base.h" |
| 23 #include "ash/test/status_area_widget_test_helper.h" | 23 #include "ash/test/status_area_widget_test_helper.h" |
| 24 #include "ash/test/test_system_tray_delegate.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" |
| 28 #include "ui/display/screen.h" | 27 #include "ui/display/screen.h" |
| 29 #include "ui/events/test/event_generator.h" | 28 #include "ui/events/test/event_generator.h" |
| 30 #include "ui/gfx/geometry/point.h" | 29 #include "ui/gfx/geometry/point.h" |
| 31 #include "ui/gfx/geometry/rect.h" | 30 #include "ui/gfx/geometry/rect.h" |
| 32 #include "ui/message_center/message_center_style.h" | 31 #include "ui/message_center/message_center_style.h" |
| 33 #include "ui/message_center/message_center_tray.h" | 32 #include "ui/message_center/message_center_tray.h" |
| 34 #include "ui/message_center/notification_list.h" | 33 #include "ui/message_center/notification_list.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 261 } |
| 263 | 262 |
| 264 // Display notification is ChromeOS only. | 263 // Display notification is ChromeOS only. |
| 265 #if defined(OS_CHROMEOS) | 264 #if defined(OS_CHROMEOS) |
| 266 | 265 |
| 267 // Verifies if the notification appears on both displays when extended mode. | 266 // Verifies if the notification appears on both displays when extended mode. |
| 268 TEST_P(WebNotificationTrayTest, PopupShownOnBothDisplays) { | 267 TEST_P(WebNotificationTrayTest, PopupShownOnBothDisplays) { |
| 269 if (!SupportsMultipleDisplays()) | 268 if (!SupportsMultipleDisplays()) |
| 270 return; | 269 return; |
| 271 | 270 |
| 272 // Enables to appear the notification for display changes. | |
| 273 test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); | |
| 274 tray_delegate->set_should_show_display_notification(true); | |
| 275 | |
| 276 UpdateDisplay("400x400,200x200"); | 271 UpdateDisplay("400x400,200x200"); |
| 277 // UpdateDisplay() creates the display notifications, so popup is visible. | 272 // UpdateDisplay() creates the display notifications, so popup is visible. |
| 278 EXPECT_TRUE(GetTray()->IsPopupVisible()); | 273 EXPECT_TRUE(GetTray()->IsPopupVisible()); |
| 279 WebNotificationTray* secondary_tray = GetSecondaryTray(); | 274 WebNotificationTray* secondary_tray = GetSecondaryTray(); |
| 280 ASSERT_TRUE(secondary_tray); | 275 ASSERT_TRUE(secondary_tray); |
| 281 EXPECT_TRUE(secondary_tray->IsPopupVisible()); | 276 EXPECT_TRUE(secondary_tray->IsPopupVisible()); |
| 282 | 277 |
| 283 // Transition to mirroring and then back to extended display, which recreates | 278 // Transition to mirroring and then back to extended display, which recreates |
| 284 // root window controller and shelf with having notifications. This code | 279 // root window controller and shelf with having notifications. This code |
| 285 // verifies it doesn't cause crash and popups are still visible. See | 280 // verifies it doesn't cause crash and popups are still visible. See |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 EXPECT_FALSE(tray->draw_background_as_active()); | 507 EXPECT_FALSE(tray->draw_background_as_active()); |
| 513 | 508 |
| 514 generator.ReleaseTouch(); | 509 generator.ReleaseTouch(); |
| 515 EXPECT_FALSE(tray->draw_background_as_active()); | 510 EXPECT_FALSE(tray->draw_background_as_active()); |
| 516 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 511 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
| 517 } | 512 } |
| 518 | 513 |
| 519 #endif // OS_CHROMEOS | 514 #endif // OS_CHROMEOS |
| 520 | 515 |
| 521 } // namespace ash | 516 } // namespace ash |
| OLD | NEW |