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 4bfd1cfbc14f074f6d182084a6f8470dd1cf2cd5..daa3795c35260da6bef4eda07463a5d7feb42a5b 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 |
@@ -6,67 +6,26 @@ package org.chromium.content.browser.test; |
import android.test.InstrumentationTestCase; |
-import org.chromium.base.PathUtils; |
-import org.chromium.base.ThreadUtils; |
-import org.chromium.base.library_loader.LibraryLoader; |
-import org.chromium.base.library_loader.LibraryProcessType; |
-import org.chromium.base.library_loader.ProcessInitException; |
-import org.chromium.content.browser.BrowserStartupController; |
-import org.chromium.content.browser.test.util.ApplicationUtils; |
- |
/** |
* Test extension that adds support for loading and dealing with native libraries. |
*/ |
public class NativeLibraryTestBase extends InstrumentationTestCase { |
- private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "content"; |
+ private final NativeLibraryTestCommon mTestCommon = new NativeLibraryTestCommon(); |
/** |
* Loads the native library on the activity UI thread (must not be called from the UI thread). |
*/ |
+ @SuppressWarnings("deprecation") |
public void loadNativeLibraryNoBrowserProcess() { |
- handleNativeInitialization(false); |
+ mTestCommon.handleNativeInitialization(false, getInstrumentation()); |
} |
/** |
* Loads the native library on the activity UI thread (must not be called from the UI thread). |
* After loading the library, this will initialize the browser process. |
*/ |
+ @SuppressWarnings("deprecation") |
public void loadNativeLibraryAndInitBrowserProcess() { |
- handleNativeInitialization(true); |
- } |
- |
- private void handleNativeInitialization(final boolean initBrowserProcess) { |
- assertFalse(ThreadUtils.runningOnUiThread()); |
- |
- PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX); |
- |
- ApplicationUtils.waitForLibraryDependencies(getInstrumentation()); |
- |
- // LibraryLoader is not in general multithreaded; as other InstrumentationTestCase code |
- // (specifically, ChromeBrowserProvider) uses it from the main thread we must do |
- // likewise. |
- ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
- @Override |
- public void run() { |
- nativeInitialization(initBrowserProcess); |
- } |
- }); |
- } |
- |
- private void nativeInitialization(boolean initBrowserProcess) { |
- if (initBrowserProcess) { |
- try { |
- BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER) |
- .startBrowserProcessesSync(false); |
- } catch (ProcessInitException e) { |
- throw new Error(e); |
- } |
- } else { |
- try { |
- LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(); |
- } catch (ProcessInitException e) { |
- throw new Error(e); |
- } |
- } |
+ mTestCommon.handleNativeInitialization(true, getInstrumentation()); |
} |
} |