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); |