Index: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java |
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java |
index fb29ea5ce638283fe7c6f112ab4868e75cd86f05..6d61136cc7db77befcd4ce8c5a9494b519ba06c7 100644 |
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java |
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java |
@@ -10,6 +10,7 @@ import android.view.View; |
import junit.framework.Assert; |
+import org.chromium.android_webview.test.util.JavascriptEventObserver; |
import org.chromium.android_webview.test.util.VideoTestWebServer; |
import org.chromium.base.CommandLine; |
import org.chromium.base.test.util.Feature; |
@@ -35,6 +36,7 @@ public class AwContentsClientFullScreenVideoTest extends AwTestBase { |
createAwTestContainerViewOnMainSync(mContentsClient); |
mContentViewCore = testContainerView.getContentViewCore(); |
enableJavaScriptOnUiThread(testContainerView.getAwContents()); |
+ testContainerView.getAwContents().setFullScreenEnabled(true); |
webServer = new VideoTestWebServer( |
getInstrumentation().getTargetContext()); |
} |
@@ -109,6 +111,25 @@ public class AwContentsClientFullScreenVideoTest extends AwTestBase { |
mContentViewCore, VideoTestWebServer.VIDEO_ID)); |
} |
+ @MediumTest |
+ @Feature({"AndroidWebView"}) |
+ public void testFullscreenNotEnabled() throws Throwable { |
+ testContainerView.getAwContents().setFullScreenEnabled(false); |
+ |
+ final JavascriptEventObserver fullScreenErrorObserver = new JavascriptEventObserver(); |
+ getInstrumentation().runOnMainSync(new Runnable() { |
+ @Override |
+ public void run() { |
+ fullScreenErrorObserver.register(mContentViewCore, "javaFullScreenErrorObserver"); |
+ } |
+ }); |
+ |
+ loadTestPageAndClickFullscreen(); |
+ |
+ Assert.assertTrue(fullScreenErrorObserver.waitForEvent(500)); |
+ Assert.assertFalse(mContentsClient.wasCustonViewShownCalled()); |
+ } |
+ |
private static boolean areHtmlControlsEnabled() { |
return !CommandLine.getInstance().hasSwitch( |
ContentSwitches.DISABLE_OVERLAY_FULLSCREEN_VIDEO_SUBTITLE); |
@@ -122,6 +143,11 @@ public class AwContentsClientFullScreenVideoTest extends AwTestBase { |
} |
private void doOnShowCustomViewTest() throws Exception { |
+ loadTestPageAndClickFullscreen(); |
+ mContentsClient.waitForCustomViewShown(); |
+ } |
+ |
+ private void loadTestPageAndClickFullscreen() throws Exception { |
loadUrlSync(testContainerView.getAwContents(), |
mContentsClient.getOnPageFinishedHelper(), |
webServer.getFullScreenVideoTestURL()); |
@@ -129,6 +155,5 @@ public class AwContentsClientFullScreenVideoTest extends AwTestBase { |
// Click the button in full_screen_video_test.html to enter fullscreen. |
TouchCommon touchCommon = new TouchCommon(this); |
touchCommon.singleClickView(testContainerView); |
- mContentsClient.waitForCustomViewShown(); |
} |
} |