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

Unified Diff: base/test/android/javatests/src/org/chromium/base/test/BaseChromiumAndroidJUnitRunner.java

Issue 2991833003: Revert of List Java Instru Test Information From JUnit Runner (Closed)
Patch Set: Created 3 years, 5 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: base/test/android/javatests/src/org/chromium/base/test/BaseChromiumAndroidJUnitRunner.java
diff --git a/base/test/android/javatests/src/org/chromium/base/test/BaseChromiumAndroidJUnitRunner.java b/base/test/android/javatests/src/org/chromium/base/test/BaseChromiumAndroidJUnitRunner.java
index ac5dbfce09699ec56d44b7161daa9e10f2cc6d5f..a48c4ab71301190bef89adf33a2a056832068600 100644
--- a/base/test/android/javatests/src/org/chromium/base/test/BaseChromiumAndroidJUnitRunner.java
+++ b/base/test/android/javatests/src/org/chromium/base/test/BaseChromiumAndroidJUnitRunner.java
@@ -4,34 +4,20 @@
package org.chromium.base.test;
-import android.app.Activity;
import android.app.Application;
-import android.app.Instrumentation;
import android.content.Context;
-import android.os.Bundle;
-import android.support.test.internal.runner.RunnerArgs;
-import android.support.test.internal.runner.TestExecutor;
-import android.support.test.internal.runner.TestRequest;
-import android.support.test.internal.runner.TestRequestBuilder;
import android.support.test.runner.AndroidJUnitRunner;
-import org.chromium.base.Log;
import org.chromium.base.multidex.ChromiumMultiDexInstaller;
/**
- * A custom AndroidJUnitRunner that supports multidex installer and list out test information.
+ * A custom AndroidJUnitRunner that supports multidex installer.
*
* This class is the equivalent of BaseChromiumInstrumentationTestRunner in JUnit3. Please
* beware that is this not a class runner. It is declared in test apk AndroidManifest.xml
* <instrumentation>
*/
public class BaseChromiumAndroidJUnitRunner extends AndroidJUnitRunner {
- private static final String LIST_ALL_TESTS_FLAG =
- "org.chromium.base.test.BaseChromiumAndroidJUnitRunner.TestList";
- private static final String TAG = "BaseJUnitRunner";
-
- private Bundle mArguments;
-
@Override
public Application newApplication(ClassLoader cl, String className, Context context)
throws ClassNotFoundException, IllegalAccessException, InstantiationException {
@@ -40,54 +26,4 @@
BaseChromiumRunnerCommon.reorderDexPathElements(cl, getContext(), getTargetContext());
return super.newApplication(cl, className, context);
}
-
- @Override
- public void onCreate(Bundle arguments) {
- super.onCreate(arguments);
- mArguments = arguments;
- }
-
- /**
- * Add TestListInstrumentationRunListener when argument ask the runner to list tests info.
- *
- * The running mechanism when argument has "listAllTests" is equivalent to that of
- * {@link android.support.test.runner.AndroidJUnitRunner#onStart()} except it adds
- * only TestListInstrumentationRunListener to monitor the tests.
- */
- @Override
- public void onStart() {
- if (mArguments != null && mArguments.getString(LIST_ALL_TESTS_FLAG) != null) {
- Log.w(TAG, "Runner will list out tests info in JSON without running tests");
- listTests(); // Intentionally not calling super.onStart() to avoid additional work.
- } else {
- super.onStart();
- }
- }
-
- private void listTests() {
- Bundle results = new Bundle();
- try {
- TestExecutor.Builder executorBuilder = new TestExecutor.Builder(this);
- executorBuilder.addRunListener(new TestListInstrumentationRunListener(
- mArguments.getString(LIST_ALL_TESTS_FLAG)));
- TestRequest listTestRequest = createListTestRequest(mArguments);
- results = executorBuilder.build().execute(listTestRequest);
- } catch (RuntimeException e) {
- String msg = "Fatal exception when running tests";
- Log.e(TAG, msg, e);
- // report the exception to instrumentation out
- results.putString(Instrumentation.REPORT_KEY_STREAMRESULT,
- msg + "\n" + Log.getStackTraceString(e));
- }
- finish(Activity.RESULT_OK, results);
- }
-
- private TestRequest createListTestRequest(Bundle arguments) {
- RunnerArgs runnerArgs =
- new RunnerArgs.Builder().fromManifest(this).fromBundle(arguments).build();
- TestRequestBuilder builder = new TestRequestBuilder(this, arguments);
- builder.addApkToScan(getContext().getPackageCodePath());
- builder.addFromRunnerArgs(runnerArgs);
- return builder.build();
- }
}
« no previous file with comments | « base/BUILD.gn ('k') | base/test/android/javatests/src/org/chromium/base/test/TestListInstrumentationRunListener.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698