| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.runner.browser.browser; | 5 library test.runner.browser.browser; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:stack_trace/stack_trace.dart'; | 10 import 'package:stack_trace/stack_trace.dart'; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 abstract class Browser { | 25 abstract class Browser { |
| 26 String get name; | 26 String get name; |
| 27 | 27 |
| 28 /// The Observatory URL for this browser. | 28 /// The Observatory URL for this browser. |
| 29 /// | 29 /// |
| 30 /// This will throw an [UnsupportedError] for browsers that aren't running the | 30 /// This will throw an [UnsupportedError] for browsers that aren't running the |
| 31 /// Dart VM, and return `null` if the Observatory URL can't be found. | 31 /// Dart VM, and return `null` if the Observatory URL can't be found. |
| 32 Future<Uri> get observatoryUrl => | 32 Future<Uri> get observatoryUrl => |
| 33 throw new UnsupportedError("$name doesn't support Observatory."); | 33 throw new UnsupportedError("$name doesn't support Observatory."); |
| 34 | 34 |
| 35 /// The remote debugger URL for this browser. |
| 36 /// |
| 37 /// This will throw an [UnsupportedError] for browsers that don't support |
| 38 /// remote debugging, and return `null` if the remote debugging URL can't be |
| 39 /// found. |
| 40 Future<Uri> get remoteDebuggerUrl => |
| 41 throw new UnsupportedError("$name doesn't support remote debugging."); |
| 42 |
| 35 /// The underlying process. | 43 /// The underlying process. |
| 36 /// | 44 /// |
| 37 /// This will fire once the process has started successfully. | 45 /// This will fire once the process has started successfully. |
| 38 Future<Process> get _process => _processCompleter.future; | 46 Future<Process> get _process => _processCompleter.future; |
| 39 final _processCompleter = new Completer<Process>(); | 47 final _processCompleter = new Completer<Process>(); |
| 40 | 48 |
| 41 /// Whether [close] has been called. | 49 /// Whether [close] has been called. |
| 42 var _closed = false; | 50 var _closed = false; |
| 43 | 51 |
| 44 /// A future that completes when the browser exits. | 52 /// A future that completes when the browser exits. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 /// Returns the same [Future] as [onExit], except that it won't emit | 112 /// Returns the same [Future] as [onExit], except that it won't emit |
| 105 /// exceptions. | 113 /// exceptions. |
| 106 Future close() { | 114 Future close() { |
| 107 _closed = true; | 115 _closed = true; |
| 108 _process.then((process) => process.kill()); | 116 _process.then((process) => process.kill()); |
| 109 | 117 |
| 110 // Swallow exceptions. The user should explicitly use [onExit] for these. | 118 // Swallow exceptions. The user should explicitly use [onExit] for these. |
| 111 return onExit.catchError((_) {}); | 119 return onExit.catchError((_) {}); |
| 112 } | 120 } |
| 113 } | 121 } |
| OLD | NEW |