AwContentsClientFullScreenVideoTest.java revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
1// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package org.chromium.android_webview.test;
6
7import android.test.suitebuilder.annotation.SmallTest;
8import android.test.TouchUtils;
9import android.view.KeyEvent;
10
11import org.chromium.android_webview.test.util.VideoTestWebServer;
12import org.chromium.base.test.util.DisabledTest;
13import org.chromium.base.test.util.Feature;
14
15/**
16 * Test WebChromeClient::onShow/HideCustomView.
17 */
18public class AwContentsClientFullScreenVideoTest extends AwTestBase {
19
20    /*
21     * @Feature({"AndroidWebView"})
22     * @SmallTest
23     * http://crbug.com/180575
24     */
25    @DisabledTest
26    public void testOnShowAndHideCustomView() throws Throwable {
27        FullScreenVideoTestAwContentsClient contentsClient =
28                new FullScreenVideoTestAwContentsClient(getActivity());
29        AwTestContainerView testContainerView =
30                createAwTestContainerViewOnMainSync(contentsClient);
31        enableJavaScriptOnUiThread(testContainerView.getAwContents());
32        VideoTestWebServer webServer = new VideoTestWebServer(
33                getInstrumentation().getTargetContext());
34        try {
35            loadUrlSync(testContainerView.getAwContents(),
36                    contentsClient.getOnPageFinishedHelper(),
37                    webServer.getFullScreenVideoTestURL());
38            Thread.sleep(5 * 1000);
39            TouchUtils.clickView(AwContentsClientFullScreenVideoTest.this, testContainerView);
40            contentsClient.waitForCustomViewShown();
41            getInstrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
42            contentsClient.waitForCustomViewHidden();
43        }
44        finally {
45            if (webServer != null) webServer.getTestWebServer().shutdown();
46        }
47    }
48}
49