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 c14c9a96c685e2f7eaa44133ab357332420fdf9e..14e4d2bcc0caf095046a180a5fe6fd1bd28bb91d 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; |
@@ -40,18 +41,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(); |
Ted C
2016/09/21 18:36:51
Same question, but I wonder if this differs becaus
Peter Wen
2016/09/28 15:55:16
Both are fine removing.
|
+ 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 |
@@ -386,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); |
} |
@@ -487,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); |
} |
@@ -499,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)); |
@@ -518,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)); |