| Index: chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
|
| diff --git a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
|
| index f0c54f30b181fa73546f78e8b0aa4aa40c805285..8ab6f0c380d70e0c5c2afab05fd0fd5ae5b00e0e 100644
|
| --- a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
|
| +++ b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc
|
| @@ -31,6 +31,28 @@ namespace {
|
| using DisplayUnitInfoList = DisplayInfoProvider::DisplayUnitInfoList;
|
| using DisplayLayoutList = DisplayInfoProvider::DisplayLayoutList;
|
|
|
| +void EnableMaximizeMode(bool enable) {
|
| + ash::Shell::GetInstance()
|
| + ->maximize_mode_controller()
|
| + ->EnableMaximizeModeWindowManager(enable);
|
| +}
|
| +
|
| +bool UserRotationLocked() {
|
| + return ash::Shell::GetInstance()
|
| + ->screen_orientation_controller()
|
| + ->user_rotation_locked();
|
| +}
|
| +
|
| +void SetUserRotationLocked(bool rotation_locked) {
|
| + if (ash::Shell::GetInstance()
|
| + ->screen_orientation_controller()
|
| + ->user_rotation_locked() != rotation_locked) {
|
| + ash::Shell::GetInstance()
|
| + ->screen_orientation_controller()
|
| + ->ToggleUserRotationLock();
|
| + }
|
| +}
|
| +
|
| class DisplayInfoProviderChromeosTest : public ash::test::AshTestBase {
|
| public:
|
| DisplayInfoProviderChromeosTest() {}
|
| @@ -921,9 +943,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotationBeforeMaximizeMode) {
|
| EXPECT_FALSE(screen_orientation_controller->rotation_locked());
|
|
|
| // Entering maximize mode enables accelerometer screen rotations.
|
| - ash::Shell::Get()
|
| - ->maximize_mode_controller()
|
| - ->EnableMaximizeModeWindowManager(true);
|
| + EnableMaximizeMode(true);
|
| // Rotation lock should not activate because DisplayInfoProvider::SetInfo()
|
| // was called when not in maximize mode.
|
| EXPECT_FALSE(screen_orientation_controller->rotation_locked());
|
| @@ -936,9 +956,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotationBeforeMaximizeMode) {
|
| EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
|
|
|
| // Exiting maximize mode should restore the initial rotation
|
| - ash::Shell::Get()
|
| - ->maximize_mode_controller()
|
| - ->EnableMaximizeModeWindowManager(false);
|
| + EnableMaximizeMode(false);
|
| EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
|
| }
|
|
|
| @@ -946,9 +964,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotationBeforeMaximizeMode) {
|
| // against accelerometer rotations.
|
| TEST_F(DisplayInfoProviderChromeosTest, SetRotationDuringMaximizeMode) {
|
| // Entering maximize mode enables accelerometer screen rotations.
|
| - ash::Shell::Get()
|
| - ->maximize_mode_controller()
|
| - ->EnableMaximizeModeWindowManager(true);
|
| + EnableMaximizeMode(true);
|
|
|
| ASSERT_FALSE(ash::Shell::GetInstance()
|
| ->screen_orientation_controller()
|
| @@ -970,6 +986,37 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotationDuringMaximizeMode) {
|
| ->rotation_locked());
|
| }
|
|
|
| +// Tests that setting display rotation is ignored on maximize mode with user
|
| +// rotation locked.
|
| +TEST_F(DisplayInfoProviderChromeosTest,
|
| + SetRotationOnMaximizeModeWithUserRotationLocked) {
|
| + EnableMaximizeMode(true);
|
| + SetUserRotationLocked(true);
|
| + EXPECT_TRUE(UserRotationLocked());
|
| + EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
|
| + api::system_display::DisplayProperties info;
|
| + info.rotation.reset(new int(90));
|
| + bool success = false;
|
| + std::string error;
|
| + CallSetDisplayUnitInfo(
|
| + base::Int64ToString(display::Display::InternalDisplayId()), info,
|
| + &success, &error);
|
| + ASSERT_TRUE(success);
|
| + EXPECT_TRUE(error.empty());
|
| + EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
|
| +
|
| + SetUserRotationLocked(false);
|
| + EXPECT_FALSE(UserRotationLocked());
|
| + EXPECT_EQ(display::Display::ROTATE_0, GetCurrentInternalDisplayRotation());
|
| + success = false;
|
| + CallSetDisplayUnitInfo(
|
| + base::Int64ToString(display::Display::InternalDisplayId()), info,
|
| + &success, &error);
|
| + ASSERT_TRUE(success);
|
| + EXPECT_TRUE(error.empty());
|
| + EXPECT_EQ(display::Display::ROTATE_90, GetCurrentInternalDisplayRotation());
|
| +}
|
| +
|
| TEST_F(DisplayInfoProviderChromeosTest, SetInvalidRotation) {
|
| UpdateDisplay("1200x600,600x1000*2");
|
|
|
|
|