| Index: android_webview/javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.java
|
| diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..42942e846fe46b7ef0cf7102239d7985c2a41f7c
|
| --- /dev/null
|
| +++ b/android_webview/javatests/src/org/chromium/android_webview/test/PlatformMediaCodecTest.java
|
| @@ -0,0 +1,55 @@
|
| +// Copyright 2016 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.MediumTest;
|
| +
|
| +import org.chromium.base.test.util.Feature;
|
| +import org.chromium.content.browser.ContentViewCore;
|
| +import org.chromium.content.browser.test.util.DOMUtils;
|
| +import org.chromium.content_public.browser.WebContents;
|
| +
|
| +import java.util.concurrent.Callable;
|
| +
|
| +/**
|
| + * Test that a page with a non-Chrome media codec can playback correctly; this
|
| + * test is *NOT* exhaustive, but merely spot checks a single instance.
|
| + */
|
| +public class PlatformMediaCodecTest extends AwTestBase {
|
| + private TestAwContentsClient mContentsClient;
|
| + private AwTestContainerView mTestContainerView;
|
| + private ContentViewCore mContentViewCore;
|
| +
|
| + protected void setUp() throws Exception {
|
| + super.setUp();
|
| + mContentsClient = new TestAwContentsClient();
|
| + mTestContainerView = createAwTestContainerViewOnMainSync(mContentsClient);
|
| + mContentViewCore = mTestContainerView.getContentViewCore();
|
| + enableJavaScriptOnUiThread(mTestContainerView.getAwContents());
|
| + }
|
| +
|
| + @MediumTest
|
| + @Feature({"AndroidWebView"})
|
| + public void testCanPlayPlatformMediaCodecs() throws Throwable {
|
| + loadUrlSync(mTestContainerView.getAwContents(), mContentsClient.getOnPageFinishedHelper(),
|
| + "file:///android_asset/platform-media-codec-test.html");
|
| + DOMUtils.clickNode(this, mContentViewCore, "playButton");
|
| + DOMUtils.waitForMediaPlay(getWebContentsOnUiThread(), "videoTag");
|
| + }
|
| +
|
| + private WebContents getWebContentsOnUiThread() {
|
| + try {
|
| + return runTestOnUiThreadAndGetResult(new Callable<WebContents>() {
|
| + @Override
|
| + public WebContents call() throws Exception {
|
| + return mContentViewCore.getWebContents();
|
| + }
|
| + });
|
| + } catch (Exception e) {
|
| + fail(e.getMessage());
|
| + return null;
|
| + }
|
| + }
|
| +}
|
|
|