Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3804)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java

Issue 2247143004: Remove app context init from LibraryLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ChildProcessServiceImpl. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java
index b8d5f2f3686e6a92ffc1d428e5f48b841926d04f..ee03883dc6a565da52ee1c4d9c7a5d7336d18c5b 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionTest.java
@@ -18,6 +18,7 @@ import android.support.customtabs.CustomTabsSessionToken;
import android.test.InstrumentationTestCase;
import android.test.suitebuilder.annotation.SmallTest;
+import org.chromium.base.ContextUtils;
import org.chromium.base.PathUtils;
import org.chromium.base.ThreadUtils;
import org.chromium.base.library_loader.LibraryLoader;
@@ -41,18 +42,17 @@ public class CustomTabsConnectionTest extends InstrumentationTestCase {
private static final String INVALID_SCHEME_URL = "intent://www.google.com";
private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "chrome";
- private Context mContext;
+ private Context mAppContext;
@Override
protected void setUp() throws Exception {
super.setUp();
- mContext = getInstrumentation().getTargetContext().getApplicationContext();
- PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX,
- mContext);
- LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER)
- .ensureInitialized(mContext);
- mCustomTabsConnection = CustomTabsTestUtils.setUpConnection((Application) mContext);
- mCustomTabsConnection.resetThrottling(mContext, Process.myUid());
+ mAppContext = getInstrumentation().getTargetContext().getApplicationContext();
+ ContextUtils.initApplicationContext(mAppContext);
+ PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, mAppContext);
+ LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized();
+ mCustomTabsConnection = CustomTabsTestUtils.setUpConnection((Application) mAppContext);
+ mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid());
}
@Override
@@ -388,9 +388,9 @@ public class CustomTabsConnectionTest extends InstrumentationTestCase {
@SmallTest
public void testMultipleMayLaunchUrl() {
CustomTabsSessionToken token = assertWarmupAndMayLaunchUrl(null, URL, true);
- mCustomTabsConnection.resetThrottling(mContext, Process.myUid());
+ mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid());
assertWarmupAndMayLaunchUrl(token, URL, true);
- mCustomTabsConnection.resetThrottling(mContext, Process.myUid());
+ mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid());
assertWarmupAndMayLaunchUrl(token, URL2, true);
}
@@ -489,9 +489,9 @@ public class CustomTabsConnectionTest extends InstrumentationTestCase {
@SmallTest
public void testThrottlingAcrossSessions() {
CustomTabsSessionToken token = assertWarmupAndMayLaunchUrl(null, URL, true);
- mCustomTabsConnection.resetThrottling(mContext, Process.myUid());
+ mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid());
CustomTabsSessionToken token2 = assertWarmupAndMayLaunchUrl(null, URL, true);
- mCustomTabsConnection.resetThrottling(mContext, Process.myUid());
+ mCustomTabsConnection.resetThrottling(mAppContext, Process.myUid());
for (int i = 0; i < 10; i++) {
mCustomTabsConnection.mayLaunchUrl(token, Uri.parse(URL), null, null);
}
@@ -501,7 +501,7 @@ public class CustomTabsConnectionTest extends InstrumentationTestCase {
@SmallTest
@Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
public void testBanningWorks() {
- mCustomTabsConnection.ban(mContext, Process.myUid());
+ mCustomTabsConnection.ban(mAppContext, Process.myUid());
final CustomTabsSessionToken token =
CustomTabsSessionToken.createDummySessionTokenForTesting();
assertTrue(mCustomTabsConnection.newSession(token));
@@ -520,7 +520,7 @@ public class CustomTabsConnectionTest extends InstrumentationTestCase {
@SmallTest
@Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
public void testBanningDisabledForCellular() {
- mCustomTabsConnection.ban(mContext, Process.myUid());
+ mCustomTabsConnection.ban(mAppContext, Process.myUid());
final CustomTabsSessionToken token =
CustomTabsSessionToken.createDummySessionTokenForTesting();
assertTrue(mCustomTabsConnection.newSession(token));

Powered by Google App Engine
This is Rietveld 408576698