Commit 8371148a authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

Disable unmuted video autoplay for webapps

This CL disables unmuted video autoplay for webapps. This was
unintentionally enabled in
https://chromium-review.googlesource.com/c/chromium/src/+/1621415

This CL also introduces utility class -
CustomTabActivityTypeTestUtils.java - for running a test against
several activity types and makes CustomTabDeferredStartupTest.java use
it.

BUG=1059579
TEST=CustomTabAutoplayUnmutedTest.*

Change-Id: I5a0446d896f3f9f8337a1e4b4febe4460ab87ed1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2093932
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748439}
parent 8ddad104
...@@ -110,6 +110,8 @@ chrome_test_java_sources = [ ...@@ -110,6 +110,8 @@ chrome_test_java_sources = [
"javatests/src/org/chromium/chrome/browser/customtabs/ClientManagerTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/ClientManagerTest.java",
"javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityIncognitoTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityIncognitoTest.java",
"javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java",
"javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTypeTestUtils.java",
"javatests/src/org/chromium/chrome/browser/customtabs/CustomTabAutoplayUnmutedTest.java",
"javatests/src/org/chromium/chrome/browser/customtabs/CustomTabDeferredStartupTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabDeferredStartupTest.java",
"javatests/src/org/chromium/chrome/browser/customtabs/CustomTabExternalNavigationTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabExternalNavigationTest.java",
"javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabFromChromeExternalNavigationTest.java",
......
...@@ -197,7 +197,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -197,7 +197,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
private static final String TAG = "CustomTabWebContentsDelegate"; private static final String TAG = "CustomTabWebContentsDelegate";
private final ChromeActivity mActivity; private final ChromeActivity mActivity;
private final @ActivityType int mActivityType; private final @ActivityType int mActivityType;
private final @Nullable String mWebappScopeUrl; private final @Nullable String mWebApkScopeUrl;
private final @WebDisplayMode int mDisplayMode; private final @WebDisplayMode int mDisplayMode;
private final MultiWindowUtils mMultiWindowUtils; private final MultiWindowUtils mMultiWindowUtils;
private final boolean mShouldEnableEmbeddedMediaExperience; private final boolean mShouldEnableEmbeddedMediaExperience;
...@@ -207,13 +207,13 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -207,13 +207,13 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
* See {@link TabWebContentsDelegateAndroid}. * See {@link TabWebContentsDelegateAndroid}.
*/ */
public CustomTabWebContentsDelegate(Tab tab, ChromeActivity activity, public CustomTabWebContentsDelegate(Tab tab, ChromeActivity activity,
@ActivityType int activityType, @Nullable String webappScopeUrl, @ActivityType int activityType, @Nullable String webApkScopeUrl,
@WebDisplayMode int displayMode, MultiWindowUtils multiWindowUtils, @WebDisplayMode int displayMode, MultiWindowUtils multiWindowUtils,
boolean shouldEnableEmbeddedMediaExperience, @Nullable PendingIntent focusIntent) { boolean shouldEnableEmbeddedMediaExperience, @Nullable PendingIntent focusIntent) {
super(tab, activity); super(tab, activity);
mActivity = activity; mActivity = activity;
mActivityType = activityType; mActivityType = activityType;
mWebappScopeUrl = webappScopeUrl; mWebApkScopeUrl = webApkScopeUrl;
mDisplayMode = displayMode; mDisplayMode = displayMode;
mMultiWindowUtils = multiWindowUtils; mMultiWindowUtils = multiWindowUtils;
mShouldEnableEmbeddedMediaExperience = shouldEnableEmbeddedMediaExperience; mShouldEnableEmbeddedMediaExperience = shouldEnableEmbeddedMediaExperience;
...@@ -332,7 +332,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -332,7 +332,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
@Override @Override
protected String getManifestScope() { protected String getManifestScope() {
return mWebappScopeUrl; return mWebApkScopeUrl;
} }
@Override @Override
...@@ -346,7 +346,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -346,7 +346,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
private final boolean mIsOpenedByChrome; private final boolean mIsOpenedByChrome;
private final @ActivityType int mActivityType; private final @ActivityType int mActivityType;
@Nullable @Nullable
private final String mWebappScopeUrl; private final String mWebApkScopeUrl;
private final @WebDisplayMode int mDisplayMode; private final @WebDisplayMode int mDisplayMode;
private final boolean mShouldEnableEmbeddedMediaExperience; private final boolean mShouldEnableEmbeddedMediaExperience;
private final BrowserControlsVisibilityDelegate mBrowserStateVisibilityDelegate; private final BrowserControlsVisibilityDelegate mBrowserStateVisibilityDelegate;
...@@ -362,8 +362,8 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -362,8 +362,8 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
* @param activity {@link ChromeActivity} instance. * @param activity {@link ChromeActivity} instance.
* @param shouldHideBrowserControls Whether or not the browser controls may auto-hide. * @param shouldHideBrowserControls Whether or not the browser controls may auto-hide.
* @param isOpenedByChrome Whether the CustomTab was originally opened by Chrome. * @param isOpenedByChrome Whether the CustomTab was originally opened by Chrome.
* @param webappScopeUrl The URL of the webapp manifest scope. Null if the delegate is not for a * @param webApkScopeUrl The URL of the WebAPK web manifest scope. Null if the delegate is not
* webapp. * for a WebAPK.
* @param displayMode The activity's display mode. * @param displayMode The activity's display mode.
* @param shouldEnableEmbeddedMediaExperience Whether embedded media experience is enabled. * @param shouldEnableEmbeddedMediaExperience Whether embedded media experience is enabled.
* @param visibilityDelegate The delegate that handles browser control visibility associated * @param visibilityDelegate The delegate that handles browser control visibility associated
...@@ -373,7 +373,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -373,7 +373,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
* @param focusIntent A PendingIntent to launch to focus the client. * @param focusIntent A PendingIntent to launch to focus the client.
*/ */
private CustomTabDelegateFactory(ChromeActivity<?> activity, boolean shouldHideBrowserControls, private CustomTabDelegateFactory(ChromeActivity<?> activity, boolean shouldHideBrowserControls,
boolean isOpenedByChrome, @Nullable String webappScopeUrl, boolean isOpenedByChrome, @Nullable String webApkScopeUrl,
@WebDisplayMode int displayMode, boolean shouldEnableEmbeddedMediaExperience, @WebDisplayMode int displayMode, boolean shouldEnableEmbeddedMediaExperience,
BrowserControlsVisibilityDelegate visibilityDelegate, ExternalAuthUtils authUtils, BrowserControlsVisibilityDelegate visibilityDelegate, ExternalAuthUtils authUtils,
MultiWindowUtils multiWindowUtils, @Nullable PendingIntent focusIntent, MultiWindowUtils multiWindowUtils, @Nullable PendingIntent focusIntent,
...@@ -382,7 +382,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -382,7 +382,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
mShouldHideBrowserControls = shouldHideBrowserControls; mShouldHideBrowserControls = shouldHideBrowserControls;
mIsOpenedByChrome = isOpenedByChrome; mIsOpenedByChrome = isOpenedByChrome;
mActivityType = (activity == null) ? ActivityType.CUSTOM_TAB : activity.getActivityType(); mActivityType = (activity == null) ? ActivityType.CUSTOM_TAB : activity.getActivityType();
mWebappScopeUrl = webappScopeUrl; mWebApkScopeUrl = webApkScopeUrl;
mDisplayMode = displayMode; mDisplayMode = displayMode;
mShouldEnableEmbeddedMediaExperience = shouldEnableEmbeddedMediaExperience; mShouldEnableEmbeddedMediaExperience = shouldEnableEmbeddedMediaExperience;
mBrowserStateVisibilityDelegate = visibilityDelegate; mBrowserStateVisibilityDelegate = visibilityDelegate;
...@@ -399,7 +399,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -399,7 +399,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
ExternalAuthUtils authUtils, MultiWindowUtils multiWindowUtils, ExternalAuthUtils authUtils, MultiWindowUtils multiWindowUtils,
ExternalIntentsPolicyProvider externalIntentsPolicyProvider) { ExternalIntentsPolicyProvider externalIntentsPolicyProvider) {
this(activity, intentDataProvider.shouldEnableUrlBarHiding(), this(activity, intentDataProvider.shouldEnableUrlBarHiding(),
intentDataProvider.isOpenedByChrome(), getWebappScopeUrl(intentDataProvider), intentDataProvider.isOpenedByChrome(), getWebApkScopeUrl(intentDataProvider),
getDisplayMode(intentDataProvider), getDisplayMode(intentDataProvider),
intentDataProvider.shouldEnableEmbeddedMediaExperience(), visibilityDelegate, intentDataProvider.shouldEnableEmbeddedMediaExperience(), visibilityDelegate,
authUtils, multiWindowUtils, intentDataProvider.getFocusIntent(), authUtils, multiWindowUtils, intentDataProvider.getFocusIntent(),
...@@ -442,7 +442,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -442,7 +442,7 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
@Override @Override
public TabWebContentsDelegateAndroid createWebContentsDelegate(Tab tab) { public TabWebContentsDelegateAndroid createWebContentsDelegate(Tab tab) {
mWebContentsDelegateAndroid = new CustomTabWebContentsDelegate(tab, mActivity, mWebContentsDelegateAndroid = new CustomTabWebContentsDelegate(tab, mActivity,
mActivityType, mWebappScopeUrl, mDisplayMode, mMultiWindowUtils, mActivityType, mWebApkScopeUrl, mDisplayMode, mMultiWindowUtils,
mShouldEnableEmbeddedMediaExperience, mFocusIntent); mShouldEnableEmbeddedMediaExperience, mFocusIntent);
return mWebContentsDelegateAndroid; return mWebContentsDelegateAndroid;
} }
...@@ -481,11 +481,13 @@ public class CustomTabDelegateFactory implements TabDelegateFactory { ...@@ -481,11 +481,13 @@ public class CustomTabDelegateFactory implements TabDelegateFactory {
} }
/** /**
* Gets the scope URL if the {@link BrowserServicesIntentDataProvider} is for a webapp. Returns * Gets the scope URL if the {@link BrowserServicesIntentDataProvider} is for a WebAPK. Returns
* null otherwise. * null otherwise.
*/ */
private static @Nullable String getWebappScopeUrl( private static @Nullable String getWebApkScopeUrl(
BrowserServicesIntentDataProvider intentDataProvider) { BrowserServicesIntentDataProvider intentDataProvider) {
if (!intentDataProvider.isWebApkActivity()) return null;
WebappExtras webappExtras = intentDataProvider.getWebappExtras(); WebappExtras webappExtras = intentDataProvider.getWebappExtras();
return (webappExtras != null) ? webappExtras.scopeUrl : null; return (webappExtras != null) ? webappExtras.scopeUrl : null;
} }
......
...@@ -269,8 +269,8 @@ public abstract class TabWebContentsDelegateAndroid extends WebContentsDelegateA ...@@ -269,8 +269,8 @@ public abstract class TabWebContentsDelegateAndroid extends WebContentsDelegateA
} }
/** /**
* @return the Webapp manifest scope, which is used to allow frames within the scope to * @return the WebAPK manifest scope. This gives frames within the scope increased privileges
* autoplay media unmuted. * such as autoplaying media unmuted.
*/ */
@CalledByNative @CalledByNative
protected String getManifestScope() { protected String getManifestScope() {
......
// Copyright 2020 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.chrome.browser.customtabs;
import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import org.chromium.chrome.browser.ShortcutHelper;
import org.chromium.chrome.browser.browserservices.TrustedWebActivityTestUtil;
import org.chromium.chrome.browser.flags.ActivityType;
import org.chromium.chrome.browser.webapps.WebApkActivityTestRule;
import org.chromium.chrome.browser.webapps.WebApkInfo;
import org.chromium.chrome.browser.webapps.WebappActivityTestRule;
import org.chromium.chrome.test.ChromeActivityTestRule;
import org.chromium.chrome.test.util.browser.webapps.WebApkInfoBuilder;
import java.util.concurrent.TimeoutException;
/**
* Helper methods for running a test against multiple activity types.
* Supported activity types: webapp, WebAPK, CCT, and TWA.
*/
public class CustomTabActivityTypeTestUtils {
public static ChromeActivityTestRule createActivityTestRule(@ActivityType int activityType) {
switch (activityType) {
case ActivityType.WEBAPP:
return new WebappActivityTestRule();
case ActivityType.WEB_APK:
return new WebApkActivityTestRule();
default:
return new CustomTabActivityTestRule();
}
}
public static void launchActivity(
@ActivityType int activityType, ChromeActivityTestRule activityTestRule, String url)
throws TimeoutException, UnsupportedOperationException {
switch (activityType) {
case ActivityType.WEBAPP:
launchWebapp((WebappActivityTestRule) activityTestRule, url);
return;
case ActivityType.WEB_APK:
launchWebApk((WebApkActivityTestRule) activityTestRule, url);
return;
case ActivityType.CUSTOM_TAB:
launchCct((CustomTabActivityTestRule) activityTestRule, url);
return;
case ActivityType.TRUSTED_WEB_ACTIVITY:
launchTwa((CustomTabActivityTestRule) activityTestRule, url);
return;
default:
throw new UnsupportedOperationException();
}
}
private static void launchWebapp(WebappActivityTestRule activityTestRule, String url) {
Intent launchIntent = activityTestRule.createIntent();
launchIntent.putExtra(ShortcutHelper.EXTRA_URL, url);
activityTestRule.startWebappActivity(launchIntent);
}
private static void launchWebApk(WebApkActivityTestRule activityTestRule, String url) {
WebApkInfo webApkInfo = new WebApkInfoBuilder("org.chromium.webapk.random", url).build();
activityTestRule.startWebApkActivity(webApkInfo);
}
private static void launchCct(CustomTabActivityTestRule activityTestRule, String url) {
activityTestRule.startCustomTabActivityWithIntent(
CustomTabsTestUtils.createMinimalCustomTabIntent(
InstrumentationRegistry.getTargetContext(), url));
}
private static void launchTwa(CustomTabActivityTestRule activityTestRule, String url)
throws TimeoutException {
String packageName = InstrumentationRegistry.getTargetContext().getPackageName();
Intent intent = TrustedWebActivityTestUtil.createTrustedWebActivityIntent(url);
TrustedWebActivityTestUtil.spoofVerification(packageName, url);
TrustedWebActivityTestUtil.createSession(intent, packageName);
activityTestRule.startCustomTabActivityWithIntent(intent);
}
}
// Copyright 2020 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.chrome.browser.customtabs;
import static org.junit.Assert.assertEquals;
import android.support.test.filters.LargeTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.params.ParameterAnnotations.ClassParameter;
import org.chromium.base.test.params.ParameterAnnotations.UseRunnerDelegate;
import org.chromium.base.test.params.ParameterSet;
import org.chromium.base.test.params.ParameterizedRunner;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.chrome.browser.flags.ActivityType;
import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.test.ChromeActivityTestRule;
import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate;
import org.chromium.content_public.browser.WebContents;
import org.chromium.content_public.browser.test.util.JavaScriptUtils;
import java.util.Arrays;
import java.util.List;
/**
* Tests which activity types enable unmuted autoplay.
*/
@RunWith(ParameterizedRunner.class)
@UseRunnerDelegate(ChromeJUnit4RunnerDelegate.class)
@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE})
public final class CustomTabAutoplayUnmutedTest {
@ClassParameter
public static List<ParameterSet> sClassParams = Arrays.asList(
new ParameterSet().value(ActivityType.WEBAPP).name("Webapp"),
new ParameterSet().value(ActivityType.WEB_APK).name("WebApk"),
new ParameterSet().value(ActivityType.TRUSTED_WEB_ACTIVITY).name("TrustedWebActivity"));
private @ActivityType int mActivityType;
@Rule
public final ChromeActivityTestRule mActivityTestRule;
public CustomTabAutoplayUnmutedTest(@ActivityType int activityType) {
mActivityType = activityType;
mActivityTestRule = CustomTabActivityTypeTestUtils.createActivityTestRule(activityType);
}
/**
* Test that unmuted autoplay is only enabled for WebAPKs.
*/
@Test
@LargeTest
public void testAutoplayUnmuted() throws Exception {
String testPageUrl = mActivityTestRule.getTestServer().getURL(
"/chrome/test/data/android/media/video-autoplay.html");
CustomTabActivityTypeTestUtils.launchActivity(
mActivityType, mActivityTestRule, testPageUrl);
WebContents webContents = mActivityTestRule.getActivity().getActivityTab().getWebContents();
String result = JavaScriptUtils.runJavascriptWithAsyncResult(webContents, "tryPlayback()");
boolean expectUnmutedAutoplay = (mActivityType == ActivityType.WEB_APK);
assertEquals(expectUnmutedAutoplay, result.equals("true"));
}
}
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
package org.chromium.chrome.browser.customtabs; package org.chromium.chrome.browser.customtabs;
import android.app.Activity; import android.app.Activity;
import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.LargeTest; import android.support.test.filters.LargeTest;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
...@@ -25,7 +23,6 @@ import org.chromium.base.test.params.ParameterizedRunner; ...@@ -25,7 +23,6 @@ import org.chromium.base.test.params.ParameterizedRunner;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.chrome.browser.DeferredStartupHandler; import org.chromium.chrome.browser.DeferredStartupHandler;
import org.chromium.chrome.browser.browserservices.TrustedWebActivityTestUtil;
import org.chromium.chrome.browser.customtabs.content.CustomTabActivityTabProvider; import org.chromium.chrome.browser.customtabs.content.CustomTabActivityTabProvider;
import org.chromium.chrome.browser.customtabs.content.TabCreationMode; import org.chromium.chrome.browser.customtabs.content.TabCreationMode;
import org.chromium.chrome.browser.customtabs.dependency_injection.BaseCustomTabActivityComponent; import org.chromium.chrome.browser.customtabs.dependency_injection.BaseCustomTabActivityComponent;
...@@ -38,13 +35,11 @@ import org.chromium.chrome.browser.tab.TabCreationState; ...@@ -38,13 +35,11 @@ import org.chromium.chrome.browser.tab.TabCreationState;
import org.chromium.chrome.browser.tab.TabObserver; import org.chromium.chrome.browser.tab.TabObserver;
import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorBase; import org.chromium.chrome.browser.tabmodel.TabModelSelectorBase;
import org.chromium.chrome.browser.webapps.WebappActivityTestRule;
import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeActivityTestRule;
import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeoutException;
/** /**
* Tests that when DeferredStartupHandler#queueDeferredTasksOnIdleHandler() is run that the * Tests that when DeferredStartupHandler#queueDeferredTasksOnIdleHandler() is run that the
...@@ -148,41 +143,7 @@ public class CustomTabDeferredStartupTest { ...@@ -148,41 +143,7 @@ public class CustomTabDeferredStartupTest {
public CustomTabDeferredStartupTest(@ActivityType int activityType) { public CustomTabDeferredStartupTest(@ActivityType int activityType) {
mActivityType = activityType; mActivityType = activityType;
mActivityTestRule = (activityType == ActivityType.WEBAPP) ? new WebappActivityTestRule() mActivityTestRule = CustomTabActivityTypeTestUtils.createActivityTestRule(activityType);
: new CustomTabActivityTestRule();
}
private void launchActivity() throws TimeoutException {
if (mActivityType == ActivityType.WEBAPP) {
launchWebapp((WebappActivityTestRule) mActivityTestRule);
return;
}
CustomTabActivityTestRule customTabActivityTestRule =
(CustomTabActivityTestRule) mActivityTestRule;
if (mActivityType == ActivityType.CUSTOM_TAB) {
launchCct(customTabActivityTestRule);
return;
}
launchTwa(customTabActivityTestRule);
}
private void launchWebapp(WebappActivityTestRule activityTestRule) {
activityTestRule.startWebappActivity();
}
private void launchCct(CustomTabActivityTestRule activityTestRule) {
activityTestRule.startCustomTabActivityWithIntent(
CustomTabsTestUtils.createMinimalCustomTabIntent(
InstrumentationRegistry.getTargetContext(), "about:blank"));
}
private void launchTwa(CustomTabActivityTestRule activityTestRule) throws TimeoutException {
String packageName = InstrumentationRegistry.getTargetContext().getPackageName();
Intent intent = TrustedWebActivityTestUtil.createTrustedWebActivityIntent("about:blank");
TrustedWebActivityTestUtil.spoofVerification(packageName, "about:blank");
TrustedWebActivityTestUtil.createSession(intent, packageName);
activityTestRule.startCustomTabActivityWithIntent(intent);
} }
@Test @Test
...@@ -196,7 +157,8 @@ public class CustomTabDeferredStartupTest { ...@@ -196,7 +157,8 @@ public class CustomTabDeferredStartupTest {
PageIsLoadedDeferredStartupHandler handler = PageIsLoadedDeferredStartupHandler handler =
new PageIsLoadedDeferredStartupHandler(tabObserver, helper); new PageIsLoadedDeferredStartupHandler(tabObserver, helper);
DeferredStartupHandler.setInstanceForTests(handler); DeferredStartupHandler.setInstanceForTests(handler);
launchActivity(); CustomTabActivityTypeTestUtils.launchActivity(
mActivityType, mActivityTestRule, "about:blank");
helper.waitForCallback(0); helper.waitForCallback(0);
} }
} }
<html>
<head>
<title>Autoplay Test Page</title>
</head>
<body>
<video id=video>
<source src=test.webm type=video/webm />
</video>
<script>
function tryPlayback() {
const video = document.getElementById('video');
video.play().then(() => {
window.domAutomationController.send(true);
}, (e) => {
window.domAutomationController.send(e.name != 'NotAllowedError');
});
}
</script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment