| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/display/screen_orientation_controller_chromeos.h" | 5 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 11 #include "ash/common/test/test_system_tray_delegate.h" | 11 #include "ash/common/test/test_system_tray_delegate.h" |
| 12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/content/shell_content_state.h" | 14 #include "ash/content/shell_content_state.h" |
| 15 #include "ash/display/display_manager.h" | 15 #include "ash/display/display_manager.h" |
| 16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "ash/system/chromeos/screen_layout_observer.h" |
| 17 #include "ash/test/ash_test_base.h" | 18 #include "ash/test/ash_test_base.h" |
| 18 #include "ash/test/ash_test_environment_content.h" | 19 #include "ash/test/ash_test_environment_content.h" |
| 19 #include "ash/test/ash_test_helper.h" | 20 #include "ash/test/ash_test_helper.h" |
| 20 #include "ash/test/content/test_shell_content_state.h" | 21 #include "ash/test/content/test_shell_content_state.h" |
| 21 #include "ash/test/display_manager_test_api.h" | 22 #include "ash/test/display_manager_test_api.h" |
| 22 #include "ash/test/test_shell_delegate.h" | 23 #include "ash/test/test_shell_delegate.h" |
| 23 #include "base/command_line.h" | 24 #include "base/command_line.h" |
| 24 #include "chromeos/accelerometer/accelerometer_reader.h" | 25 #include "chromeos/accelerometer/accelerometer_reader.h" |
| 25 #include "chromeos/accelerometer/accelerometer_types.h" | 26 #include "chromeos/accelerometer/accelerometer_types.h" |
| 26 #include "content/public/browser/browser_context.h" | 27 #include "content/public/browser/browser_context.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 TriggerLidUpdate(gravity); | 414 TriggerLidUpdate(gravity); |
| 414 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); | 415 EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation()); |
| 415 } | 416 } |
| 416 | 417 |
| 417 // The ScreenLayoutObserver class that is responsible for adding/updating | 418 // The ScreenLayoutObserver class that is responsible for adding/updating |
| 418 // MessageCenter notifications is only added to the SystemTray on ChromeOS. | 419 // MessageCenter notifications is only added to the SystemTray on ChromeOS. |
| 419 // Tests that the screen rotation notifications are suppressed when | 420 // Tests that the screen rotation notifications are suppressed when |
| 420 // triggered by the accelerometer. | 421 // triggered by the accelerometer. |
| 421 TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) { | 422 TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) { |
| 422 EnableMaximizeMode(true); | 423 EnableMaximizeMode(true); |
| 423 test::TestSystemTrayDelegate* tray_delegate = GetSystemTrayDelegate(); | 424 Shell::GetInstance() |
| 424 tray_delegate->set_should_show_display_notification(true); | 425 ->screen_layout_observer() |
| 426 ->set_show_notifications_for_testing(true); |
| 425 test::DisplayManagerTestApi(display_manager()) | 427 test::DisplayManagerTestApi(display_manager()) |
| 426 .SetFirstDisplayAsInternalDisplay(); | 428 .SetFirstDisplayAsInternalDisplay(); |
| 427 | 429 |
| 428 message_center::MessageCenter* message_center = | 430 message_center::MessageCenter* message_center = |
| 429 message_center::MessageCenter::Get(); | 431 message_center::MessageCenter::Get(); |
| 430 | 432 |
| 431 EXPECT_EQ(0u, message_center->NotificationCount()); | 433 EXPECT_EQ(0u, message_center->NotificationCount()); |
| 432 EXPECT_FALSE(message_center->HasPopupNotifications()); | 434 EXPECT_FALSE(message_center->HasPopupNotifications()); |
| 433 | 435 |
| 434 // Make sure notifications are still displayed when | 436 // Make sure notifications are still displayed when |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 | 660 |
| 659 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( | 661 Shell::GetInstance()->screen_orientation_controller()->SetDisplayRotation( |
| 660 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); | 662 kNewRotation, display::Display::ROTATION_SOURCE_ACTIVE); |
| 661 | 663 |
| 662 EXPECT_EQ(kNewRotation, display_manager() | 664 EXPECT_EQ(kNewRotation, display_manager() |
| 663 ->GetDisplayInfo(kInternalDisplayId) | 665 ->GetDisplayInfo(kInternalDisplayId) |
| 664 .GetActiveRotation()); | 666 .GetActiveRotation()); |
| 665 } | 667 } |
| 666 | 668 |
| 667 } // namespace ash | 669 } // namespace ash |
| OLD | NEW |