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

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

Issue 289583002: Lock rotation when screen is manually rotated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix non chromeOS builds 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 4145281969e4e5b210094f6375d5ccd3ab162902..e9d925d729a7d322a761b1709079e1d4b82c07ef 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -450,7 +450,7 @@ TEST_F(MaximizeModeControllerTest, LaptopTest) {
// Feeds in sample accelerometer data and verifies that there are no
// transitions into touchview / maximize mode while shaking the device around
// with the hinge at less than 180 degrees.
- ASSERT_TRUE(kAccelerometerLaptopModeTestDataLength % 6 == 0);
+ ASSERT_EQ(0u, kAccelerometerLaptopModeTestDataLength % 6);
for (size_t i = 0; i < kAccelerometerLaptopModeTestDataLength / 6; ++i) {
gfx::Vector3dF base(kAccelerometerLaptopModeTestData[i * 6],
kAccelerometerLaptopModeTestData[i * 6 + 1],
@@ -474,7 +474,7 @@ TEST_F(MaximizeModeControllerTest, MaximizeModeTest) {
// Feeds in sample accelerometer data and verifies that there are no
// transitions out of touchview / maximize mode while shaking the device
// around.
- ASSERT_TRUE(kAccelerometerFullyOpenTestDataLength % 6 == 0);
+ ASSERT_EQ(0u, kAccelerometerFullyOpenTestDataLength % 6);
for (size_t i = 0; i < kAccelerometerFullyOpenTestDataLength / 6; ++i) {
gfx::Vector3dF base(kAccelerometerFullyOpenTestData[i * 6],
kAccelerometerFullyOpenTestData[i * 6 + 1],
@@ -521,7 +521,7 @@ TEST_F(MaximizeModeControllerTest, ExitingMaximizeModeClearRotationLock) {
// Trigger maximize mode by opening to 270.
TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, -1.0f),
- gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
+ gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
ASSERT_TRUE(IsMaximizeModeStarted());
maximize_mode_controller()->set_rotation_locked(true);
@@ -596,4 +596,27 @@ TEST_F(MaximizeModeControllerTest, BlockRotationNotifications) {
}
#endif
+// Tests that if a user has set a display rotation that it is restored upon
+// exiting maximize mode.
+TEST_F(MaximizeModeControllerTest, ResetUserRotationUponExit) {
+ DisplayManager* display_manager = Shell::GetInstance()->display_manager();
+ display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
+ gfx::Display::ROTATE_90);
+
+ // Trigger maximize mode
+ TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, -1.0f),
+ gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
+ ASSERT_TRUE(IsMaximizeModeStarted());
+
+ TriggerAccelerometerUpdate(gfx::Vector3dF(1.0f, 0.0f, 0.0f),
+ gfx::Vector3dF(1.0f, 0.0f, 0.0f));
+ EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation());
+
+ // Exit maximize mode
+ TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, 1.0f),
+ gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
+ EXPECT_FALSE(IsMaximizeModeStarted());
+ EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation());
+}
+
} // namespace ash
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.cc ('k') | chrome/browser/chromeos/display/display_preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698