1// Copyright 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.view.KeyEvent;
8
9import org.chromium.android_webview.test.util.VideoTestWebServer;
10import org.chromium.base.test.util.DisabledTest;
11import org.chromium.content.browser.test.util.TouchCommon;
12
13/**
14 * Test WebChromeClient::onShow/HideCustomView.
15 */
16public class AwContentsClientFullScreenVideoTest extends AwTestBase {
17
18    /**
19     * @Feature({"AndroidWebView"})
20     * @SmallTest
21     *
22     * http://crbug.com/238735
23     */
24    @DisabledTest
25    public void testOnShowAndHideCustomView() throws Throwable {
26        FullScreenVideoTestAwContentsClient contentsClient =
27                new FullScreenVideoTestAwContentsClient(getActivity());
28        AwTestContainerView testContainerView =
29                createAwTestContainerViewOnMainSync(contentsClient);
30        enableJavaScriptOnUiThread(testContainerView.getAwContents());
31        VideoTestWebServer webServer = new VideoTestWebServer(
32                getInstrumentation().getTargetContext());
33        try {
34            loadUrlSync(testContainerView.getAwContents(),
35                    contentsClient.getOnPageFinishedHelper(),
36                    webServer.getFullScreenVideoTestURL());
37            Thread.sleep(5 * 1000);
38            TouchCommon touchCommon = new TouchCommon(this);
39            touchCommon.singleClickView(testContainerView);
40            contentsClient.waitForCustomViewShown();
41            getInstrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
42            contentsClient.waitForCustomViewHidden();
43        } finally {
44            if (webServer != null) webServer.getTestWebServer().shutdown();
45        }
46    }
47}
48