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

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

Issue 963643002: [Android] Remove TestServerSpawner dependency from ChromeNativeTestInstrumentationTestRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « build/config/android/rules.gni ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/android/java/src/org/chromium/native_test/ChromeNativeTestInstrumentationTestRunner.java
diff --git a/testing/android/java/src/org/chromium/native_test/ChromeNativeTestInstrumentationTestRunner.java b/testing/android/java/src/org/chromium/native_test/ChromeNativeTestInstrumentationTestRunner.java
index cc8926850be9f860012606b0a213aeea84590d3a..4e1a067907597e46d225b78f7256eba118bdd7f2 100644
--- a/testing/android/java/src/org/chromium/native_test/ChromeNativeTestInstrumentationTestRunner.java
+++ b/testing/android/java/src/org/chromium/native_test/ChromeNativeTestInstrumentationTestRunner.java
@@ -12,17 +12,13 @@ import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
-import org.chromium.net.test.TestServerSpawner;
-
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
@@ -36,15 +32,11 @@ public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation {
public static final String EXTRA_ONLY_OUTPUT_FAILURES =
"org.chromium.native_test.ChromeNativeTestInstrumentationTestRunner."
+ "OnlyOutputFailures";
- public static final String EXTRA_ENABLE_TEST_SERVER_SPAWNER =
- "org.chromium.native_test.ChromeNativeTestInstrumentationTestRunner."
- + "EnableTestServerSpawner";
private static final String TAG = "ChromeNativeTestInstrumentationTestRunner";
private static final int ACCEPT_TIMEOUT_MS = 5000;
private static final Pattern RE_TEST_OUTPUT = Pattern.compile("\\[ *([^ ]*) *\\] ?([^ ]+) .*");
- private static final int SERVER_SPAWNER_PORT = 0;
private static interface ResultsBundleGenerator {
public Bundle generate(Map<String, TestResult> rawResults);
@@ -57,10 +49,6 @@ public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation {
private ResultsBundleGenerator mBundleGenerator;
private boolean mOnlyOutputFailures;
- private boolean mEnableTestServerSpawner;
- private TestServerSpawner mTestServerSpawner;
- private Thread mTestServerSpawnerThread;
-
@Override
public void onCreate(Bundle arguments) {
mCommandLineFile = arguments.getString(ChromeNativeTestActivity.EXTRA_COMMAND_LINE_FILE);
@@ -77,55 +65,16 @@ public class ChromeNativeTestInstrumentationTestRunner extends Instrumentation {
mLogBundle = new Bundle();
mBundleGenerator = new RobotiumBundleGenerator();
mOnlyOutputFailures = arguments.containsKey(EXTRA_ONLY_OUTPUT_FAILURES);
- mEnableTestServerSpawner = arguments.containsKey(EXTRA_ENABLE_TEST_SERVER_SPAWNER);
- mTestServerSpawner = null;
- mTestServerSpawnerThread = null;
start();
}
@Override
public void onStart() {
super.onStart();
-
- setUp();
Bundle results = runTests();
- tearDown();
-
finish(Activity.RESULT_OK, results);
}
- private void setUp() {
- if (mEnableTestServerSpawner) {
- Log.i(TAG, "Test server spawner enabled.");
- try {
- mTestServerSpawner = new TestServerSpawner(SERVER_SPAWNER_PORT, ACCEPT_TIMEOUT_MS);
-
- File portFile = new File(
- Environment.getExternalStorageDirectory(), "net-test-server-ports");
- OutputStreamWriter writer =
- new OutputStreamWriter(new FileOutputStream(portFile));
- writer.write(Integer.toString(mTestServerSpawner.getServerPort()) + ":0");
- writer.close();
-
- mTestServerSpawnerThread = new Thread(mTestServerSpawner);
- mTestServerSpawnerThread.start();
- } catch (IOException e) {
- Log.e(TAG, "Error creating TestServerSpawner: " + e.toString());
- }
- }
- }
-
- private void tearDown() {
- if (mTestServerSpawnerThread != null) {
- try {
- mTestServerSpawner.stop();
- mTestServerSpawnerThread.join();
- } catch (InterruptedException e) {
- Log.e(TAG, "Interrupted while shutting down test server spawner: " + e.toString());
- }
- }
- }
-
/** Runs the tests in the ChromeNativeTestActivity and returns a Bundle containing the results.
*/
private Bundle runTests() {
« no previous file with comments | « build/config/android/rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698