Index: content/browser/screen_orientation/screen_orientation_provider_unittest.cc |
diff --git a/content/browser/screen_orientation/screen_orientation_provider_unittest.cc b/content/browser/screen_orientation/screen_orientation_provider_unittest.cc |
index 2a7a4e5410e9cccaf1af818005f128cde669840d..1b75b9f6c35065590b53cd51dfa35acf98f8b02a 100644 |
--- a/content/browser/screen_orientation/screen_orientation_provider_unittest.cc |
+++ b/content/browser/screen_orientation/screen_orientation_provider_unittest.cc |
@@ -150,8 +150,18 @@ TEST_F(ScreenOrientationProviderTest, DelegateLockOnce) { |
CallLockAndGetResult(blink::WebScreenOrientationLockType:: |
WebScreenOrientationLockLandscapeSecondary, |
&result_1); |
- // Lock request is pending. |
+#if defined(OS_ANDROID) |
+ // On Android the screen orientation is expected to be changed asynchronously, |
+ // the lock request is pending. |
EXPECT_FALSE(result_1.has_value()); |
+#else |
+ // On other platforms the screen orientation is expected to be changed |
+ // synchronously, but FakeScreenOrientationDelegate did not change screen |
+ // orientation actually, so the lock request will be fired immediately. |
+ EXPECT_EQ(ScreenOrientationLockResult:: |
+ SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED, |
+ result_1); |
+#endif |
// Delegate did apply lock once. |
EXPECT_EQ(1, delegate.lock_count()); |
} |
@@ -187,8 +197,14 @@ TEST_F(ScreenOrientationProviderTest, DelegateRequireFullScreenLockOnce) { |
CallLockAndGetResult(blink::WebScreenOrientationLockType:: |
WebScreenOrientationLockLandscapeSecondary, |
&result_2); |
+#if defined(OS_ANDROID) |
// Lock request is pending. |
EXPECT_FALSE(result_2.has_value()); |
+#else |
+ EXPECT_EQ(ScreenOrientationLockResult:: |
+ SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED, |
+ result_2); |
+#endif |
// Delegate did apply lock once. |
EXPECT_EQ(1, delegate.lock_count()); |
} |
@@ -206,8 +222,14 @@ TEST_F(ScreenOrientationProviderTest, DelegateLockThenUnlock) { |
CallLockAndGetResult(blink::WebScreenOrientationLockType:: |
WebScreenOrientationLockLandscapeSecondary, |
&result_1); |
+#if defined(OS_ANDROID) |
// The lock request will be pending. |
EXPECT_FALSE(result_1.has_value()); |
+#else |
+ EXPECT_EQ(ScreenOrientationLockResult:: |
+ SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED, |
+ result_1); |
+#endif |
// Delegate did apply lock once. |
EXPECT_EQ(1, delegate.lock_count()); |
EXPECT_EQ(0, delegate.unlock_count()); |
@@ -234,8 +256,14 @@ TEST_F(ScreenOrientationProviderTest, DelegateLockThenLock) { |
CallLockAndGetResult(blink::WebScreenOrientationLockType:: |
WebScreenOrientationLockLandscapeSecondary, |
&result_1); |
+#if defined(OS_ANDROID) |
// The lock request will be pending. |
EXPECT_FALSE(result_1.has_value()); |
+#else |
+ EXPECT_EQ(ScreenOrientationLockResult:: |
+ SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED, |
+ result_1); |
+#endif |
// Delegate did apply lock once. |
EXPECT_EQ(1, delegate.lock_count()); |
EXPECT_EQ(0, delegate.unlock_count()); |
@@ -248,8 +276,14 @@ TEST_F(ScreenOrientationProviderTest, DelegateLockThenLock) { |
EXPECT_EQ(ScreenOrientationLockResult:: |
SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED, |
result_1); |
+#if defined(OS_ANDROID) |
// The second one became pending. |
EXPECT_FALSE(result_2.has_value()); |
+#else |
+ EXPECT_EQ(ScreenOrientationLockResult:: |
+ SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED, |
+ result_2); |
+#endif |
// Delegate did apply lock once more. |
EXPECT_EQ(2, delegate.lock_count()); |
EXPECT_EQ(0, delegate.unlock_count()); |
@@ -290,8 +324,14 @@ TEST_F(ScreenOrientationProviderTest, UnlockWhenExitingFullScreen) { |
CallLockAndGetResult(blink::WebScreenOrientationLockType:: |
WebScreenOrientationLockLandscapeSecondary, |
&result); |
+#if defined(OS_ANDROID) |
// The lock request will be pending. |
EXPECT_FALSE(result.has_value()); |
+#else |
+ EXPECT_EQ(ScreenOrientationLockResult:: |
+ SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED, |
+ result); |
+#endif |
// Delegate did apply lock once. |
EXPECT_EQ(1, delegate.lock_count()); |
EXPECT_EQ(0, delegate.unlock_count()); |
@@ -323,8 +363,14 @@ TEST_F(ScreenOrientationProviderTest, UnlockWhenNavigation) { |
CallLockAndGetResult(blink::WebScreenOrientationLockType:: |
WebScreenOrientationLockLandscapeSecondary, |
&result); |
+#if defined(OS_ANDROID) |
// The lock request will be pending. |
EXPECT_FALSE(result.has_value()); |
+#else |
+ EXPECT_EQ(ScreenOrientationLockResult:: |
+ SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED, |
+ result); |
+#endif |
// Delegate did apply lock once. |
EXPECT_EQ(1, delegate.lock_count()); |
EXPECT_EQ(0, delegate.unlock_count()); |