Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Unified Diff: ash/wm/maximize_mode/maximize_mode_controller_unittest.cc

Issue 303723003: Lock Rotation on user settings changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also update current rotation Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
diff --git a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
index e9d925d729a7d322a761b1709079e1d4b82c07ef..0ee23af2c5359035ac5036d2d8a44868e4f2edbe 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -499,7 +499,7 @@ TEST_F(MaximizeModeControllerTest, RotationLockPreventsRotation) {
gfx::Vector3dF gravity(-1.0f, 0.0f, 0.0f);
- maximize_mode_controller()->set_rotation_locked(true);
+ maximize_mode_controller()->SetRotationLocked(true);
// Turn past the threshold for rotation.
float degrees = 90.0;
@@ -508,7 +508,7 @@ TEST_F(MaximizeModeControllerTest, RotationLockPreventsRotation) {
TriggerAccelerometerUpdate(gravity, gravity);
EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation());
- maximize_mode_controller()->set_rotation_locked(false);
+ maximize_mode_controller()->SetRotationLocked(false);
TriggerAccelerometerUpdate(gravity, gravity);
EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation());
}
@@ -524,7 +524,7 @@ TEST_F(MaximizeModeControllerTest, ExitingMaximizeModeClearRotationLock) {
gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
ASSERT_TRUE(IsMaximizeModeStarted());
- maximize_mode_controller()->set_rotation_locked(true);
+ maximize_mode_controller()->SetRotationLocked(true);
// Open 90 degrees.
TriggerAccelerometerUpdate(base, gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
@@ -575,6 +575,7 @@ TEST_F(MaximizeModeControllerTest, BlockRotationNotifications) {
// adjusting the screen rotation directly when in maximize mode
ASSERT_NE(gfx::Display::ROTATE_270, GetInternalDisplayRotation());
SetInternalDisplayRotation(gfx::Display::ROTATE_270);
+ maximize_mode_controller()->SetRotationLocked(false);
EXPECT_EQ(gfx::Display::ROTATE_270, GetInternalDisplayRotation());
EXPECT_EQ(1u, message_center->NotificationCount());
EXPECT_TRUE(message_center->HasPopupNotifications());
@@ -619,4 +620,16 @@ TEST_F(MaximizeModeControllerTest, ResetUserRotationUponExit) {
EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation());
}
+// Tests that if a user sets a display rotation that accelerometer rotation
+// becomes locked.
+TEST_F(MaximizeModeControllerTest,
+ NonAccelerometerRotationChangesLockRotation) {
+ // Trigger maximize mode by opening to 270.
+ TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, -1.0f),
+ gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
+ ASSERT_FALSE(maximize_mode_controller()->rotation_locked());
+ SetInternalDisplayRotation(gfx::Display::ROTATE_270);
+ EXPECT_TRUE(maximize_mode_controller()->rotation_locked());
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698