| Index: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
|
| index 36770050671192f88b1dcfc04349dd1f5ef01372..92d4c3b3d7730a06072781bcbb0f6f2bf1bd6a48 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
|
| @@ -8,6 +8,7 @@
|
| import static org.chromium.chrome.browser.customtabs.CustomTabActivityTestRule.LONG_TIMEOUT_MS;
|
|
|
| import android.app.Activity;
|
| +import android.app.Application;
|
| import android.app.Instrumentation;
|
| import android.app.Instrumentation.ActivityMonitor;
|
| import android.app.Instrumentation.ActivityResult;
|
| @@ -204,13 +205,18 @@
|
| LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized();
|
| mWebServer = TestWebServer.start();
|
|
|
| - CustomTabsConnection connection = CustomTabsConnection.getInstance();
|
| + CustomTabsConnection connection =
|
| + CustomTabsConnection.getInstance((Application) appContext);
|
| connection.setForcePrerender(true);
|
| }
|
|
|
| @After
|
| public void tearDown() throws Exception {
|
| - CustomTabsConnection connection = CustomTabsConnection.getInstance();
|
| + Context appContext = InstrumentationRegistry.getInstrumentation()
|
| + .getTargetContext()
|
| + .getApplicationContext();
|
| + CustomTabsConnection connection =
|
| + CustomTabsConnection.getInstance((Application) appContext);
|
| connection.setForcePrerender(false);
|
|
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @@ -1006,7 +1012,7 @@
|
| final Intent intent = CustomTabsTestUtils.createMinimalCustomTabIntent(context, mTestPage2);
|
| final CustomTabsSessionToken session = warmUpAndLaunchUrlWithSession(intent);
|
| Assert.assertEquals(getActivity().getIntentDataProvider().getSession(), session);
|
| - CustomTabsConnection connection = CustomTabsConnection.getInstance();
|
| + CustomTabsConnection connection = CustomTabsConnection.getInstance((Application) context);
|
| String packageName = context.getPackageName();
|
| final String referrer =
|
| IntentHandler.constructValidReferrerForAuthority(packageName).getUrl();
|
| @@ -2185,7 +2191,8 @@
|
| Context context = InstrumentationRegistry.getInstrumentation()
|
| .getTargetContext()
|
| .getApplicationContext();
|
| - final CustomTabsConnection connection = CustomTabsConnection.getInstance();
|
| + final CustomTabsConnection connection =
|
| + CustomTabsConnection.getInstance((Application) context);
|
| CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting();
|
| connection.newSession(token);
|
|
|
| @@ -2674,7 +2681,8 @@
|
| Context context = InstrumentationRegistry.getInstrumentation()
|
| .getTargetContext()
|
| .getApplicationContext();
|
| - CustomTabsConnection connection = CustomTabsTestUtils.setUpConnection();
|
| + CustomTabsConnection connection =
|
| + CustomTabsTestUtils.setUpConnection((Application) context);
|
| CustomTabsSessionToken token = CustomTabsSessionToken.createDummySessionTokenForTesting();
|
| connection.newSession(token);
|
| Bundle extras = null;
|
| @@ -2696,7 +2704,11 @@
|
| }
|
|
|
| private CustomTabsConnection warmUpAndWait() {
|
| - CustomTabsConnection connection = CustomTabsTestUtils.setUpConnection();
|
| + final Context context = InstrumentationRegistry.getInstrumentation()
|
| + .getTargetContext()
|
| + .getApplicationContext();
|
| + CustomTabsConnection connection =
|
| + CustomTabsTestUtils.setUpConnection((Application) context);
|
| final CallbackHelper startupCallbackHelper = new CallbackHelper();
|
| Assert.assertTrue(connection.warmup(0));
|
| ThreadUtils.runOnUiThread(new Runnable() {
|
|
|