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

Unified Diff: testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java

Issue 1126543009: [Android] Refactor the native test wrappers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gn Created 5 years, 7 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: testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java
diff --git a/testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java b/testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java
index c5a4443e1a4c1c6122638dc793aab6691397f92d..e1f6f14cfa3420ab13364a2bf79d906b88413019 100644
--- a/testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java
+++ b/testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java
@@ -31,6 +31,9 @@ import java.util.regex.Pattern;
* An Instrumentation that runs tests based on NativeTestActivity.
*/
public class NativeTestInstrumentationTestRunner extends Instrumentation {
+ public static final String EXTRA_NATIVE_TEST_ACTIVITY =
+ "org.chromium.native_test.NativeTestInstrumentationTestRunner."
+ + "NativeTestActivity";
// TODO(jbudorick): Remove this extra when b/18981674 is fixed.
public static final String EXTRA_ONLY_OUTPUT_FAILURES =
"org.chromium.native_test.NativeTestInstrumentationTestRunner."
@@ -39,19 +42,25 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
private static final String TAG = Log.makeTag("native_test");
private static final int ACCEPT_TIMEOUT_MS = 5000;
+ private static final String DEFAULT_NATIVE_TEST_ACTIVITY =
+ "org.chromium.native_test.NativeUnitTestActivity";
private static final Pattern RE_TEST_OUTPUT = Pattern.compile("\\[ *([^ ]*) *\\] ?([^ ]+) .*");
+ private ResultsBundleGenerator mBundleGenerator = new RobotiumBundleGenerator();
private String mCommandLineFile;
private String mCommandLineFlags;
- private File mStdoutFile;
- private Bundle mLogBundle;
- private ResultsBundleGenerator mBundleGenerator;
+ private String mNativeTestActivity;
+ private Bundle mLogBundle = new Bundle();
private boolean mOnlyOutputFailures;
+ private File mStdoutFile;
@Override
public void onCreate(Bundle arguments) {
mCommandLineFile = arguments.getString(NativeTestActivity.EXTRA_COMMAND_LINE_FILE);
mCommandLineFlags = arguments.getString(NativeTestActivity.EXTRA_COMMAND_LINE_FLAGS);
+ mNativeTestActivity = arguments.getString(EXTRA_NATIVE_TEST_ACTIVITY);
+ if (mNativeTestActivity == null) mNativeTestActivity = DEFAULT_NATIVE_TEST_ACTIVITY;
+
try {
mStdoutFile = File.createTempFile(
".temp_stdout_", ".txt", Environment.getExternalStorageDirectory());
@@ -61,8 +70,7 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
finish(Activity.RESULT_CANCELED, new Bundle());
return;
}
- mLogBundle = new Bundle();
- mBundleGenerator = new RobotiumBundleGenerator();
+
mOnlyOutputFailures = arguments.containsKey(EXTRA_ONLY_OUTPUT_FAILURES);
start();
}
@@ -100,9 +108,7 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
*/
private Activity startNativeTestActivity() {
Intent i = new Intent(Intent.ACTION_MAIN);
- i.setComponent(new ComponentName(
- "org.chromium.native_test",
- "org.chromium.native_test.NativeTestActivity"));
+ i.setComponent(new ComponentName(getContext().getPackageName(), mNativeTestActivity));
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (mCommandLineFile != null) {
Log.i(TAG, "Passing command line file extra: %s", mCommandLineFile);

Powered by Google App Engine
This is Rietveld 408576698