| Index: content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java
|
| diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java
|
| index 7a5d4bba156092e5cfc48fe8a78982d903e3b18a..8fe4a5ac68e71047d58d694aa6d9641c4d2b5d74 100644
|
| --- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java
|
| +++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java
|
| @@ -4,8 +4,10 @@
|
|
|
| package org.chromium.content.browser.test;
|
|
|
| +import android.content.Context;
|
| import android.test.InstrumentationTestCase;
|
|
|
| +import org.chromium.base.ContextUtils;
|
| import org.chromium.base.PathUtils;
|
| import org.chromium.base.ThreadUtils;
|
| import org.chromium.base.library_loader.LibraryLoader;
|
| @@ -19,6 +21,14 @@ import org.chromium.content.browser.test.util.ApplicationUtils;
|
| */
|
| public class NativeLibraryTestBase extends InstrumentationTestCase {
|
| private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "content";
|
| + private Context mAppContext;
|
| +
|
| + @Override
|
| + protected void setUp() throws Exception {
|
| + super.setUp();
|
| + mAppContext = getInstrumentation().getTargetContext().getApplicationContext();
|
| + ContextUtils.initApplicationContext(mAppContext);
|
| + }
|
|
|
| /**
|
| * Loads the native library on the activity UI thread (must not be called from the UI thread).
|
| @@ -38,8 +48,7 @@ public class NativeLibraryTestBase extends InstrumentationTestCase {
|
| private void handleNativeInitialization(final boolean initBrowserProcess) {
|
| assertFalse(ThreadUtils.runningOnUiThread());
|
|
|
| - PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX,
|
| - getInstrumentation().getTargetContext());
|
| + PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX, mAppContext);
|
|
|
| try {
|
| ApplicationUtils.waitForLibraryDependencies(getInstrumentation());
|
| @@ -61,15 +70,14 @@ public class NativeLibraryTestBase extends InstrumentationTestCase {
|
| private void nativeInitialization(boolean initBrowserProcess) {
|
| if (initBrowserProcess) {
|
| try {
|
| - BrowserStartupController.get(getInstrumentation().getTargetContext(),
|
| + BrowserStartupController.get(mAppContext,
|
| LibraryProcessType.PROCESS_BROWSER).startBrowserProcessesSync(false);
|
| } catch (ProcessInitException e) {
|
| throw new Error(e);
|
| }
|
| } else {
|
| try {
|
| - LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER)
|
| - .ensureInitialized(getInstrumentation().getTargetContext());
|
| + LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized();
|
| } catch (ProcessInitException e) {
|
| throw new Error(e);
|
| }
|
|
|