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

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

Issue 2247143004: Remove app context init from LibraryLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better formatting. 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/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 6f8fa1d257c50f88d4f81bdcc6e6b6588a5c6401..8f1837a689a60b717896024f78ea1a83f2b77a64 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
@@ -40,6 +40,7 @@ import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
+import org.chromium.base.ContextUtils;
import org.chromium.base.PathUtils;
import org.chromium.base.ThreadUtils;
import org.chromium.base.library_loader.LibraryLoader;
@@ -115,14 +116,14 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
@Override
protected void setUp() throws Exception {
super.setUp();
+ Context appContext = getInstrumentation().getTargetContext().getApplicationContext();
+ ContextUtils.initApplicationContext(appContext);
Ted C 2016/09/21 18:36:51 I'll apologize in advance if this is a silly quest
Peter Wen 2016/09/28 15:55:16 Application constructor seems early enough to not
mTestServer = EmbeddedTestServer.createAndStartFileServer(
- getInstrumentation().getContext(), Environment.getExternalStorageDirectory());
+ appContext, Environment.getExternalStorageDirectory());
mTestPage = mTestServer.getURL(TEST_PAGE);
mTestPage2 = mTestServer.getURL(TEST_PAGE_2);
- PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX,
- getInstrumentation().getTargetContext().getApplicationContext());
- LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER)
- .ensureInitialized(getInstrumentation().getTargetContext().getApplicationContext());
+ PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, appContext);
+ LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized();
}
@Override
@@ -165,7 +166,7 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
private PendingIntent addMenuEntriesToIntent(Intent intent, int numEntries) {
PendingIntent pi = PendingIntent.getBroadcast(getInstrumentation().getTargetContext(), 0,
new Intent(), 0);
- ArrayList<Bundle> menuItems = new ArrayList<Bundle>();
+ ArrayList<Bundle> menuItems = new ArrayList<>();
for (int i = 0; i < numEntries; i++) {
Bundle bundle = new Bundle();
bundle.putString(CustomTabsIntent.KEY_MENU_ITEM_TITLE, TEST_MENU_TITLE);

Powered by Google App Engine
This is Rietveld 408576698