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

Unified Diff: content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestCommon.java

Issue 2739603003: Add TestRules for content shell test and refactor test bases (Closed)
Patch Set: limit API access Created 3 years, 9 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: content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestCommon.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/NativeLibraryTestCommon.java
similarity index 60%
copy from content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestBase.java
copy to content/public/test/android/javatests/src/org/chromium/content/browser/test/NativeLibraryTestCommon.java
index 4bfd1cfbc14f074f6d182084a6f8470dd1cf2cd5..72edea942115d3e4797be9760ee81a5ab26c8b1c 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/NativeLibraryTestCommon.java
@@ -1,10 +1,12 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.browser.test;
-import android.test.InstrumentationTestCase;
+import android.app.Instrumentation;
+
+import org.junit.Assert;
import org.chromium.base.PathUtils;
import org.chromium.base.ThreadUtils;
@@ -14,33 +16,16 @@ 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 {
+class NativeLibraryTestCommon {
private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "content";
- /**
- * Loads the native library on the activity UI thread (must not be called from the UI thread).
- */
- public void loadNativeLibraryNoBrowserProcess() {
- handleNativeInitialization(false);
- }
-
- /**
- * 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.
- */
- public void loadNativeLibraryAndInitBrowserProcess() {
- handleNativeInitialization(true);
- }
-
- private void handleNativeInitialization(final boolean initBrowserProcess) {
- assertFalse(ThreadUtils.runningOnUiThread());
+ void handleNativeInitialization(
+ final boolean initBrowserProcess, Instrumentation instrumentation) {
+ Assert.assertFalse(ThreadUtils.runningOnUiThread());
PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
- ApplicationUtils.waitForLibraryDependencies(getInstrumentation());
+ ApplicationUtils.waitForLibraryDependencies(instrumentation);
// LibraryLoader is not in general multithreaded; as other InstrumentationTestCase code
// (specifically, ChromeBrowserProvider) uses it from the main thread we must do
@@ -53,7 +38,7 @@ public class NativeLibraryTestBase extends InstrumentationTestCase {
});
}
- private void nativeInitialization(boolean initBrowserProcess) {
+ void nativeInitialization(boolean initBrowserProcess) {
if (initBrowserProcess) {
try {
BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)

Powered by Google App Engine
This is Rietveld 408576698