Index: ash/content/display/screen_orientation_controller_chromeos_unittest.cc |
diff --git a/ash/content/display/screen_orientation_controller_chromeos_unittest.cc b/ash/content/display/screen_orientation_controller_chromeos_unittest.cc |
index ca02ca3a1b6e0a37b3745fe0401b1679ca6f210c..192777ec2341461da98aa79339896f51148427de 100644 |
--- a/ash/content/display/screen_orientation_controller_chromeos_unittest.cc |
+++ b/ash/content/display/screen_orientation_controller_chromeos_unittest.cc |
@@ -41,18 +41,11 @@ void EnableMaximizeMode(bool enable) { |
->EnableMaximizeModeWindowManager(enable); |
} |
-gfx::Display::Rotation GetInternalDisplayRotation() { |
jonross
2015/04/10 17:54:43
This method is duplicated on 51, was missed in a p
|
- return Shell::GetInstance() |
- ->display_manager() |
- ->GetDisplayInfo(gfx::Display::InternalDisplayId()) |
- .rotation(); |
-} |
- |
gfx::Display::Rotation Rotation() { |
return Shell::GetInstance() |
->display_manager() |
->GetDisplayInfo(gfx::Display::InternalDisplayId()) |
- .rotation(); |
+ .Rotation(gfx::Display::ROTATION_SOURCE_ACTIVE); |
} |
bool RotationLocked() { |
@@ -63,7 +56,8 @@ bool RotationLocked() { |
void SetInternalDisplayRotation(gfx::Display::Rotation rotation) { |
Shell::GetInstance()->display_manager()->SetDisplayRotation( |
- gfx::Display::InternalDisplayId(), rotation); |
+ gfx::Display::InternalDisplayId(), rotation, |
+ gfx::Display::ROTATION_SOURCE_USER); |
} |
void SetRotationLocked(bool rotation_locked) { |
@@ -274,17 +268,17 @@ TEST_F(ScreenOrientationControllerTest, ActiveWindowChangesUpdateOrientation) { |
delegate()->Lock(content1.get(), blink::WebScreenOrientationLockLandscape); |
delegate()->Lock(content2.get(), blink::WebScreenOrientationLockPortrait); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
aura::client::ActivationClient* activation_client = |
Shell::GetInstance()->activation_client(); |
activation_client->ActivateWindow(focus_window2.get()); |
EXPECT_TRUE(RotationLocked()); |
- EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_90, Rotation()); |
activation_client->ActivateWindow(focus_window1.get()); |
EXPECT_TRUE(RotationLocked()); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
} |
// Tests that a rotation lock is removed when the setting window is hidden, and |
@@ -334,13 +328,13 @@ TEST_F(ScreenOrientationControllerTest, DisplayRotation) { |
EnableMaximizeMode(true); |
// Now test rotating in all directions. |
TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_90, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_180, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(kMeanGravity, 0.0f, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_270, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
} |
// Tests that low angles are ignored by the accelerometer (i.e. when the device |
@@ -348,15 +342,15 @@ TEST_F(ScreenOrientationControllerTest, DisplayRotation) { |
TEST_F(ScreenOrientationControllerTest, RotationIgnoresLowAngles) { |
EnableMaximizeMode(true); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, -kMeanGravity, -kMeanGravity)); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(-2.0f, 0.0f, -kMeanGravity)); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, 2.0f, -kMeanGravity)); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(2.0f, 0.0f, -kMeanGravity)); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, -2.0f, -kMeanGravity)); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
} |
// Tests that the display will stick to the current orientation beyond the |
@@ -365,7 +359,7 @@ TEST_F(ScreenOrientationControllerTest, RotationSticky) { |
EnableMaximizeMode(true); |
gfx::Vector3dF gravity(0.0f, -kMeanGravity, 0.0f); |
TriggerLidUpdate(gravity); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
// Turn past half-way point to next direction and rotation should remain |
// the same. |
@@ -373,14 +367,14 @@ TEST_F(ScreenOrientationControllerTest, RotationSticky) { |
gravity.set_x(-sin(degrees * kDegreesToRadians) * kMeanGravity); |
gravity.set_y(-cos(degrees * kDegreesToRadians) * kMeanGravity); |
TriggerLidUpdate(gravity); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
// Turn more and the screen should rotate. |
degrees = 70.0; |
gravity.set_x(-sin(degrees * kDegreesToRadians) * kMeanGravity); |
gravity.set_y(-cos(degrees * kDegreesToRadians) * kMeanGravity); |
TriggerLidUpdate(gravity); |
- EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_90, Rotation()); |
// Turn back just beyond the half-way point and the new rotation should |
// still be in effect. |
@@ -388,7 +382,7 @@ TEST_F(ScreenOrientationControllerTest, RotationSticky) { |
gravity.set_x(-sin(degrees * kDegreesToRadians) * kMeanGravity); |
gravity.set_y(-cos(degrees * kDegreesToRadians) * kMeanGravity); |
TriggerLidUpdate(gravity); |
- EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_90, Rotation()); |
} |
// Tests that the display will stick to its current orientation when the |
@@ -403,11 +397,11 @@ TEST_F(ScreenOrientationControllerTest, RotationLockPreventsRotation) { |
-cos(degrees * kDegreesToRadians) * kMeanGravity, |
0.0f); |
TriggerLidUpdate(gravity); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
SetRotationLocked(false); |
TriggerLidUpdate(gravity); |
- EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_90, Rotation()); |
} |
// The TrayDisplay class that is responsible for adding/updating MessageCenter |
@@ -429,10 +423,10 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) { |
// Make sure notifications are still displayed when |
// adjusting the screen rotation directly when in maximize mode |
- ASSERT_NE(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); |
+ ASSERT_NE(gfx::Display::ROTATE_270, Rotation()); |
SetInternalDisplayRotation(gfx::Display::ROTATE_270); |
SetRotationLocked(false); |
- EXPECT_EQ(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_270, Rotation()); |
EXPECT_EQ(1u, message_center->NotificationCount()); |
EXPECT_TRUE(message_center->HasPopupNotifications()); |
@@ -444,9 +438,9 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) { |
// Make sure notifications are blocked when adjusting the screen rotation |
// via the accelerometer while in maximize mode |
// Rotate the screen 90 degrees |
- ASSERT_NE(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ ASSERT_NE(gfx::Display::ROTATE_90, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); |
- ASSERT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ ASSERT_EQ(gfx::Display::ROTATE_90, Rotation()); |
EXPECT_EQ(0u, message_center->NotificationCount()); |
EXPECT_FALSE(message_center->HasPopupNotifications()); |
@@ -457,11 +451,11 @@ TEST_F(ScreenOrientationControllerTest, BlockRotationNotifications) { |
SetInternalDisplayRotation(gfx::Display::ROTATE_0); |
// Clear all notifications |
message_center->RemoveAllNotifications(false); |
- ASSERT_NE(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); |
+ ASSERT_NE(gfx::Display::ROTATE_180, Rotation()); |
ASSERT_EQ(0u, message_center->NotificationCount()); |
ASSERT_FALSE(message_center->HasPopupNotifications()); |
SetInternalDisplayRotation(gfx::Display::ROTATE_180); |
- EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_180, Rotation()); |
EXPECT_EQ(1u, message_center->NotificationCount()); |
EXPECT_TRUE(message_center->HasPopupNotifications()); |
} |
@@ -473,10 +467,10 @@ TEST_F(ScreenOrientationControllerTest, ResetUserRotationUponExit) { |
EnableMaximizeMode(true); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_180, Rotation()); |
EnableMaximizeMode(false); |
- EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_90, Rotation()); |
} |
// Tests that if a user sets a display rotation that accelerometer rotation |
@@ -499,7 +493,7 @@ TEST_F(ScreenOrientationControllerTest, UpdateUserRotationWhileRotationLocked) { |
// maximize mode was activated. |
SetInternalDisplayRotation(gfx::Display::ROTATE_0); |
EnableMaximizeMode(false); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
} |
// Tests that when the orientation lock is set to Landscape, that rotation can |
@@ -516,13 +510,13 @@ TEST_F(ScreenOrientationControllerTest, LandscapeOrientationAllowsRotation) { |
// Inverse of orientation is allowed |
TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_180, Rotation()); |
// Display rotations between are not allowed |
TriggerLidUpdate(gfx::Vector3dF(kMeanGravity, 0.0f, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_180, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(-kMeanGravity, 0.0f, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_180, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_180, Rotation()); |
} |
// Tests that when the orientation lock is set to Portrait, that rotaiton can be |
@@ -539,13 +533,13 @@ TEST_F(ScreenOrientationControllerTest, PortraitOrientationAllowsRotation) { |
// Inverse of orientation is allowed |
TriggerLidUpdate(gfx::Vector3dF(kMeanGravity, 0.0f, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_270, Rotation()); |
// Display rotations between are not allowed |
TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_270, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_270, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_270, Rotation()); |
} |
// Tests that for an orientation lock which does not allow rotation, that the |
@@ -563,11 +557,11 @@ TEST_F(ScreenOrientationControllerTest, OrientationLockDisallowsRotation) { |
// Rotation does not change. |
TriggerLidUpdate(gfx::Vector3dF(kMeanGravity, 0.0f, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_90, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_90, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, -kMeanGravity, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_90, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_90, Rotation()); |
} |
// Tests that after a content::WebContents has applied an orientation lock which |
@@ -586,7 +580,7 @@ TEST_F(ScreenOrientationControllerTest, UserRotationLockDisallowsRotation) { |
EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
TriggerLidUpdate(gfx::Vector3dF(0.0f, kMeanGravity, 0.0f)); |
- EXPECT_EQ(gfx::Display::ROTATE_0, GetInternalDisplayRotation()); |
+ EXPECT_EQ(gfx::Display::ROTATE_0, Rotation()); |
} |
} // namespace ash |