| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 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" |
| 38 #include "ui/views/controls/label.h" | 38 #include "ui/views/controls/label.h" |
| 39 #include "ui/views/layout/fill_layout.h" | 39 #include "ui/views/layout/fill_layout.h" |
| 40 #include "ui/views/view.h" | 40 #include "ui/views/view.h" |
| 41 #include "ui/views/widget/widget.h" | 41 #include "ui/views/widget/widget.h" |
| 42 | 42 |
| 43 #if defined(OS_CHROMEOS) |
| 44 #include "ash/system/chromeos/screen_layout_observer.h" |
| 45 #endif |
| 46 |
| 43 namespace ash { | 47 namespace ash { |
| 44 | 48 |
| 45 namespace { | 49 namespace { |
| 46 | 50 |
| 47 WebNotificationTray* GetTray() { | 51 WebNotificationTray* GetTray() { |
| 48 return StatusAreaWidgetTestHelper::GetStatusAreaWidget() | 52 return StatusAreaWidgetTestHelper::GetStatusAreaWidget() |
| 49 ->web_notification_tray(); | 53 ->web_notification_tray(); |
| 50 } | 54 } |
| 51 | 55 |
| 52 WebNotificationTray* GetSecondaryTray() { | 56 WebNotificationTray* GetSecondaryTray() { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 266 } |
| 263 | 267 |
| 264 // Display notification is ChromeOS only. | 268 // Display notification is ChromeOS only. |
| 265 #if defined(OS_CHROMEOS) | 269 #if defined(OS_CHROMEOS) |
| 266 | 270 |
| 267 // Verifies if the notification appears on both displays when extended mode. | 271 // Verifies if the notification appears on both displays when extended mode. |
| 268 TEST_P(WebNotificationTrayTest, PopupShownOnBothDisplays) { | 272 TEST_P(WebNotificationTrayTest, PopupShownOnBothDisplays) { |
| 269 if (!SupportsMultipleDisplays()) | 273 if (!SupportsMultipleDisplays()) |
| 270 return; | 274 return; |
| 271 | 275 |
| 272 // Enables to appear the notification for display changes. | 276 Shell::GetInstance() |
| 273 test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); | 277 ->screen_layout_observer() |
| 274 tray_delegate->set_should_show_display_notification(true); | 278 ->set_show_notifications_for_testing(true); |
| 275 | |
| 276 UpdateDisplay("400x400,200x200"); | 279 UpdateDisplay("400x400,200x200"); |
| 277 // UpdateDisplay() creates the display notifications, so popup is visible. | 280 // UpdateDisplay() creates the display notifications, so popup is visible. |
| 278 EXPECT_TRUE(GetTray()->IsPopupVisible()); | 281 EXPECT_TRUE(GetTray()->IsPopupVisible()); |
| 279 WebNotificationTray* secondary_tray = GetSecondaryTray(); | 282 WebNotificationTray* secondary_tray = GetSecondaryTray(); |
| 280 ASSERT_TRUE(secondary_tray); | 283 ASSERT_TRUE(secondary_tray); |
| 281 EXPECT_TRUE(secondary_tray->IsPopupVisible()); | 284 EXPECT_TRUE(secondary_tray->IsPopupVisible()); |
| 282 | 285 |
| 283 // Transition to mirroring and then back to extended display, which recreates | 286 // Transition to mirroring and then back to extended display, which recreates |
| 284 // root window controller and shelf with having notifications. This code | 287 // root window controller and shelf with having notifications. This code |
| 285 // 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 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 EXPECT_FALSE(tray->draw_background_as_active()); | 515 EXPECT_FALSE(tray->draw_background_as_active()); |
| 513 | 516 |
| 514 generator.ReleaseTouch(); | 517 generator.ReleaseTouch(); |
| 515 EXPECT_FALSE(tray->draw_background_as_active()); | 518 EXPECT_FALSE(tray->draw_background_as_active()); |
| 516 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); | 519 EXPECT_FALSE(tray->IsMessageCenterBubbleVisible()); |
| 517 } | 520 } |
| 518 | 521 |
| 519 #endif // OS_CHROMEOS | 522 #endif // OS_CHROMEOS |
| 520 | 523 |
| 521 } // namespace ash | 524 } // namespace ash |
| OLD | NEW |