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

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

Issue 261163004: Lock Rotation when screen is manually rotated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 d619fd5239dd9885cfa172987272bdb5893686e3..3d23d7264a4f57f717f85aad55c6cc8ef9168157 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -148,7 +148,7 @@ TEST_F(MaximizeModeControllerTest, EnterExitThresholds) {
// Tests that when the hinge is nearly vertically aligned, the current state
// persists as the computed angle is highly inaccurate in this orientation.
TEST_F(MaximizeModeControllerTest, HingeAligned) {
- // Laptop in normal orientation lid open 90 degrees.
+ // Laptop in normal orientation lid open 90 degrees.
TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, 1.0f),
gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
EXPECT_FALSE(IsMaximizeModeStarted());
@@ -309,7 +309,7 @@ TEST_F(MaximizeModeControllerTest, BlocksKeyboard) {
EXPECT_EQ(0u, counter.event_count());
counter.reset();
- // Touch should not be blocked.
+ // Touch should not be blocked.
event_generator.PressTouch();
event_generator.ReleaseTouch();
EXPECT_GT(counter.event_count(), 0u);
@@ -331,7 +331,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],
@@ -355,7 +355,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],
@@ -416,4 +416,18 @@ TEST_F(MaximizeModeControllerTest, ExitingMaximizeModeClearRotationLock) {
EXPECT_FALSE(maximize_mode_controller()->rotation_locked());
}
+// Tests that if the display was rotated before entering maximize mode that
+// rotation becomes locked.
+TEST_F(MaximizeModeControllerTest,
+ RotatedDisplayLocksRotationUponEnteringMaximizeMode) {
+ DisplayManager* display_manager = Shell::GetInstance()->display_manager();
+ display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
+ gfx::Display::ROTATE_90);
+ // 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_TRUE(IsMaximizeModeStarted());
+ EXPECT_TRUE(maximize_mode_controller()->rotation_locked());
flackr 2014/05/05 20:53:56 Maybe also expect the rotation not to have been to
jonross 2014/05/06 15:07:54 Done.
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698