| Index: lib/src/runner/browser/chrome.dart
|
| diff --git a/lib/src/runner/browser/chrome.dart b/lib/src/runner/browser/chrome.dart
|
| index fc4e232920e60dbc875b5f29550c94aab2d4f0c5..bca71a48994976cf5dc3e268b9a8d2e95a08f318 100644
|
| --- a/lib/src/runner/browser/chrome.dart
|
| +++ b/lib/src/runner/browser/chrome.dart
|
| @@ -5,11 +5,15 @@
|
| library test.runner.browser.chrome;
|
|
|
| import 'dart:async';
|
| +import 'dart:convert';
|
| import 'dart:io';
|
|
|
| import 'package:path/path.dart' as p;
|
| +import 'package:stack_trace/stack_trace.dart';
|
|
|
| import '../../util/io.dart';
|
| +import '../../utils.dart';
|
| +import '../application_exception.dart';
|
| import 'browser.dart';
|
|
|
| // TODO(nweiz): move this into its own package?
|
| @@ -25,12 +29,6 @@ class Chrome implements Browser {
|
| /// The underlying process.
|
| Process _process;
|
|
|
| - /// The temporary directory used as the browser's user data dir.
|
| - ///
|
| - /// A new data dir is created for each run to ensure that they're
|
| - /// well-isolated.
|
| - String _dir;
|
| -
|
| Future get onExit => _onExitCompleter.future;
|
| final _onExitCompleter = new Completer();
|
|
|
| @@ -52,9 +50,8 @@ class Chrome implements Browser {
|
| // for the process to actually start. They should just wait for the HTTP
|
| // request instead.
|
| withTempDir((dir) {
|
| - _dir = dir;
|
| return Process.start(executable, [
|
| - "--user-data-dir=$_dir",
|
| + "--user-data-dir=$dir",
|
| url.toString(),
|
| "--disable-extensions",
|
| "--disable-popup-blocking",
|
| @@ -72,9 +69,19 @@ class Chrome implements Browser {
|
| return _process.exitCode;
|
| });
|
| }).then((exitCode) {
|
| - if (exitCode != 0) throw "Chrome failed with exit code $exitCode.";
|
| - }).then(_onExitCompleter.complete)
|
| - .catchError(_onExitCompleter.completeError);
|
| + if (exitCode == 0) return null;
|
| +
|
| + return UTF8.decodeStream(_process.stderr).then((error) {
|
| + throw new ApplicationException(
|
| + "Chrome failed with exit code $exitCode:\n$error");
|
| + });
|
| + }).then(_onExitCompleter.complete).catchError((error, stackTrace) {
|
| + if (stackTrace == null) stackTrace = new Trace.current();
|
| + _onExitCompleter.completeError(
|
| + new ApplicationException(
|
| + "Failed to start Chrome: ${getErrorMessage(error)}."),
|
| + stackTrace);
|
| + });
|
| }
|
|
|
| Future close() {
|
|
|