EMMA Coverage Report (generated Tue Aug 20 10:07:21 PDT 2013)
[all classes][org.chromium.android_webview.test]

COVERAGE SUMMARY FOR SOURCE FILE [AwContentsClientGetVideoLoadingProgressViewTest.java]

nameclass, %method, %block, %line, %
AwContentsClientGetVideoLoadingProgressViewTest.java0%   (0/2)0%   (0/7)0%   (0/103)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AwContentsClientGetVideoLoadingProgressViewTest0%   (0/1)0%   (0/5)0%   (0/82)0%   (0/20)
AwContentsClientGetVideoLoadingProgressViewTest (): void 0%   (0/1)0%   (0/8)0%   (0/2)
onViewAttachedToWindow (View): void 0%   (0/1)0%   (0/7)0%   (0/3)
onViewDetachedFromWindow (View): void 0%   (0/1)0%   (0/1)0%   (0/1)
testGetVideoLoadingProgressView (): void 0%   (0/1)0%   (0/58)0%   (0/12)
waitForViewAttached (): void 0%   (0/1)0%   (0/8)0%   (0/2)
     
class AwContentsClientGetVideoLoadingProgressViewTest$10%   (0/1)0%   (0/2)0%   (0/21)0%   (0/4)
AwContentsClientGetVideoLoadingProgressViewTest$1 (AwContentsClientGetVideoLo... 0%   (0/1)0%   (0/7)0%   (0/1)
getVideoLoadingProgressView (): View 0%   (0/1)0%   (0/14)0%   (0/3)

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.test.suitebuilder.annotation.SmallTest;
8import android.view.View;
9 
10import org.chromium.android_webview.AwContents;
11import org.chromium.android_webview.test.util.VideoTestWebServer;
12import org.chromium.base.test.util.DisabledTest;
13import org.chromium.base.test.util.Feature;
14import org.chromium.content.browser.test.util.CallbackHelper;
15import org.chromium.content.browser.test.util.TouchCommon;
16 
17import java.util.concurrent.TimeUnit;
18import java.util.concurrent.TimeoutException;
19 
20/**
21 * Test for AwContentClient.GetVideoLoadingProgressView.
22 *
23 * This test takes advantage of onViewAttachedToWindow, and assume our progress view
24 * is shown once it attached to window.
25 *
26 * As it needs user gesture to switch to the full screen mode video, A large button
27 * used to trigger switch occupies almost the whole WebView so the simulated click event
28 * can't miss it.
29 */
30public class AwContentsClientGetVideoLoadingProgressViewTest extends AwTestBase
31        implements View.OnAttachStateChangeListener {
32    private CallbackHelper mViewAttachedCallbackHelper = new CallbackHelper();
33 
34    @Override
35    public void onViewAttachedToWindow(View view) {
36        mViewAttachedCallbackHelper.notifyCalled();
37        view.removeOnAttachStateChangeListener(this);
38    }
39 
40    @Override
41    public void onViewDetachedFromWindow(View arg0) {
42    }
43 
44    private void waitForViewAttached() throws InterruptedException, TimeoutException {
45        mViewAttachedCallbackHelper.waitForCallback(0, 1, 20, TimeUnit.SECONDS);
46    }
47 
48 
49    /**
50     * @Feature({"AndroidWebView"})
51     * @SmallTest
52     *
53     * http://crbug.com/238735
54     */
55    @DisabledTest
56    public void testGetVideoLoadingProgressView() throws Throwable {
57        TestAwContentsClient contentsClient =
58                new FullScreenVideoTestAwContentsClient(getActivity()) {
59            @Override
60            protected View getVideoLoadingProgressView() {
61                View view = new View(getInstrumentation().getTargetContext());
62                view.addOnAttachStateChangeListener(
63                        AwContentsClientGetVideoLoadingProgressViewTest.this);
64                return view;
65            }
66        };
67        final AwTestContainerView testContainerView =
68                createAwTestContainerViewOnMainSync(contentsClient);
69        final AwContents awContents = testContainerView.getAwContents();
70        enableJavaScriptOnUiThread(awContents);
71        VideoTestWebServer webServer = new VideoTestWebServer(
72                getInstrumentation().getTargetContext());
73        try {
74            loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(),
75                    webServer.getFullScreenVideoTestURL());
76            Thread.sleep(5 * 1000);
77            TouchCommon touchCommon = new TouchCommon(this);
78            touchCommon.singleClickView(testContainerView);
79            waitForViewAttached();
80        } finally {
81            if (webServer != null) webServer.getTestWebServer().shutdown();
82        }
83    }
84}

[all classes][org.chromium.android_webview.test]
EMMA 2.0.5312 (C) Vladimir Roubtsov