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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 | 7 |
8 import 'package:async/async.dart'; | 8 import 'package:async/async.dart'; |
9 import 'package:pool/pool.dart'; | 9 import 'package:pool/pool.dart'; |
10 import 'package:stream_channel/stream_channel.dart'; | 10 import 'package:stream_channel/stream_channel.dart'; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 /// this process. That connection, once established, should be emitted via | 89 /// this process. That connection, once established, should be emitted via |
90 /// [future]. If [debug] is true, starts the browser in debug mode, with its | 90 /// [future]. If [debug] is true, starts the browser in debug mode, with its |
91 /// debugger interfaces on and detected. | 91 /// debugger interfaces on and detected. |
92 /// | 92 /// |
93 /// Returns the browser manager, or throws an [ApplicationException] if a | 93 /// Returns the browser manager, or throws an [ApplicationException] if a |
94 /// connection fails to be established. | 94 /// connection fails to be established. |
95 static Future<BrowserManager> start(TestPlatform platform, Uri url, | 95 static Future<BrowserManager> start(TestPlatform platform, Uri url, |
96 Future<WebSocketChannel> future, {bool debug: false}) { | 96 Future<WebSocketChannel> future, {bool debug: false}) { |
97 var browser = _newBrowser(url, platform, debug: debug); | 97 var browser = _newBrowser(url, platform, debug: debug); |
98 | 98 |
99 var completer = new Completer(); | 99 var completer = new Completer<BrowserManager>(); |
100 | 100 |
101 // TODO(nweiz): Gracefully handle the browser being killed before the | 101 // TODO(nweiz): Gracefully handle the browser being killed before the |
102 // tests complete. | 102 // tests complete. |
103 browser.onExit.then((_) { | 103 browser.onExit.then((_) { |
104 throw new ApplicationException( | 104 throw new ApplicationException( |
105 "${platform.name} exited before connecting."); | 105 "${platform.name} exited before connecting."); |
106 }).catchError((error, stackTrace) { | 106 }).catchError((error, stackTrace) { |
107 if (completer.isCompleted) return; | 107 if (completer.isCompleted) return; |
108 completer.completeError(error, stackTrace); | 108 completer.completeError(error, stackTrace); |
109 }); | 109 }); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 final Uri observatoryUrl; | 297 final Uri observatoryUrl; |
298 | 298 |
299 final Uri remoteDebuggerUrl; | 299 final Uri remoteDebuggerUrl; |
300 | 300 |
301 _BrowserEnvironment(this._manager, this.observatoryUrl, | 301 _BrowserEnvironment(this._manager, this.observatoryUrl, |
302 this.remoteDebuggerUrl); | 302 this.remoteDebuggerUrl); |
303 | 303 |
304 CancelableOperation displayPause() => _manager._displayPause(); | 304 CancelableOperation displayPause() => _manager._displayPause(); |
305 } | 305 } |
OLD | NEW |