// 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.SmallTest;
import android.view.KeyEvent;

import org.chromium.android_webview.test.util.VideoTestWebServer;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.test.util.TouchCommon;

/**
 * Test WebChromeClient::onShow/HideCustomView.
 */
public class AwContentsClientFullScreenVideoTest extends AwTestBase {

    @Feature({"AndroidWebView"})
    @SmallTest
    public void testOnShowAndHideCustomView() throws Throwable {
        FullScreenVideoTestAwContentsClient contentsClient =
                new FullScreenVideoTestAwContentsClient(getActivity());
        AwTestContainerView testContainerView =
                createAwTestContainerViewOnMainSync(contentsClient);
        enableJavaScriptOnUiThread(testContainerView.getAwContents());
        VideoTestWebServer webServer = new VideoTestWebServer(
                getInstrumentation().getTargetContext());
        try {
            loadUrlSync(testContainerView.getAwContents(),
                    contentsClient.getOnPageFinishedHelper(),
                    webServer.getFullScreenVideoTestURL());
            Thread.sleep(5 * 1000);
            TouchCommon touchCommon = new TouchCommon(this);
            touchCommon.singleClickView(testContainerView);
            contentsClient.waitForCustomViewShown();
            getInstrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
            contentsClient.waitForCustomViewHidden();
        } finally {
            if (webServer != null) webServer.getTestWebServer().shutdown();
        }
    }
}

@@ -207,63 +207,8 @@
 t;%0A%0A
-import android.test.suitebuilder.annotation.SmallTest;%0A
 impo
@@ -233,16 +233,16 @@
 yEvent;%0A
+
 %0Aimport 
@@ -300,16 +300,65 @@
 Server;%0A
+import org.chromium.base.test.util.DisabledTest;%0A
 import o
@@ -580,16 +580,104 @@
 Base %7B%0A%0A
+    /** Disabled to unblock the waterfall, investigating in http://crbug.com/361514. */%0A
     @Fea
@@ -710,13 +710,16 @@
    @
-Small
+Disabled
 Test

Disable AwContentsClientFullScreenVideoTest blocking the waterfall.