| 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..5c0cb9308e29a31da58f8206d7dfce6ae4d5f302 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,27 +31,32 @@ import java.util.regex.Pattern;
|
| * An Instrumentation that runs tests based on NativeTestActivity.
|
| */
|
| public class NativeTestInstrumentationTestRunner extends Instrumentation {
|
| - // TODO(jbudorick): Remove this extra when b/18981674 is fixed.
|
| - public static final String EXTRA_ONLY_OUTPUT_FAILURES =
|
| +
|
| + public static final String EXTRA_NATIVE_TEST_ACTIVITY =
|
| "org.chromium.native_test.NativeTestInstrumentationTestRunner."
|
| - + "OnlyOutputFailures";
|
| + + "NativeTestActivity";
|
|
|
| - private static final String TAG = Log.makeTag("native_test");
|
| + private static final String TAG = "cr.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 String mNativeTestActivity;
|
| + private Bundle mLogBundle = new Bundle();
|
| private File mStdoutFile;
|
| - private Bundle mLogBundle;
|
| - private ResultsBundleGenerator mBundleGenerator;
|
| - private boolean mOnlyOutputFailures;
|
|
|
| @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,9 +66,6 @@ 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 +102,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);
|
| @@ -139,26 +139,17 @@ public class NativeTestInstrumentationTestRunner extends Instrumentation {
|
| for (String l = r.readLine(); l != null && !l.equals("<<ScopedMainEntryLogger");
|
| l = r.readLine()) {
|
| Matcher m = RE_TEST_OUTPUT.matcher(l);
|
| - boolean isFailure = false;
|
| if (m.matches()) {
|
| if (m.group(1).equals("RUN")) {
|
| results.put(m.group(2), ResultsBundleGenerator.TestResult.UNKNOWN);
|
| } else if (m.group(1).equals("FAILED")) {
|
| results.put(m.group(2), ResultsBundleGenerator.TestResult.FAILED);
|
| - isFailure = true;
|
| - mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, l + "\n");
|
| - sendStatus(0, mLogBundle);
|
| } else if (m.group(1).equals("OK")) {
|
| results.put(m.group(2), ResultsBundleGenerator.TestResult.PASSED);
|
| }
|
| }
|
| -
|
| - // TODO(jbudorick): mOnlyOutputFailures is a workaround for b/18981674. Remove it
|
| - // once that issue is fixed.
|
| - if (!mOnlyOutputFailures || isFailure) {
|
| - mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, l + "\n");
|
| - sendStatus(0, mLogBundle);
|
| - }
|
| + mLogBundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, l + "\n");
|
| + sendStatus(0, mLogBundle);
|
| Log.i(TAG, l);
|
| }
|
| } catch (FileNotFoundException e) {
|
|
|