From ad35c5c1c47aeb526e62a65d5db5bc285cca0a4f Mon Sep 17 00:00:00 2001 From: Nate Bosch <nbosch1@gmail.com> Date: Tue, 17 Apr 2018 11:26:26 -0700 Subject: [PATCH] Drop dartium support (#812) - Delete dartium and content shell platforms - Delete tests related to dartium - Remove references to these platforms in docs - Stop installing dartium on Travis --- .travis.yml | 23 +- CHANGELOG.md | 2 + CONTRIBUTING.md | 5 - README.md | 53 +--- doc/architecture.md | 5 +- doc/configuration.md | 6 +- lib/dart.js | 12 +- lib/src/backend/runtime.dart | 11 - lib/src/runner/browser/browser_manager.dart | 6 - lib/src/runner/browser/content_shell.dart | 117 -------- lib/src/runner/browser/dartium.dart | 273 ------------------- lib/src/runner/browser/default_settings.dart | 8 - lib/src/runner/debugger.dart | 3 +- lib/src/runner/loader.dart | 2 - lib/src/runner/vm/platform.dart | 1 - test/runner/browser/dartium_test.dart | 83 ------ test/runner/browser/runner_test.dart | 21 -- test/runner/pub_serve_test.dart | 34 --- test/runner/runner_test.dart | 9 +- 19 files changed, 29 insertions(+), 645 deletions(-) delete mode 100644 lib/src/runner/browser/content_shell.dart delete mode 100644 lib/src/runner/browser/dartium.dart delete mode 100644 test/runner/browser/dartium_test.dart diff --git a/.travis.yml b/.travis.yml index 4f101d6d..8d0ebb7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,32 +20,19 @@ addons: - fonts-tlwg-garuda before_install: - # Content shell needs this font. Since it has a EULA, we need to manually - # install it. - # - # TODO: remove this and use "sudo: false" when travis-ci/travis-ci#4714 is - # fixed. - - sudo apt-get update -yq - - sudo sh -c "echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections" - - sudo apt-get install msttcorefonts -qq - - mkdir -p bin - export PATH="$PATH:`pwd`/bin/" - ln -s `which chromium-browser` bin/google-chrome - - wget "http://gsdview.appspot.com/dart-archive/channels/stable/release/latest/dartium/content_shell-linux-x64-release.zip" - - unzip content_shell-linux-x64-release.zip - - ln -s `pwd`/`echo drt-linux-*`/content_shell bin/content_shell - dart_task: - dartfmt - dartanalyzer # Split the tests into five shards to help parallelize them across Travis workers. - - test: --preset travis --total-shards 5 --shard-index 0 -x dartium - - test: --preset travis --total-shards 5 --shard-index 1 -x dartium - - test: --preset travis --total-shards 5 --shard-index 2 -x dartium - - test: --preset travis --total-shards 5 --shard-index 3 -x dartium - - test: --preset travis --total-shards 5 --shard-index 4 -x dartium + - test: --preset travis --total-shards 5 --shard-index 0 + - test: --preset travis --total-shards 5 --shard-index 1 + - test: --preset travis --total-shards 5 --shard-index 2 + - test: --preset travis --total-shards 5 --shard-index 3 + - test: --preset travis --total-shards 5 --shard-index 4 # Only building master means that we don't run two builds for each pull request. branches: diff --git a/CHANGELOG.md b/CHANGELOG.md index 08e89544..5a12f934 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ * Dropped support for Dart 1. Going forward only Dart 2 will be supported. * If you experience blocking issues and are still on the Dart 1 sdk, we will consider bug fixes on a per-case basis based on severity and impact. + * Drop support for `dartium` and `content-shell` platforms since those are + removed from the Dart 2 SDK. * Fixed an issue `--precompiled` node tests in subdirectories. * Fixed some dart2 issues with node test bootstrapping code so that dartdevc tests can run. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b5a1f658..c6120f82 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,13 +38,8 @@ new tests, use the existing tests as a guideline for what they should look like. Before you send your pull request, make sure all the tests pass! To run all the tests, you'll need: -* A recent version of [Dartium][] on your path as `dartium`. -* A recent version of the Dartium content shell on your path as `content_shell`. - See [the README][] for installation instructions. * [PhantomJS][] version 2.0.0 or higher. -[Dartium]: https://webdev.dartlang.org/tools/dartium -[the README]: https://github.com/dart-lang/test/blob/master/README.md#running-tests-on-dartium [PhantomJS]: http://phantomjs.org/ Once you have these, just run `pub run test`. diff --git a/README.md b/README.md index 88e62233..7b7c9ef0 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ * [Running Tests](#running-tests) * [Restricting Tests to Certain Platforms](#restricting-tests-to-certain-platforms) * [Platform Selectors](#platform-selectors) - * [Running Tests on Dartium](#running-tests-on-dartium) * [Running Tests on Node.js](#running-tests-on-nodejs) * [Asynchronous Tests](#asynchronous-tests) * [Stream Matchers](#stream-matchers) @@ -204,11 +203,6 @@ identifiers are defined: * `vm`: Whether the test is running on the command-line Dart VM. -* `dartium`: Whether the test is running on Dartium. - -* `content-shell`: Whether the test is running on the headless Dartium content - shell. - * `chrome`: Whether the test is running on Google Chrome. * `phantomjs`: Whether the test is running on @@ -222,8 +216,8 @@ identifiers are defined: * `node`: Whether the test is running on Node.js. -* `dart-vm`: Whether the test is running on the Dart VM in any context, - including Dartium. It's identical to `!js`. +* `dart-vm`: Whether the test is running on the Dart VM in any context. It's + identical to `!js`. * `browser`: Whether the test is running in any browser. @@ -256,30 +250,6 @@ identifiers are defined: For example, if you wanted to run a test on every browser but Chrome, you would write `@TestOn("browser && !chrome")`. -### Running Tests on Dartium - -Tests can be run on [Dartium][] by passing the `-p dartium` flag. If you're -using Mac OS, you can [install Dartium using Homebrew][homebrew]. Otherwise, -make sure there's an executable called `dartium` (on Mac OS or Linux) or -`dartium.exe` (on Windows) on your system path. - -[Dartium]: https://www.dartlang.org/tools/dartium/ -[homebrew]: https://github.com/dart-lang/homebrew-dart - -Similarly, tests can be run on the headless Dartium content shell by passing `-p -content-shell`. The content shell is installed along with Dartium when using -Homebrew. Otherwise, you can downloaded it manually [from this -page][content_shell]; if you do, make sure the executable named `content_shell` -(on Mac OS or Linux) or `content_shell.exe` (on Windows) is on your system path. -Note content_shell on linux requires the font packages ttf-kochi-mincho and ttf-kochi-gothic. - -[content_shell]: http://gsdview.appspot.com/dart-archive/channels/stable/release/latest/dartium/ - -[In the future][issue 63], there will be a more explicit way to configure the -location of both the Dartium and content shell executables. - -[issue 63]: https://github.com/dart-lang/test/issues/63 - ### Running Tests on Node.js The test runner also supports compiling tests to JavaScript and running them on @@ -708,14 +678,13 @@ passed as command-line arguments: # This package's tests are very slow. Double the default timeout. timeout: 2x -# This is a browser-only package, so test on content shell by default. -platforms: [content-shell] +# This is a browser-only package, so test on chrome by default. +platforms: [chrome] ``` The configuration file sets new defaults. These defaults can still be overridden by command-line arguments, just like the built-in defaults. In the example -above, you could pass `--platform chrome` to run on Chrome instead of the -Dartium content shell. +above, you could pass `--platform firefox` to run on Firefox. A configuration file can do much more than just set global defaults. See [the full documentation][package config] for more details. @@ -724,18 +693,16 @@ A configuration file can do much more than just set global defaults. See ## Debugging -Tests can be debugged interactively using browsers' built-in development tools, -including Observatory when you're using Dartium. Currently there's no support -for interactively debugging command-line VM tests, but it will be added -[in the future][issue 50]. +Tests can be debugged interactively using browsers' built-in development tools. +Currently there's no support for interactively debugging command-line VM tests, +but it will be added [in the future][issue 50]. [issue 50]: https://github.com/dart-lang/test/issues/50 The first step when debugging is to pass the `--pause-after-load` flag to the test runner. This pauses the browser after each test suite has loaded, so that -you have time to open the development tools and set breakpoints. For Dartium, -the test runner will print the Observatory URL for you. For PhantomJS, it will -print the remote debugger URL. For content shell, it'll print both! +you have time to open the development tools and set breakpoints. For PhantomJS, +it will print the remote debugger URL. Once you've set breakpoints, either click the big arrow in the middle of the web page or press Enter in your terminal to start the tests running. When you hit a diff --git a/doc/architecture.md b/doc/architecture.md index d1669ae1..db14e4eb 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -199,9 +199,8 @@ takes more control over the loading process. It emits its own Whereas the [`VMPlatform`][VMPlatform] loads each separate suite in isolation, the `BrowserPlatform` shares a substantial amount of resources between suites. All suites load their code from a single HTTP server, which is managed by the -platform. This server provides access to Dart entrypoint wrappers for Dartium -and content shell, to compiled JavaScript for other browsers, and to HTML files -that bootstrap the tests. +platform. This server provides access to compiled JavaScript for other browsers, +and to HTML files that bootstrap the tests. In addition to sharing a server, when multiple suites are loaded for the same browser, they all share a tab within that browser. Each separate browser is diff --git a/doc/configuration.md b/doc/configuration.md index 7df86ae0..ada871ff 100644 --- a/doc/configuration.md +++ b/doc/configuration.md @@ -12,8 +12,8 @@ example: # This package's tests are very slow. Double the default timeout. timeout: 2x -# This is a browser-only package, so test on content shell by default. -platforms: [content-shell] +# This is a browser-only package, so test on chrome by default. +platforms: [chrome] tags: # Integration tests are even slower, so increase the timeout again. @@ -359,7 +359,7 @@ platforms are included, the test runner will default to running tests on all of them. This defaults to `[vm]`. ```yaml -platforms: [content_shell] +platforms: [chrome] platforms: - chrome diff --git a/lib/dart.js b/lib/dart.js index 0558a2fa..f14a9117 100644 --- a/lib/dart.js +++ b/lib/dart.js @@ -3,9 +3,7 @@ // BSD-style license that can be found in the LICENSE file. // This script runs in HTML files and loads the corresponding test scripts for -// either Dartium or a JS browser. It's used by "pub serve" and user-authored -// HTML files; when running without "pub serve", the default HTML file manually -// chooses between serving a Dart or JS script tag. +// a JS browser. It's used by "pub serve" and user-authored HTML files; window.onload = function() { // Sends an error message to the server indicating that the script failed to @@ -53,13 +51,7 @@ if (link.href == '') { var script = document.createElement('script'); -// Load the compiled JS for a normal browser, and the Dart code for Dartium. -if (navigator.userAgent.indexOf('(Dart)') === -1) { - script.src = link.href + '.browser_test.dart.js'; -} else { - script.src = link.href + '.browser_test.dart'; - script.type = 'application/dart'; -} +script.src = link.href + '.browser_test.dart.js'; script.onerror = function(event) { var message = "Failed to load script at " + script.src + diff --git a/lib/src/backend/runtime.dart b/lib/src/backend/runtime.dart index 47943ee8..6fd8238a 100644 --- a/lib/src/backend/runtime.dart +++ b/lib/src/backend/runtime.dart @@ -10,15 +10,6 @@ class Runtime { /// The command-line Dart VM. static const Runtime vm = const Runtime("VM", "vm", isDartVM: true); - /// Dartium. - static const Runtime dartium = const Runtime("Dartium", "dartium", - isBrowser: true, isBlink: true, isDartVM: true); - - /// Dartium content shell. - static const Runtime contentShell = const Runtime( - "Dartium Content Shell", "content-shell", - isBrowser: true, isBlink: true, isDartVM: true, isHeadless: true); - /// Google Chrome. static const Runtime chrome = const Runtime("Chrome", "chrome", isBrowser: true, isJS: true, isBlink: true); @@ -45,8 +36,6 @@ class Runtime { /// The platforms that are supported by the test runner by default. static const List<Runtime> builtIn = const [ Runtime.vm, - Runtime.dartium, - Runtime.contentShell, Runtime.chrome, Runtime.phantomJS, Runtime.firefox, diff --git a/lib/src/runner/browser/browser_manager.dart b/lib/src/runner/browser/browser_manager.dart index cc9b6fa7..7222fc36 100644 --- a/lib/src/runner/browser/browser_manager.dart +++ b/lib/src/runner/browser/browser_manager.dart @@ -21,8 +21,6 @@ import '../plugin/platform_helpers.dart'; import '../runner_suite.dart'; import 'browser.dart'; import 'chrome.dart'; -import 'content_shell.dart'; -import 'dartium.dart'; import 'firefox.dart'; import 'internet_explorer.dart'; import 'phantom_js.dart'; @@ -139,10 +137,6 @@ class BrowserManager { Uri url, Runtime browser, ExecutableSettings settings, {bool debug: false}) { switch (browser.root) { - case Runtime.dartium: - return new Dartium(url, settings: settings, debug: debug); - case Runtime.contentShell: - return new ContentShell(url, settings: settings, debug: debug); case Runtime.chrome: return new Chrome(url, settings: settings, debug: debug); case Runtime.phantomJS: diff --git a/lib/src/runner/browser/content_shell.dart b/lib/src/runner/browser/content_shell.dart deleted file mode 100644 index 2159357a..00000000 --- a/lib/src/runner/browser/content_shell.dart +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:async'; -import 'dart:io'; - -import '../../backend/runtime.dart'; -import '../../util/io.dart'; -import '../../utils.dart'; -import '../application_exception.dart'; -import '../executable_settings.dart'; -import 'browser.dart'; -import 'default_settings.dart'; - -final _observatoryRegExp = new RegExp(r"^Observatory listening on ([^ ]+)"); -final _errorTimeout = const Duration(seconds: 10); - -/// A class for running an instance of the Dartium content shell. -/// -/// Most of the communication with the browser is expected to happen via HTTP, -/// so this exposes a bare-bones API. The browser starts as soon as the class is -/// constructed, and is killed when [close] is called. -/// -/// Any errors starting or running the process are reported through [onExit]. -class ContentShell extends Browser { - final name = "Content Shell"; - - final Future<Uri> observatoryUrl; - - final Future<Uri> remoteDebuggerUrl; - - factory ContentShell(url, {ExecutableSettings settings, bool debug: false}) { - settings ??= defaultSettings[Runtime.contentShell]; - var observatoryCompleter = new Completer<Uri>.sync(); - var remoteDebuggerCompleter = new Completer<Uri>.sync(); - return new ContentShell._(() { - var tryPort = ([int port]) async { - var args = ["--dump-render-tree", url.toString()] - ..addAll(settings.arguments); - if (port != null) args.add("--remote-debugging-port=$port"); - - var process = await Process.start(settings.executable, args, - environment: {"DART_FLAGS": "--checked"}); - - if (debug) { - observatoryCompleter.complete(lineSplitter - .bind(process.stdout) - .map((line) { - var match = _observatoryRegExp.firstMatch(line); - if (match == null) return null; - return Uri.parse(match[1]); - }) - .where((uri) => uri != null) - .first); - } else { - observatoryCompleter.complete(null); - } - - var stderr = new StreamIterator(lineSplitter.bind(process.stderr)); - - // Before we can consider content_shell started successfully, we have to - // make sure it's not expired and that the remote debugging port worked. - // Any errors from this will always come before the "Running without - // renderer sandbox" message. - while (await stderr.moveNext().timeout(_errorTimeout).catchError((_) => - throw new ApplicationException( - "Error starting up content_shell.\n" - "Ensure you are using the latest version:\n" - "http://gsdview.appspot.com/dart-archive/channels/stable/" - "release/latest/dartium/")) && - !stderr.current.endsWith("Running without renderer sandbox") && - !stderr.current.contains("Running without the SUID sandbox") && - // Error messages on Mac can get gobbled, we must assume that it - // it started up successfully. - !stderr.current - .contains("kq_init: detected broken kqueue; not using")) { - if (stderr.current == "[dartToStderr]: Dartium build has expired") { - stderr.cancel(); - process.kill(); - // TODO(nweiz): link to dartlang.org once it has download links for - // content shell - // (https://github.com/dart-lang/www.dartlang.org/issues/1164). - throw new ApplicationException( - "You're using an expired content_shell. Upgrade to the latest " - "version:\n" - "http://gsdview.appspot.com/dart-archive/channels/stable/" - "release/latest/dartium/"); - } else if (stderr.current.contains("bind() returned an error")) { - // If we failed to bind to the port, return null to tell - // getUnusedPort to try another one. - stderr.cancel(); - process.kill(); - return null; - } - } - - if (port != null) { - remoteDebuggerCompleter.complete( - getRemoteDebuggerUrl(Uri.parse("http://localhost:$port"))); - } else { - remoteDebuggerCompleter.complete(null); - } - - stderr.cancel(); - return process; - }; - - if (!debug) return tryPort(); - return getUnusedPort<Process>(tryPort); - }, observatoryCompleter.future, remoteDebuggerCompleter.future); - } - - ContentShell._(Future<Process> startBrowser(), this.observatoryUrl, - this.remoteDebuggerUrl) - : super(startBrowser); -} diff --git a/lib/src/runner/browser/dartium.dart b/lib/src/runner/browser/dartium.dart deleted file mode 100644 index ad8badef..00000000 --- a/lib/src/runner/browser/dartium.dart +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:async/async.dart'; - -import '../../backend/runtime.dart'; -import '../../util/io.dart'; -import '../../utils.dart'; -import '../executable_settings.dart'; -import 'browser.dart'; -import 'default_settings.dart'; - -final _observatoryRegExp = - new RegExp(r'Observatory listening (?:on|at) ([^ "]+)'); - -/// A class for running an instance of Dartium. -/// -/// Most of the communication with the browser is expected to happen via HTTP, -/// so this exposes a bare-bones API. The browser starts as soon as the class is -/// constructed, and is killed when [close] is called. -/// -/// Any errors starting or running the process are reported through [onExit]. -class Dartium extends Browser { - final name = "Dartium"; - - final Future<Uri> observatoryUrl; - - final Future<Uri> remoteDebuggerUrl; - - factory Dartium(url, {ExecutableSettings settings, bool debug: false}) { - settings ??= defaultSettings[Runtime.dartium]; - var observatoryCompleter = new Completer<Uri>.sync(); - var remoteDebuggerCompleter = new Completer<Uri>.sync(); - return new Dartium._(() async { - var tryPort = ([int port]) async { - var dir = createTempDir(); - var args = [ - "--user-data-dir=$dir", - url.toString(), - "--disable-extensions", - "--disable-popup-blocking", - "--bwsi", - "--no-first-run", - "--no-default-browser-check", - "--disable-default-apps", - "--disable-translate" - ]..addAll(settings.arguments); - - if (port != null) { - args.add("--remote-debugging-port=$port"); - - // This forces Dartium to emit logging on Windows. See sdk#28034. - args.add("--enable-logging=stderr"); - - // This flags causes Dartium to print a consistent line of output - // after its internal call to `bind()` has succeeded or failed. We - // wait for that output to determine whether the port we chose worked. - args.add("--vmodule=startup_browser_creator_impl=1"); - } - - var process = await Process.start(settings.executable, args, - environment: {"DART_FLAGS": "--checked"}); - - if (port != null) { - // Dartium on Windows prints all standard IO to stderr, so we need to - // look there rather than stdout for the Observatory URL. - Stream<List<int>> observatoryStream; - Stream<List<int>> logStream; - if (Platform.isWindows) { - var split = StreamSplitter.splitFrom(process.stderr); - observatoryStream = split.first; - logStream = split.last; - } else { - observatoryStream = process.stdout; - logStream = process.stderr; - } - - observatoryCompleter.complete(_getObservatoryUrl(observatoryStream)); - - var logs = new StreamIterator(lineSplitter.bind(logStream)); - - // Before we can consider Dartium started successfully, we have to - // make sure the remote debugging port worked. Any errors from this - // will always come before the "Running without renderer sandbox" - // message. - while (await logs.moveNext() && - !logs.current.contains("startup_browser_creator_impl")) { - if (logs.current.contains("bind() returned an error")) { - // If we failed to bind to the port, return null to tell - // getUnusedPort to try another one. - logs.cancel(); - process.kill(); - return null; - } - } - logs.cancel(); - } else { - observatoryCompleter.complete(null); - } - - if (port != null) { - remoteDebuggerCompleter.complete( - getRemoteDebuggerUrl(Uri.parse("http://localhost:$port"))); - } else { - remoteDebuggerCompleter.complete(null); - } - - process.exitCode - .then((_) => new Directory(dir).deleteSync(recursive: true)); - - return process; - }; - - if (!debug) return tryPort(); - return getUnusedPort<Process>(tryPort); - }, observatoryCompleter.future, remoteDebuggerCompleter.future); - } - - Dartium._(Future<Process> startBrowser(), this.observatoryUrl, - this.remoteDebuggerUrl) - : super(startBrowser); - - // TODO(nweiz): simplify this when sdk#23923 is fixed. - /// Returns the Observatory URL for the Dartium executable with the given - /// [stdout] stream, or `null` if the correct one couldn't be found. - /// - /// Dartium prints out three different Observatory URLs when it starts. Only - /// one of them is connected to the VM instance running the host page, and the - /// ordering isn't guaranteed, so we need to figure out which one is correct. - /// We do so by connecting to the VM service via WebSockets and looking for - /// the Observatory instance that actually contains an isolate, and returning - /// the corresponding URI. - static Future<Uri> _getObservatoryUrl(Stream<List<int>> stdout) async { - var urlQueue = new StreamQueue<Uri>(lineSplitter.bind(stdout).map((line) { - var match = _observatoryRegExp.firstMatch(line); - return match == null ? null : Uri.parse(match[1]); - }).where((line) => line != null)); - - var operations = [urlQueue.next, urlQueue.next, urlQueue.next] - .map((future) => _checkObservatoryUrl(future)); - - urlQueue.cancel(); - - /// Dartium will print three possible observatory URLs. For each one, we - /// check whether it's actually connected to an isolate, indicating that - /// it's the observatory for the main page. Once we find the one that is, we - /// cancel the other requests and return it. - /// - /// Use try/catch rather than `defaultValue` in `firstWhere` since the - /// parameter name will change in Dart 2.0. - try { - return (await inCompletionOrder(operations) - .firstWhere((url) => url != null)) as Uri; - } on StateError catch (_) { - return null; - } - } - - /// If the URL returned by [future] corresponds to the correct Observatory - /// instance, returns it. Otherwise, returns `null`. - /// - /// If the returned operation is canceled before it fires, the WebSocket - /// connection with the given Observatory will be closed immediately. - static CancelableOperation<Uri> _checkObservatoryUrl(Future<Uri> future) { - var webSocket; - var canceled = false; - var completer = new CancelableCompleter<Uri>(onCancel: () { - canceled = true; - if (webSocket != null) webSocket.close(); - }); - - // We've encountered a format we don't understand. Close the web socket and - // complete to null. - giveUp() { - webSocket.close(); - if (!completer.isCompleted) completer.complete(); - } - - future.then((url) async { - try { - webSocket = await WebSocket - .connect(url.replace(scheme: 'ws', path: '/ws').toString()); - if (canceled) { - webSocket.close(); - return null; - } - - webSocket.add(jsonEncode({ - "jsonrpc": "2.0", - "method": "streamListen", - "params": {"streamId": "Isolate"}, - "id": "0" - })); - - webSocket.add(jsonEncode( - {"jsonrpc": "2.0", "method": "getVM", "params": {}, "id": "1"})); - - webSocket.listen((response) { - try { - response = jsonDecode(response); - } on FormatException catch (_) { - giveUp(); - return; - } - - // If there's a "response" key, we're probably talking to the pre-1.0 - // VM service protocol, in which case we should just give up. - if (response is! Map || response.containsKey("response")) { - giveUp(); - return; - } - - if (response["id"] == "0") return; - - if (response["id"] == "1") { - var result = response["result"]; - if (result is! Map) { - giveUp(); - return; - } - - var isolates = result["isolates"]; - if (isolates is! List) { - giveUp(); - return; - } - - if (isolates.isNotEmpty) { - webSocket.close(); - if (!completer.isCompleted) completer.complete(url); - } - return; - } - - // The 1.0 protocol used a raw "event" key, while the 2.0 protocol - // wraps it in JSON-RPC method params. - var event; - if (response.containsKey("event")) { - event = response["event"]; - } else { - var params = response["params"]; - if (params is Map) event = params["event"]; - } - - if (event is! Map) { - giveUp(); - return; - } - - if (event["kind"] != "IsolateStart") return; - webSocket.close(); - if (completer.isCompleted) return; - - // TODO(nweiz): include the isolate ID in the URL? - completer.complete(url); - }); - } on IOException catch (_) { - // IO exceptions are probably caused by connecting to an - // incorrect WebSocket that already closed. - return null; - } - }).catchError((error, stackTrace) { - if (!completer.isCompleted) completer.completeError(error, stackTrace); - }); - - return completer.operation; - } -} diff --git a/lib/src/runner/browser/default_settings.dart b/lib/src/runner/browser/default_settings.dart index 5c3bf5ba..499309ae 100644 --- a/lib/src/runner/browser/default_settings.dart +++ b/lib/src/runner/browser/default_settings.dart @@ -14,14 +14,6 @@ final defaultSettings = new UnmodifiableMapView({ macOSExecutable: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', windowsExecutable: r'Google\Chrome\Application\chrome.exe'), - Runtime.contentShell: new ExecutableSettings( - linuxExecutable: 'content_shell', - macOSExecutable: 'content_shell', - windowsExecutable: 'content_shell.exe'), - Runtime.dartium: new ExecutableSettings( - linuxExecutable: 'dartium', - macOSExecutable: 'dartium', - windowsExecutable: 'dartium.exe'), Runtime.firefox: new ExecutableSettings( linuxExecutable: 'firefox', macOSExecutable: '/Applications/Firefox.app/Contents/MacOS/firefox-bin', diff --git a/lib/src/runner/debugger.dart b/lib/src/runner/debugger.dart index d49d197b..ce267098 100644 --- a/lib/src/runner/debugger.dart +++ b/lib/src/runner/debugger.dart @@ -50,8 +50,7 @@ CancelableOperation debug( } // TODO(nweiz): Test using the console and restarting a test once sdk#25369 is -// fixed and the VM service client is released and we can set Dartium -// breakpoints. +// fixed and the VM service client is released /// A debugger for a single test suite. class _Debugger { /// The test runner configuration. diff --git a/lib/src/runner/loader.dart b/lib/src/runner/loader.dart index 61ce9e17..23ddf7c9 100644 --- a/lib/src/runner/loader.dart +++ b/lib/src/runner/loader.dart @@ -85,8 +85,6 @@ class Loader { _registerPlatformPlugin([Runtime.vm], () => new VMPlatform()); _registerPlatformPlugin([Runtime.nodeJS], () => new NodePlatform()); _registerPlatformPlugin([ - Runtime.dartium, - Runtime.contentShell, Runtime.chrome, Runtime.phantomJS, Runtime.firefox, diff --git a/lib/src/runner/vm/platform.dart b/lib/src/runner/vm/platform.dart index 4245e2c6..bdfb0e9d 100644 --- a/lib/src/runner/vm/platform.dart +++ b/lib/src/runner/vm/platform.dart @@ -5,7 +5,6 @@ import 'dart:async'; import 'dart:isolate'; -import 'package:package_resolver/package_resolver.dart'; import 'package:path/path.dart' as p; import 'package:stream_channel/stream_channel.dart'; diff --git a/test/runner/browser/dartium_test.dart b/test/runner/browser/dartium_test.dart deleted file mode 100644 index 0aac2a37..00000000 --- a/test/runner/browser/dartium_test.dart +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@TestOn("vm") -@Tags(const ["dartium"]) - -import 'package:test_descriptor/test_descriptor.dart' as d; - -import 'package:test/src/runner/browser/dartium.dart'; -import 'package:test/src/runner/executable_settings.dart'; -import 'package:test/test.dart'; - -import '../../io.dart'; -import '../../utils.dart'; -import 'code_server.dart'; - -void main() { - test("starts Dartium with the given URL", () async { - var server = await CodeServer.start(); - - server.handleDart(''' -var webSocket = new WebSocket( - window.location.href.replaceFirst("http://", "ws://")); -await webSocket.onOpen.first; -webSocket.send("loaded!"); -'''); - var webSocket = server.handleWebSocket(); - - var dartium = new Dartium(server.url); - addTearDown(() => dartium.close()); - - expect(await (await webSocket).stream.first, equals("loaded!")); - }); - - test("a process can be killed synchronously after it's started", () async { - var server = await CodeServer.start(); - - var dartium = new Dartium(server.url); - await dartium.close(); - }); - - test("reports an error in onExit", () { - var dartium = new Dartium("http://dart-lang.org", - settings: new ExecutableSettings( - linuxExecutable: "_does_not_exist", - macOSExecutable: "_does_not_exist", - windowsExecutable: "_does_not_exist")); - expect( - dartium.onExit, - throwsA(isApplicationException( - startsWith("Failed to run Dartium: $noSuchFileMessage")))); - }); - - test("can run successful tests", () async { - await d.file("test.dart", """ -import 'package:test/test.dart'; - -void main() { - test("success", () {}); -} -""").create(); - - var test = await runTest(["-p", "dartium", "test.dart"]); - expect(test.stdoutStream(), neverEmits(contains("Compiling"))); - expect(test.stdout, emitsThrough(contains("+1: All tests passed!"))); - await test.shouldExit(0); - }); - - test("can run failing tests", () async { - await d.file("test.dart", """ -import 'package:test/test.dart'; - -void main() { - test("failure", () => throw new TestFailure("oh no")); -} -""").create(); - - var test = await runTest(["-p", "dartium", "test.dart"]); - expect(test.stdout, emitsThrough(contains("-1: Some tests failed."))); - await test.shouldExit(1); - }); -} diff --git a/test/runner/browser/runner_test.dart b/test/runner/browser/runner_test.dart index 9a36f688..5a9a6913 100644 --- a/test/runner/browser/runner_test.dart +++ b/test/runner/browser/runner_test.dart @@ -212,15 +212,6 @@ void main() { }); group("runs successful tests", () { - test("on a JS and non-JS browser", () async { - await d.file("test.dart", _success).create(); - var test = await runTest(["-p", "dartium", "-p", "chrome", "test.dart"]); - - expect(test.stdoutStream(), neverEmits(contains("[Dartium] compiling"))); - expect(test.stdout, emitsThrough(contains("[Chrome] compiling"))); - await test.shouldExit(0); - }, tags: ['chrome', 'dartium']); - test("on a browser and the VM", () async { await d.file("test.dart", _success).create(); var test = await runTest(["-p", "chrome", "-p", "vm", "test.dart"]); @@ -299,12 +290,6 @@ void main() { """).create(); }); - test("on Dartium", () async { - var test = await runTest(["-p", "dartium", "test.dart"]); - expect(test.stdout, emitsThrough(contains("+1: All tests passed!"))); - await test.shouldExit(0); - }, tags: 'dartium'); - test("on Chrome", () async { var test = await runTest(["-p", "chrome", "test.dart"]); expect(test.stdout, emitsThrough(contains("+1: All tests passed!"))); @@ -400,12 +385,6 @@ void main() { """).create(); }); - test("on Dartium", () async { - var test = await runTest(["-p", "dartium", "test.dart"]); - expect(test.stdout, emitsThrough(contains("-1: Some tests failed."))); - await test.shouldExit(1); - }, tags: 'dartium'); - test("on Chrome", () async { var test = await runTest(["-p", "chrome", "test.dart"]); expect(test.stdout, emitsThrough(contains("-1: Some tests failed."))); diff --git a/test/runner/pub_serve_test.dart b/test/runner/pub_serve_test.dart index 4915db46..20f65a03 100644 --- a/test/runner/pub_serve_test.dart +++ b/test/runner/pub_serve_test.dart @@ -103,14 +103,6 @@ void main() { await pub.kill(); }, tags: 'node'); - test("runs those tests on Dartium", () async { - var pub = await runPubServe(); - var test = await runTest([_pubServeArg, '-p', 'dartium']); - expect(test.stdout, emitsThrough(contains('+1: All tests passed!'))); - await test.shouldExit(0); - await pub.kill(); - }, tags: 'dartium'); - test( "gracefully handles pub serve running on the wrong directory for " "VM tests", () async { @@ -151,24 +143,6 @@ void main() { await pub.kill(); }, tags: 'chrome'); - - test("when run on Dartium", () async { - await d.dir("web").create(); - - var pub = await runPubServe(args: ['web']); - var test = await runTest([_pubServeArg, '-p', 'dartium']); - expect( - test.stdout, - containsInOrder([ - '-1: loading ${p.join("test", "my_test.dart")} [E]', - 'Failed to load "${p.join("test", "my_test.dart")}":', - '404 Not Found', - 'Make sure "pub serve" is serving the test/ directory.' - ])); - await test.shouldExit(1); - - await pub.kill(); - }, tags: 'dartium'); }); test( @@ -249,14 +223,6 @@ void main() { await test.shouldExit(0); await pub.kill(); }, tags: 'chrome'); - - test("on Dartium", () async { - var pub = await runPubServe(); - var test = await runTest([_pubServeArg, '-p', 'dartium']); - expect(test.stdout, emitsThrough(contains('+1: All tests passed!'))); - await test.shouldExit(0); - await pub.kill(); - }, tags: 'dartium'); }); group("with a failing test", () { diff --git a/test/runner/runner_test.dart b/test/runner/runner_test.dart index bf17ddd9..497599fb 100644 --- a/test/runner/runner_test.dart +++ b/test/runner/runner_test.dart @@ -50,11 +50,10 @@ void main() { final _defaultConcurrency = math.max(1, Platform.numberOfProcessors ~/ 2); -final _browsers = - "[vm (default), dartium, content-shell, chrome, phantomjs, firefox" + - (Platform.isMacOS ? ", safari" : "") + - (Platform.isWindows ? ", ie" : "") + - ", node]"; +final _browsers = "[vm (default), chrome, phantomjs, firefox" + + (Platform.isMacOS ? ", safari" : "") + + (Platform.isWindows ? ", ie" : "") + + ", node]"; final _usage = """ Usage: pub run test [files or directories...] -- GitLab