From 5a1ded7c90895dd1f2908f320b7122e7f6ba98da Mon Sep 17 00:00:00 2001
From: Natalie Weizenbaum <nweiz@google.com>
Date: Wed, 22 Apr 2015 12:34:49 -0700
Subject: [PATCH] Move browser tests that require installation into their own
 files.

Now, no test suite other than phantomjs_test.dart and
dartium_test.dart assume that phantomjs or dartium (respectively) are
installed. content_shell is still assumed to be installed, since it's
very useful for non-compilation-specific tests. More of those tests
have been moved to use content shell rather than chrome.

R=kevmoo@google.com

Review URL: https://codereview.chromium.org//1088453004
---
 .status                                       |   1 -
 test/frontend/expect_async_test.dart          |  30 ++---
 test/frontend/matcher/completion_test.dart    |  14 +--
 test/frontend/matcher/prints_test.dart        |  14 +--
 test/frontend/matcher/throws_test.dart        |  16 +--
 test/frontend/matcher/throws_type_test.dart   |  22 ++--
 .../runner/browser/compact_reporter_test.dart |   4 +-
 test/runner/browser/dartium_test.dart         |  43 +++++++
 test/runner/browser/firefox_test.dart         |  52 +++++++++
 test/runner/browser/phantom_js_test.dart      |  42 +++++++
 test/runner/browser/runner_test.dart          | 106 +++++-------------
 test/runner/signal_test.dart                  |   2 +-
 test/runner/test_on_test.dart                 |  46 ++++----
 test/utils.dart                               |   2 +-
 14 files changed, 242 insertions(+), 152 deletions(-)

