Chromium Code Reviews| Index: lib/src/runner/browser/content_shell.dart |
| diff --git a/lib/src/runner/browser/content_shell.dart b/lib/src/runner/browser/content_shell.dart |
| index fe4fef2d134f9bb417e1fa1c610d2a7473025aad..b7791465b51afad18294ad376ddad6a59704b52f 100644 |
| --- a/lib/src/runner/browser/content_shell.dart |
| +++ b/lib/src/runner/browser/content_shell.dart |
| @@ -5,10 +5,15 @@ |
| library test.runner.browser.content_shell; |
| import 'dart:async'; |
| +import 'dart:convert'; |
| import 'dart:io'; |
| +import '../application_exception.dart'; |
| import 'browser.dart'; |
| +/// A converter that transforms a byte stream into a stream of lines. |
| +final _lines = UTF8.decoder.fuse(const LineSplitter()); |
| + |
| /// A class for running an instance of the Dartium content shell. |
| /// |
| /// Most of the communication with the browser is expected to happen via HTTP, |
| @@ -37,15 +42,32 @@ class ContentShell implements Browser { |
| ContentShell(url, {String executable}) { |
| if (executable == null) executable = _defaultExecutable(); |
| + // Whether we killed content shell because it used an expired Dart version. |
| + var expired = false; |
| + |
| // Don't return a Future here because there's no need for the caller to wait |
| // for the process to actually start. They should just wait for the HTTP |
| // request instead. |
| Process.start(executable, ["--dump-render-tree", url.toString()], |
| environment: {"DART_FLAGS": "--checked"}).then((process) { |
| + _lines.bind(process.stderr).listen((line) { |
| + if (line != "[dartToStderr]: Dartium build has expired") return; |
| + expired = true; |
| + process.kill(); |
| + }); |
| + |
| _process = process; |
| _onProcessStartedCompleter.complete(); |
| return _process.exitCode; |
| }).then((exitCode) { |
| + if (expired) { |
| + throw new ApplicationException( |
|
kevmoo
2015/04/14 22:52:12
Add a TODO to point to the dart site for content_s
nweiz
2015/04/14 23:05:31
Done.
|
| + "You're using an expired content_shell. Upgrade to the latest " |
| + "version:\n" |
| + "http://gsdview.appspot.com/dart-archive/channels/stable/release/" |
| + "latest/dartium/"); |
| + } |
| + |
| if (exitCode != 0) throw "Content shell failed with exit code $exitCode."; |
| }).then(_onExitCompleter.complete) |
| .catchError(_onExitCompleter.completeError); |