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

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 per review. 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..d95d3e70e45b4fc6cbf3574f26e2c1282b0f147f 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
@@ -41,18 +41,16 @@ 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();
+ 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 +386,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 +487,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 +499,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 +518,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