diff --git a/.status b/.status
index c5d34c34..e4e15514 100644
--- a/.status
+++ b/.status
@@ -25,7 +25,6 @@ lib/*/*/*/*: SkipByDesign
 
 # PhantomJS isn't supported on the bots (issue 23195).
 test/runner/browser/phantom_js: Skip
-test/runner/browser/runner_test: Skip
 
 test/runner/browser/loader_test: Pass, Slow
 
diff --git a/test/frontend/expect_async_test.dart b/test/frontend/expect_async_test.dart
index a78fcb10..2f3bc243 100644
--- a/test/frontend/expect_async_test.dart
+++ b/test/frontend/expect_async_test.dart
@@ -11,7 +11,7 @@ void main() {
   group("supports a function with this many arguments:", () {
     test("0", () {
       var callbackRun = false;
-      return runTest(() {
+      return runTestBody(() {
         expectAsync(() {
           callbackRun = true;
         })();
@@ -23,7 +23,7 @@ void main() {
 
     test("1", () {
       var callbackRun = false;
-      return runTest(() {
+      return runTestBody(() {
         expectAsync((arg) {
           expect(arg, equals(1));
           callbackRun = true;
@@ -36,7 +36,7 @@ void main() {
 
     test("2", () {
       var callbackRun = false;
-      return runTest(() {
+      return runTestBody(() {
         expectAsync((arg1, arg2) {
           expect(arg1, equals(1));
           expect(arg2, equals(2));
@@ -50,7 +50,7 @@ void main() {
 
     test("3", () {
       var callbackRun = false;
-      return runTest(() {
+      return runTestBody(() {
         expectAsync((arg1, arg2, arg3) {
           expect(arg1, equals(1));
           expect(arg2, equals(2));
@@ -65,7 +65,7 @@ void main() {
 
     test("4", () {
       var callbackRun = false;
-      return runTest(() {
+      return runTestBody(() {
         expectAsync((arg1, arg2, arg3, arg4) {
           expect(arg1, equals(1));
           expect(arg2, equals(2));
@@ -81,7 +81,7 @@ void main() {
 
     test("5", () {
       var callbackRun = false;
-      return runTest(() {
+      return runTestBody(() {
         expectAsync((arg1, arg2, arg3, arg4, arg5) {
           expect(arg1, equals(1));
           expect(arg2, equals(2));
@@ -98,7 +98,7 @@ void main() {
 
     test("6", () {
       var callbackRun = false;
-      return runTest(() {
+      return runTestBody(() {
         expectAsync((arg1, arg2, arg3, arg4, arg5, arg6) {
           expect(arg1, equals(1));
           expect(arg2, equals(2));
@@ -118,7 +118,7 @@ void main() {
   group("with optional arguments", () {
     test("allows them to be passed", () {
       var callbackRun = false;
-      return runTest(() {
+      return runTestBody(() {
         expectAsync(([arg = 1]) {
           expect(arg, equals(2));
           callbackRun = true;
@@ -131,7 +131,7 @@ void main() {
 
     test("allows them not to be passed", () {
       var callbackRun = false;
-      return runTest(() {
+      return runTestBody(() {
         expectAsync(([arg = 1]) {
           expect(arg, equals(1));
           callbackRun = true;
@@ -156,7 +156,7 @@ void main() {
     });
 
     test("may only be called once", () {
-      return runTest(() {
+      return runTestBody(() {
         var callback = expectAsync(() {});
         callback();
         callback();
@@ -197,7 +197,7 @@ void main() {
     });
 
     test("will throw an error if it's called more than that many times", () {
-      return runTest(() {
+      return runTestBody(() {
         var callback = expectAsync(() {}, count: 3);
         callback();
         callback();
@@ -215,7 +215,7 @@ void main() {
       });
 
       test("will throw an error if it's ever called", () {
-        return runTest(() {
+        return runTestBody(() {
           expectAsync(() {}, count: 0)();
         }).then((liveTest) {
           expectTestFailed(
@@ -239,7 +239,7 @@ void main() {
     });
 
     test("will throw an error if it's called more than that many times", () {
-      return runTest(() {
+      return runTestBody(() {
         var callback = expectAsync(() {}, max: 3);
         callback();
         callback();
@@ -302,7 +302,7 @@ void main() {
 
   group("with errors", () {
     test("reports them to the current test", () {
-      return runTest(() {
+      return runTestBody(() {
         expectAsync(() => throw new TestFailure('oh no'))();
       }).then((liveTest) {
         expectTestFailed(liveTest, 'oh no');
@@ -312,7 +312,7 @@ void main() {
     test("swallows them and returns null", () {
       var returnValue;
       var caughtError = false;
-      return runTest(() {
+      return runTestBody(() {
         try {
           returnValue = expectAsync(() => throw new TestFailure('oh no'))();
         } on TestFailure catch (_) {
diff --git a/test/frontend/matcher/completion_test.dart b/test/frontend/matcher/completion_test.dart
index 5add40eb..c36c473c 100644
--- a/test/frontend/matcher/completion_test.dart
+++ b/test/frontend/matcher/completion_test.dart
@@ -19,7 +19,7 @@ void main() {
     });
 
     test("with an error", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(new Future.error('X'), completes);
       }).then((liveTest) {
         expectTestFailed(liveTest, startsWith(
@@ -28,7 +28,7 @@ void main() {
     });
 
     test("with a failure", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(new Future.error(new TestFailure('oh no')), completes);
       }).then((liveTest) {
         expectTestFailed(liveTest, "oh no");
@@ -36,7 +36,7 @@ void main() {
     });
 
     test("with a non-function", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(10, completes);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -60,7 +60,7 @@ void main() {
     });
 
     test("with an error", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(new Future.error('X'), completion(isNull));
       }).then((liveTest) {
         expectTestFailed(liveTest, startsWith(
@@ -69,7 +69,7 @@ void main() {
     });
 
     test("with a failure", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(new Future.error(new TestFailure('oh no')), completion(isNull));
       }).then((liveTest) {
         expectTestFailed(liveTest, "oh no");
@@ -77,7 +77,7 @@ void main() {
     });
 
     test("with a non-function", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(10, completion(equals(10)));
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -87,7 +87,7 @@ void main() {
     });
 
     test("with an incorrect value", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(new Future.value('a'), completion(equals('b')));
       }).then((liveTest) {
         expectTestFailed(liveTest, startsWith(
diff --git a/test/frontend/matcher/prints_test.dart b/test/frontend/matcher/prints_test.dart
index 26b1710b..6accc5f5 100644
--- a/test/frontend/matcher/prints_test.dart
+++ b/test/frontend/matcher/prints_test.dart
@@ -26,7 +26,7 @@ void main() {
     });
 
     test("describes a failure nicely", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => print("Hello, world!"), prints("Goodbye, world!\n"));
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -44,7 +44,7 @@ void main() {
     });
 
     test("describes a failure with a non-descriptive Matcher nicely", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => print("Hello, world!"), prints(contains("Goodbye")));
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -56,7 +56,7 @@ void main() {
     });
 
     test("describes a failure with no text nicely", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() {}, prints(contains("Goodbye")));
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -67,7 +67,7 @@ void main() {
     });
 
     test("with a non-function", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(10, prints(contains("Goodbye")));
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -96,7 +96,7 @@ void main() {
     });
 
     test("describes a failure nicely", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => new Future(() => print("Hello, world!")),
             prints("Goodbye, world!\n"));
       }).then((liveTest) {
@@ -115,7 +115,7 @@ void main() {
     });
 
     test("describes a failure with a non-descriptive Matcher nicely", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => new Future(() => print("Hello, world!")),
             prints(contains("Goodbye")));
       }).then((liveTest) {
@@ -128,7 +128,7 @@ void main() {
     });
 
     test("describes a failure with no text nicely", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => new Future.value(), prints(contains("Goodbye")));
       }).then((liveTest) {
         expectTestFailed(liveTest, startsWith(
diff --git a/test/frontend/matcher/throws_test.dart b/test/frontend/matcher/throws_test.dart
index 2c724722..0cf353a1 100644
--- a/test/frontend/matcher/throws_test.dart
+++ b/test/frontend/matcher/throws_test.dart
@@ -16,7 +16,7 @@ void main() {
       });
 
       test("with a function that doesn't throw", () {
-        return runTest(() {
+        return runTestBody(() {
           expect(() {}, throws);
         }).then((liveTest) {
           expectTestFailed(liveTest,
@@ -27,7 +27,7 @@ void main() {
       });
 
       test("with a non-function", () {
-        return runTest(() {
+        return runTestBody(() {
           expect(10, throws);
         }).then((liveTest) {
           expectTestFailed(liveTest,
@@ -49,7 +49,7 @@ void main() {
       });
 
       test("with a function that doesn't throw", () {
-        return runTest(() {
+        return runTestBody(() {
           expect(() {}, throwsA('oh no'));
         }).then((liveTest) {
           expectTestFailed(liveTest,
@@ -60,7 +60,7 @@ void main() {
       });
 
       test("with a non-function", () {
-        return runTest(() {
+        return runTestBody(() {
           expect(10, throwsA('oh no'));
         }).then((liveTest) {
           expectTestFailed(liveTest,
@@ -71,7 +71,7 @@ void main() {
       });
 
       test("with a function that throws the wrong error", () {
-        return runTest(() {
+        return runTestBody(() {
           expect(() => throw 'aw dang', throwsA('oh no'));
         }).then((liveTest) {
           expectTestFailed(liveTest,
@@ -90,7 +90,7 @@ void main() {
       });
 
       test("with a Future that doesn't throw", () {
-        return runTest(() {
+        return runTestBody(() {
           expect(new Future.value(), throws);
         }).then((liveTest) {
           expectTestFailed(liveTest,
@@ -118,7 +118,7 @@ void main() {
       });
 
       test("with a Future that doesn't throw", () {
-        return runTest(() {
+        return runTestBody(() {
           expect(new Future.value(), throwsA('oh no'));
         }).then((liveTest) {
           expectTestFailed(liveTest,
@@ -127,7 +127,7 @@ void main() {
       });
 
       test("with a Future that throws the wrong error", () {
-        return runTest(() {
+        return runTestBody(() {
           expect(new Future.error('aw dang'), throwsA('oh no'));
         }).then((liveTest) {
           expectTestFailed(liveTest, startsWith(
diff --git a/test/frontend/matcher/throws_type_test.dart b/test/frontend/matcher/throws_type_test.dart
index c298e170..a6b81e2e 100644
--- a/test/frontend/matcher/throws_type_test.dart
+++ b/test/frontend/matcher/throws_type_test.dart
@@ -13,7 +13,7 @@ void main() {
     });
 
     test("fails when a non-ArgumentError is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsArgumentError);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -29,7 +29,7 @@ void main() {
     });
 
     test("fails when a non-ConcurrentModificationError is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsConcurrentModificationError);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -45,7 +45,7 @@ void main() {
     });
 
     test("fails when a non-CyclicInitializationError is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsCyclicInitializationError);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -60,7 +60,7 @@ void main() {
     });
 
     test("fails when a non-Exception is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw 'oh no', throwsException);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -75,7 +75,7 @@ void main() {
     });
 
     test("fails when a non-FormatException is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsFormatException);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -92,7 +92,7 @@ void main() {
     });
 
     test("fails when a non-NoSuchMethodError is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsNoSuchMethodError);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -107,7 +107,7 @@ void main() {
     });
 
     test("fails when a non-NullThrownError is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsNullThrownError);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -122,7 +122,7 @@ void main() {
     });
 
     test("fails when a non-RangeError is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsRangeError);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -137,7 +137,7 @@ void main() {
     });
 
     test("fails when a non-StateError is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsStateError);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -152,7 +152,7 @@ void main() {
     });
 
     test("fails when a non-UnimplementedError is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsUnimplementedError);
       }).then((liveTest) {
         expectTestFailed(liveTest,
@@ -167,7 +167,7 @@ void main() {
     });
 
     test("fails when a non-UnsupportedError is thrown", () {
-      return runTest(() {
+      return runTestBody(() {
         expect(() => throw new Exception(), throwsUnsupportedError);
       }).then((liveTest) {
         expectTestFailed(liveTest,
diff --git a/test/runner/browser/compact_reporter_test.dart b/test/runner/browser/compact_reporter_test.dart
index 70877d8f..2f38ff5b 100644
--- a/test/runner/browser/compact_reporter_test.dart
+++ b/test/runner/browser/compact_reporter_test.dart
@@ -36,9 +36,9 @@ void main() {
 """);
 
     var result = _runTest(
-        ["-p", "chrome", "-p", "vm", "-j", "1", "test.dart"]);
+        ["-p", "content-shell", "-p", "vm", "-j", "1", "test.dart"]);
     expect(result.stdout, contains("[VM]"));
-    expect(result.stdout, contains("[Chrome]"));
+    expect(result.stdout, contains("[Dartium Content Shell]"));
     expect(result.exitCode, equals(0));
   });
 }
diff --git a/test/runner/browser/dartium_test.dart b/test/runner/browser/dartium_test.dart
index 77d66e5c..49aedf09 100644
--- a/test/runner/browser/dartium_test.dart
+++ b/test/runner/browser/dartium_test.dart
@@ -5,7 +5,9 @@
 @TestOn("vm")
 
 import 'dart:async';
+import 'dart:io';
 
+import 'package:path/path.dart' as p;
 import 'package:shelf/shelf.dart' as shelf;
 import 'package:shelf/shelf_io.dart' as shelf_io;
 import 'package:shelf_web_socket/shelf_web_socket.dart';
@@ -14,9 +16,20 @@ import 'package:test/src/util/io.dart';
 import 'package:test/src/utils.dart';
 import 'package:test/test.dart';
 
+import '../../io.dart';
 import '../../utils.dart';
 
+String _sandbox;
+
 void main() {
+  setUp(() {
+    _sandbox = createTempDir();
+  });
+
+  tearDown(() {
+    new Directory(_sandbox).deleteSync(recursive: true);
+  });
+
   group("running Dart", () {
     // The Dart to serve in the server.
     var dart;
@@ -139,4 +152,34 @@ webSocket.onOpen.first.then((_) =>
     expect(dartium.onExit, throwsA(isApplicationException(startsWith(
         "Failed to start Dartium: No such file or directory"))));
   });
+
+  test("can run successful tests", () {
+    new File(p.join(_sandbox, "test.dart")).writeAsStringSync("""
+import 'package:test/test.dart';
+
+void main() {
+  test("success", () {});
+}
+""");
+
+    var result = _runTest(["-p", "dartium", "test.dart"]);
+    expect(result.stdout, isNot(contains("Compiling")));
+    expect(result.exitCode, equals(0));
+  });
+
+  test("can run failing tests", () {
+    new File(p.join(_sandbox, "test.dart")).writeAsStringSync("""
+import 'package:test/test.dart';
+
+void main() {
+  test("failure", () => throw new TestFailure("oh no"));
+}
+""");
+
+    var result = _runTest(["-p", "dartium", "test.dart"]);
+    expect(result.exitCode, equals(1));
+  });
 }
+
+ProcessResult _runTest(List<String> args) =>
+    runTest(args, workingDirectory: _sandbox);
diff --git a/test/runner/browser/firefox_test.dart b/test/runner/browser/firefox_test.dart
index 32403ac9..42b694d3 100644
--- a/test/runner/browser/firefox_test.dart
+++ b/test/runner/browser/firefox_test.dart
@@ -5,7 +5,9 @@
 @TestOn("vm")
 
 import 'dart:async';
+import 'dart:io';
 
+import 'package:path/path.dart' as p;
 import 'package:test/test.dart';
 import 'package:test/src/runner/browser/firefox.dart';
 import 'package:test/src/util/io.dart';
@@ -13,9 +15,20 @@ import 'package:shelf/shelf.dart' as shelf;
 import 'package:shelf/shelf_io.dart' as shelf_io;
 import 'package:shelf_web_socket/shelf_web_socket.dart';
 
+import '../../io.dart';
 import '../../utils.dart';
 
+String _sandbox;
+
 void main() {
+  setUp(() {
+    _sandbox = createTempDir();
+  });
+
+  tearDown(() {
+    new Directory(_sandbox).deleteSync(recursive: true);
+  });
+
   group("running JavaScript", () {
     // The JavaScript to serve in the server. We use actual JavaScript here to
     // avoid the pain of compiling to JS in a test
@@ -139,4 +152,43 @@ webSocket.addEventListener("open", function() {
     expect(firefox.onExit, throwsA(isApplicationException(startsWith(
         "Failed to start Firefox: No such file or directory"))));
   });
+
+  group("can run successful tests", () {
+    setUp(() {
+      new File(p.join(_sandbox, "test.dart")).writeAsStringSync("""
+import 'package:test/test.dart';
+
+void main() {
+  test("success", () {});
 }
+""");
+    });
+
+    test("itself", () {
+      var result = _runTest(["-p", "firefox", "test.dart"]);
+      expect(result.exitCode, equals(0));
+    });
+
+    test("alongside another browser", () {
+      var result = _runTest(["-p", "firefox", "-p", "chrome", "test.dart"]);
+      expect("Compiling".allMatches(result.stdout), hasLength(1));
+      expect(result.exitCode, equals(0));
+    });
+  });
+
+  test("can run failing tests", () {
+    new File(p.join(_sandbox, "test.dart")).writeAsStringSync("""
+import 'package:test/test.dart';
+
+void main() {
+  test("failure", () => throw new TestFailure("oh no"));
+}
+""");
+
+    var result = _runTest(["-p", "firefox", "test.dart"]);
+    expect(result.exitCode, equals(1));
+  });
+}
+
+ProcessResult _runTest(List<String> args) =>
+    runTest(args, workingDirectory: _sandbox);
diff --git a/test/runner/browser/phantom_js_test.dart b/test/runner/browser/phantom_js_test.dart
index 0aac5b78..933160e6 100644
--- a/test/runner/browser/phantom_js_test.dart
+++ b/test/runner/browser/phantom_js_test.dart
@@ -5,7 +5,9 @@
 @TestOn("vm")
 
 import 'dart:async';
+import 'dart:io';
 
+import 'package:path/path.dart' as p;
 import 'package:test/test.dart';
 import 'package:test/src/runner/browser/phantom_js.dart';
 import 'package:test/src/util/io.dart';
@@ -13,9 +15,20 @@ import 'package:shelf/shelf.dart' as shelf;
 import 'package:shelf/shelf_io.dart' as shelf_io;
 import 'package:shelf_web_socket/shelf_web_socket.dart';
 
+import '../../io.dart';
 import '../../utils.dart';
 
+String _sandbox;
+
 void main() {
+  setUp(() {
+    _sandbox = createTempDir();
+  });
+
+  tearDown(() {
+    new Directory(_sandbox).deleteSync(recursive: true);
+  });
+
   group("running JavaScript", () {
     // The JavaScript to serve in the server. We use actual JavaScript here to
     // avoid the pain of compiling to JS in a test
@@ -143,4 +156,33 @@ webSocket.addEventListener("open", function() {
     expect(phantomJS.onExit, throwsA(isApplicationException(startsWith(
         "Failed to start PhantomJS: No such file or directory"))));
   });
+
+  test("can run successful tests", () {
+    new File(p.join(_sandbox, "test.dart")).writeAsStringSync("""
+import 'package:test/test.dart';
+
+void main() {
+  test("success", () {});
+}
+""");
+
+    var result = _runTest(["-p", "phantomjs", "test.dart"]);
+    expect(result.exitCode, equals(0));
+  });
+
+  test("can run failing tests", () {
+    new File(p.join(_sandbox, "test.dart")).writeAsStringSync("""
+import 'package:test/test.dart';
+
+void main() {
+  test("failure", () => throw new TestFailure("oh no"));
+}
+""");
+
+    var result = _runTest(["-p", "phantomjs", "test.dart"]);
+    expect(result.exitCode, equals(1));
+  });
 }
+
+ProcessResult _runTest(List<String> args) =>
+    runTest(args, workingDirectory: _sandbox);
diff --git a/test/runner/browser/runner_test.dart b/test/runner/browser/runner_test.dart
index f8691ca1..3316acc6 100644
--- a/test/runner/browser/runner_test.dart
+++ b/test/runner/browser/runner_test.dart
@@ -15,8 +15,6 @@ import '../../io.dart';
 String _sandbox;
 
 final _success = """
-import 'dart:async';
-
 import 'package:test/test.dart';
 
 void main() {
@@ -25,8 +23,6 @@ void main() {
 """;
 
 final _failure = """
-import 'dart:async';
-
 import 'package:test/test.dart';
 
 void main() {
@@ -128,7 +124,7 @@ void main() {
 """);
 
       var relativePath = p.relative(testPath, from: _sandbox);
-      var result = _runTest(["-p", "dartium", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, allOf([
         contains('-1: load error'),
         contains(
@@ -151,7 +147,7 @@ void main() {
 </html>
 """);
 
-      var result = _runTest(["-p", "dartium", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, allOf([
         contains('-1: load error'),
         contains(
@@ -176,7 +172,7 @@ void main() {
 </html>
 """);
 
-      var result = _runTest(["-p", "dartium", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, allOf([
         contains('-1: load error'),
         contains(
@@ -200,7 +196,7 @@ void main() {
 </html>
 """);
 
-      var result = _runTest(["-p", "dartium", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, allOf([
         contains('-1: load error'),
         contains(
@@ -224,7 +220,7 @@ void main() {
 </html>
 """);
 
-      var result = _runTest(["-p", "dartium", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, allOf([
         contains('-1: load error'),
         contains(
@@ -245,31 +241,12 @@ void main() {
       expect(result.exitCode, equals(0));
     });
 
-    test("on PhantomJS", () {
-      new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
-      var result = _runTest(["-p", "phantomjs", "test.dart"]);
-      expect(result.exitCode, equals(0));
-    });
-
-    test("on Firefox", () {
-      new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
-      var result = _runTest(["-p", "firefox", "test.dart"]);
-      expect(result.exitCode, equals(0));
-    });
-
     test("on Safari", () {
       new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
       var result = _runTest(["-p", "safari", "test.dart"]);
       expect(result.exitCode, equals(0));
     }, testOn: "mac-os");
 
-    test("on Dartium", () {
-      new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
-      var result = _runTest(["-p", "dartium", "test.dart"]);
-      expect(result.stdout, isNot(contains("Compiling")));
-      expect(result.exitCode, equals(0));
-    });
-
     test("on content shell", () {
       new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
       var result = _runTest(["-p", "content-shell", "test.dart"]);
@@ -277,13 +254,6 @@ void main() {
       expect(result.exitCode, equals(0));
     });
 
-    test("on multiple browsers", () {
-      new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
-      var result = _runTest(["-p", "firefox", "-p", "chrome", "test.dart"]);
-      expect("Compiling".allMatches(result.stdout), hasLength(1));
-      expect(result.exitCode, equals(0));
-    });
-
     test("on a JS and non-JS browser", () {
       new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
       var result = _runTest(
@@ -292,9 +262,9 @@ void main() {
       expect(result.exitCode, equals(0));
     });
 
-    test("on the browser and the VM", () {
+    test("on a browser and the VM", () {
       new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_success);
-      var result = _runTest(["-p", "chrome", "-p", "vm", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "-p", "vm", "test.dart"]);
       expect(result.exitCode, equals(0));
     });
 
@@ -373,30 +343,12 @@ void main() {
       expect(result.exitCode, equals(1));
     });
 
-    test("on PhantomJS", () {
-      new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure);
-      var result = _runTest(["-p", "phantomjs", "test.dart"]);
-      expect(result.exitCode, equals(1));
-    });
-
-    test("on Firefox", () {
-      new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure);
-      var result = _runTest(["-p", "firefox", "test.dart"]);
-      expect(result.exitCode, equals(1));
-    });
-
     test("on Safari", () {
       new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure);
       var result = _runTest(["-p", "safari", "test.dart"]);
       expect(result.exitCode, equals(1));
     }, testOn: "mac-os");
 
-    test("on Dartium", () {
-      new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure);
-      var result = _runTest(["-p", "dartium", "test.dart"]);
-      expect(result.exitCode, equals(1));
-    });
-
     test("on content-shell", () {
       new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure);
       var result = _runTest(["-p", "content-shell", "test.dart"]);
@@ -416,7 +368,7 @@ void main() {
   });
 }
 """);
-      var result = _runTest(["-p", "chrome", "-p", "vm", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "-p", "vm", "test.dart"]);
       expect(result.exitCode, equals(1));
     });
 
@@ -433,7 +385,7 @@ void main() {
   });
 }
 """);
-      var result = _runTest(["-p", "chrome", "-p", "vm", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "-p", "vm", "test.dart"]);
       expect(result.exitCode, equals(1));
     });
 
@@ -491,7 +443,7 @@ void main() {
 }
 """);
 
-    var result = _runTest(["-p", "chrome", "test.dart"]);
+    var result = _runTest(["-p", "content-shell", "test.dart"]);
     expect(result.stdout, contains("Hello,\nworld!\n"));
     expect(result.exitCode, equals(0));
   });
@@ -509,7 +461,7 @@ void main() {
 }
 ''');
 
-    var result = _runTest(["-p", "chrome", "test.dart"]);
+    var result = _runTest(["-p", "content-shell", "test.dart"]);
     expect(result.stdout, contains("Test timed out after 0 seconds."));
     expect(result.stdout, contains("-1: Some tests failed."));
   });
@@ -522,11 +474,11 @@ import 'dart:async';
 import 'package:test/test.dart';
 
 void main() {
-  test("fail", () => throw 'oh no', onPlatform: {"chrome": new Skip()});
+  test("fail", () => throw 'oh no', onPlatform: {"browser": new Skip()});
 }
 ''');
 
-      var result = _runTest(["-p", "chrome", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, contains("+0 ~1: All tests skipped."));
     });
 
@@ -541,7 +493,7 @@ void main() {
 }
 ''');
 
-      var result = _runTest(["-p", "chrome", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, contains("+1: All tests passed!"));
     });
 
@@ -553,12 +505,12 @@ import 'package:test/test.dart';
 
 void main() {
   test("fail", () => throw 'oh no', onPlatform: {
-    "chrome": new Timeout(new Duration(seconds: 0))
+    "browser": new Timeout(new Duration(seconds: 0))
   });
 }
 ''');
 
-      var result = _runTest(["-p", "chrome", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, contains("Test timed out after 0 seconds."));
       expect(result.stdout, contains("-1: Some tests failed."));
     });
@@ -576,7 +528,7 @@ void main() {
 }
 ''');
 
-      var result = _runTest(["-p", "chrome", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, contains("+1: All tests passed!"));
     });
 
@@ -588,16 +540,16 @@ import 'package:test/test.dart';
 
 void main() {
   test("success", () {}, onPlatform: {
-    "chrome": new Skip("first"),
-    "chrome || windows": new Skip("second"),
-    "chrome || linux": new Skip("third"),
-    "chrome || mac-os": new Skip("fourth"),
-    "chrome || android": new Skip("fifth")
+    "browser": new Skip("first"),
+    "browser || windows": new Skip("second"),
+    "browser || linux": new Skip("third"),
+    "browser || mac-os": new Skip("fourth"),
+    "browser || android": new Skip("fifth")
   });
 }
 ''');
 
-      var result = _runTest(["-p", "chrome", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, contains("Skip: fifth"));
       expect(result.stdout, isNot(anyOf([
         contains("Skip: first"),
@@ -611,7 +563,7 @@ void main() {
   group("with an @OnPlatform annotation", () {
     test("respects matching Skips", () {
       new File(p.join(_sandbox, "test.dart")).writeAsStringSync('''
-@OnPlatform(const {"chrome": const Skip()})
+@OnPlatform(const {"browser": const Skip()})
 
 import 'dart:async';
 
@@ -622,7 +574,7 @@ void main() {
 }
 ''');
 
-      var result = _runTest(["-p", "chrome", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, contains("+0 ~1: All tests skipped."));
     });
 
@@ -639,14 +591,14 @@ void main() {
 }
 ''');
 
-      var result = _runTest(["-p", "chrome", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, contains("+1: All tests passed!"));
     });
 
     test("respects matching Timeouts", () {
       new File(p.join(_sandbox, "test.dart")).writeAsStringSync('''
 @OnPlatform(const {
-  "chrome": const Timeout(const Duration(seconds: 0))
+  "browser": const Timeout(const Duration(seconds: 0))
 })
 
 import 'dart:async';
@@ -658,7 +610,7 @@ void main() {
 }
 ''');
 
-      var result = _runTest(["-p", "chrome", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, contains("Test timed out after 0 seconds."));
       expect(result.stdout, contains("-1: Some tests failed."));
     });
@@ -678,7 +630,7 @@ void main() {
 }
 ''');
 
-      var result = _runTest(["-p", "chrome", "test.dart"]);
+      var result = _runTest(["-p", "content-shell", "test.dart"]);
       expect(result.stdout, contains("+1: All tests passed!"));
     });
   });
diff --git a/test/runner/signal_test.dart b/test/runner/signal_test.dart
index 81fbbb5b..ffb2de5b 100644
--- a/test/runner/signal_test.dart
+++ b/test/runner/signal_test.dart
@@ -147,7 +147,7 @@ void main() {
 }
 """);
 
-      return _startTest(["-p", "chrome", "test.dart"]).then((process) {
+      return _startTest(["-p", "content-shell", "test.dart"]).then((process) {
         return _lines.bind(process.stdout).skip(3).first.then((line) {
           expect(line, equals("running test"));
           process.kill();
diff --git a/test/runner/test_on_test.dart b/test/runner/test_on_test.dart
index 593e678e..1c299af1 100644
--- a/test/runner/test_on_test.dart
+++ b/test/runner/test_on_test.dart
@@ -37,7 +37,7 @@ void main() {
     test("doesn't run a test suite on a non-matching platform", () {
       _writeTestFile("vm_test.dart", suiteTestOn: "vm");
 
-      var result = _runTest(["--platform", "chrome", "vm_test.dart"]);
+      var result = _runTest(["--platform", "content-shell", "vm_test.dart"]);
       expect(result.stdout, contains("No tests ran."));
       expect(result.exitCode, equals(0));
     });
@@ -61,8 +61,8 @@ void main() {
 
     test("only loads matching files when loading as a group", () {
       _writeTestFile("vm_test.dart", suiteTestOn: "vm");
-      _writeTestFile("chrome_test.dart",
-          suiteTestOn: "chrome", loadable: false);
+      _writeTestFile("browser_test.dart",
+          suiteTestOn: "browser", loadable: false);
       _writeTestFile("this_os_test.dart", suiteTestOn: currentOS.name);
       _writeTestFile("other_os_test.dart",
           suiteTestOn: _otherOS, loadable: false);
@@ -82,26 +82,27 @@ void main() {
       expect(result.exitCode, equals(0));
     });
 
-    test("doesn't run a Chrome group on the VM", () {
-      _writeTestFile("chrome_test.dart", groupTestOn: "chrome");
+    test("doesn't run a Browser group on the VM", () {
+      _writeTestFile("browser_test.dart", groupTestOn: "browser");
 
-      var result = _runTest(["chrome_test.dart"]);
+      var result = _runTest(["browser_test.dart"]);
       expect(result.stdout, contains("No tests ran."));
       expect(result.exitCode, equals(0));
     });
 
-    test("runs a Chrome group on Chrome", () {
-      _writeTestFile("chrome_test.dart", groupTestOn: "chrome");
+    test("runs a browser group on a browser", () {
+      _writeTestFile("browser_test.dart", groupTestOn: "browser");
 
-      var result = _runTest(["--platform", "chrome", "chrome_test.dart"]);
+      var result = _runTest(
+          ["--platform", "content-shell", "browser_test.dart"]);
       expect(result.stdout, contains("All tests passed!"));
       expect(result.exitCode, equals(0));
     });
 
-    test("doesn't run a VM group on Chrome", () {
+    test("doesn't run a VM group on a browser", () {
       _writeTestFile("vm_test.dart", groupTestOn: "vm");
 
-      var result = _runTest(["--platform", "chrome", "vm_test.dart"]);
+      var result = _runTest(["--platform", "content-shell", "vm_test.dart"]);
       expect(result.stdout, contains("No tests ran."));
       expect(result.exitCode, equals(0));
     });
@@ -116,26 +117,27 @@ void main() {
       expect(result.exitCode, equals(0));
     });
 
-    test("doesn't run a Chrome test on the VM", () {
-      _writeTestFile("chrome_test.dart", testTestOn: "chrome");
+    test("doesn't run a browser test on the VM", () {
+      _writeTestFile("browser_test.dart", testTestOn: "browser");
 
-      var result = _runTest(["chrome_test.dart"]);
+      var result = _runTest(["browser_test.dart"]);
       expect(result.stdout, contains("No tests ran."));
       expect(result.exitCode, equals(0));
     });
 
-    test("runs a Chrome test on Chrome", () {
-      _writeTestFile("chrome_test.dart", testTestOn: "chrome");
+    test("runs a browser test on a browser", () {
+      _writeTestFile("browser_test.dart", testTestOn: "browser");
 
-      var result = _runTest(["--platform", "chrome", "chrome_test.dart"]);
+      var result = _runTest(
+          ["--platform", "content-shell", "browser_test.dart"]);
       expect(result.stdout, contains("All tests passed!"));
       expect(result.exitCode, equals(0));
     });
 
-    test("doesn't run a VM test on Chrome", () {
+    test("doesn't run a VM test on a browser", () {
       _writeTestFile("vm_test.dart", testTestOn: "vm");
 
-      var result = _runTest(["--platform", "chrome", "vm_test.dart"]);
+      var result = _runTest(["--platform", "content-shell", "vm_test.dart"]);
       expect(result.stdout, contains("No tests ran."));
       expect(result.exitCode, equals(0));
     });
@@ -152,7 +154,7 @@ void main() {
     });
 
     test("doesn't runs the test if the suite doesn't match", () {
-      _writeTestFile("vm_test.dart", suiteTestOn: "chrome",
+      _writeTestFile("vm_test.dart", suiteTestOn: "browser",
           groupTestOn: "!js", testTestOn: "vm");
 
       var result = _runTest(["vm_test.dart"]);
@@ -162,7 +164,7 @@ void main() {
 
     test("doesn't runs the test if the group doesn't match", () {
       _writeTestFile("vm_test.dart", suiteTestOn: "!browser",
-          groupTestOn: "chrome", testTestOn: "vm");
+          groupTestOn: "browser", testTestOn: "vm");
 
       var result = _runTest(["vm_test.dart"]);
       expect(result.stdout, contains("No tests ran."));
@@ -171,7 +173,7 @@ void main() {
 
     test("doesn't runs the test if the test doesn't match", () {
       _writeTestFile("vm_test.dart", suiteTestOn: "!browser",
-          groupTestOn: "!js", testTestOn: "chrome");
+          groupTestOn: "!js", testTestOn: "browser");
 
       var result = _runTest(["vm_test.dart"]);
       expect(result.stdout, contains("No tests ran."));
diff --git a/test/utils.dart b/test/utils.dart
index 166b7ba8..0b2f3a2a 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -227,7 +227,7 @@ LiveTest createTest(body()) {
 /// Runs [body] as a test.
 ///
 /// Once it completes, returns the [LiveTest] used to run it.
-Future<LiveTest> runTest(body()) {
+Future<LiveTest> runTestBody(body()) {
   var liveTest = createTest(body);
   return liveTest.run().then((_) => liveTest);
 }
-- 
GitLab