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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java

Issue 639923003: [aw] Fullscreen tests for non-media elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fullscreenNonMediaForReview
Patch Set: Add copyright notice to full_screen_video.js Created 6 years, 2 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: 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
deleted file mode 100644
index 48c3a381c28b484437055c4efb67c641eec028b3..0000000000000000000000000000000000000000
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenVideoTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.android_webview.test;
-
-import android.test.suitebuilder.annotation.MediumTest;
-
-import junit.framework.Assert;
-
-import org.chromium.android_webview.test.util.JavascriptEventObserver;
-import org.chromium.android_webview.test.util.VideoTestWebServer;
-import org.chromium.base.test.util.Feature;
-import org.chromium.content.browser.ContentViewCore;
-import org.chromium.content.browser.test.util.DOMUtils;
-import org.chromium.content.browser.test.util.TouchCommon;
-import org.chromium.content_public.browser.WebContents;
-
-/**
- * Test WebChromeClient::onShow/HideCustomView.
- */
-public class AwContentsClientFullScreenVideoTest extends AwTestBase {
- private FullScreenVideoTestAwContentsClient mContentsClient;
- private ContentViewCore mContentViewCore;
- private WebContents mWebContents;
- private VideoTestWebServer mWebServer;
- private AwTestContainerView mTestContainerView;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mContentsClient = new FullScreenVideoTestAwContentsClient(getActivity());
- mTestContainerView =
- createAwTestContainerViewOnMainSync(mContentsClient);
- mContentViewCore = mTestContainerView.getContentViewCore();
- mWebContents = mTestContainerView.getAwContents().getWebContents();
- enableJavaScriptOnUiThread(mTestContainerView.getAwContents());
- mTestContainerView.getAwContents().getSettings().setFullscreenSupported(true);
- mWebServer = new VideoTestWebServer(
- getInstrumentation().getTargetContext());
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- if (mWebServer != null) mWebServer.getTestWebServer().shutdown();
- }
-
- @MediumTest
- @Feature({"AndroidWebView"})
- public void testOnShowAndHideCustomViewWithCallback() throws Throwable {
- doOnShowAndHideCustomViewTest(new Runnable() {
- @Override
- public void run() {
- mContentsClient.getExitCallback().onCustomViewHidden();
- }
- });
- }
-
- @MediumTest
- @Feature({"AndroidWebView"})
- public void testOnShowAndHideCustomViewWithJavascript() throws Throwable {
- doOnShowAndHideCustomViewTest(new Runnable() {
- @Override
- public void run() {
- DOMUtils.exitFullscreen(mWebContents);
- }
- });
- }
-
- @MediumTest
- @Feature({"AndroidWebView"})
- public void testOnShowCustomViewAndPlayWithHtmlControl() throws Throwable {
- doOnShowCustomViewTest();
- Assert.assertFalse(DOMUtils.hasVideoEnded(mWebContents, VideoTestWebServer.VIDEO_ID));
-
- // Click the html play button that is rendered above the video right in the middle
- // of the custom view. Note that we're not able to get the precise location of the
- // control since it is a shadow element, so this test might break if the location
- // ever moves.
- TouchCommon touchCommon = new TouchCommon(
- AwContentsClientFullScreenVideoTest.this);
- touchCommon.singleClickView(mContentsClient.getCustomView());
-
- Assert.assertTrue(DOMUtils.waitForEndOfVideo(mWebContents, VideoTestWebServer.VIDEO_ID));
- }
-
- @MediumTest
- @Feature({"AndroidWebView"})
- public void testFullscreenNotSupported() throws Throwable {
- mTestContainerView.getAwContents().getSettings().setFullscreenSupported(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.wasCustomViewShownCalled());
- }
-
- private void doOnShowAndHideCustomViewTest(final Runnable existFullscreen)
- throws Throwable {
- doOnShowCustomViewTest();
- getInstrumentation().runOnMainSync(existFullscreen);
- mContentsClient.waitForCustomViewHidden();
- }
-
- private void doOnShowCustomViewTest() throws Exception {
- loadTestPageAndClickFullscreen();
- mContentsClient.waitForCustomViewShown();
- }
-
- private void loadTestPageAndClickFullscreen() throws Exception {
- loadUrlSync(mTestContainerView.getAwContents(),
- mContentsClient.getOnPageFinishedHelper(),
- mWebServer.getFullScreenVideoTestURL());
-
- // Click the button in full_screen_video_test.html to enter fullscreen.
- TouchCommon touchCommon = new TouchCommon(this);
- touchCommon.singleClickView(mTestContainerView);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698