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

Unified Diff: net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.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
« no previous file with comments | « net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.java
diff --git a/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.java b/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.java
index 45fca4b635ef7f71c89f44f1570e8757b96ba6e5..defdd476ae2bf4fd6d3de26628367573a22c1fce 100644
--- a/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.java
+++ b/net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.java
@@ -9,6 +9,7 @@ import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
+import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
@@ -44,7 +45,7 @@ public class EmbeddedTestServerImpl extends IEmbeddedTestServerImpl.Stub {
}
private <V> V runOnHandlerThread(Callable<V> c) {
- FutureTask<V> t = new FutureTask<V>(c);
+ FutureTask<V> t = new FutureTask<>(c);
mHandler.post(t);
try {
return t.get();
@@ -62,9 +63,11 @@ public class EmbeddedTestServerImpl extends IEmbeddedTestServerImpl.Stub {
*/
@Override
public boolean initializeNative() {
+ // This is necessary as EmbeddedTestServerImpl is in a different process than the tests
+ // using it, so it needs to initialize its own application context.
+ ContextUtils.initApplicationContext(mContext.getApplicationContext());
try {
- LibraryLoader libraryLoader = LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER);
- libraryLoader.ensureInitialized(mContext);
+ LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized();
} catch (ProcessInitException e) {
Log.e(TAG, "Failed to load native libraries.", e);
return false;
« no previous file with comments | « net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698