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