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_manager; | 5 library test.runner.browser.browser_manager; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:async/async.dart'; | 10 import 'package:async/async.dart'; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 webSocket.map(JSON.decode), | 144 webSocket.map(JSON.decode), |
145 mapSink(webSocket, JSON.encode)) { | 145 mapSink(webSocket, JSON.encode)) { |
146 _environment = _loadBrowserEnvironment(); | 146 _environment = _loadBrowserEnvironment(); |
147 _channel.stream.listen(_onMessage, onDone: close); | 147 _channel.stream.listen(_onMessage, onDone: close); |
148 } | 148 } |
149 | 149 |
150 /// Loads [_BrowserEnvironment]. | 150 /// Loads [_BrowserEnvironment]. |
151 Future<_BrowserEnvironment> _loadBrowserEnvironment() async { | 151 Future<_BrowserEnvironment> _loadBrowserEnvironment() async { |
152 var observatoryUrl; | 152 var observatoryUrl; |
153 if (_platform.isDartVM) observatoryUrl = await _browser.observatoryUrl; | 153 if (_platform.isDartVM) observatoryUrl = await _browser.observatoryUrl; |
154 return new _BrowserEnvironment(this, observatoryUrl); | 154 |
| 155 var remoteDebuggerUrl; |
| 156 if (_platform == TestPlatform.contentShell) { |
| 157 remoteDebuggerUrl = await _browser.remoteDebuggerUrl; |
| 158 } |
| 159 |
| 160 return new _BrowserEnvironment(this, observatoryUrl, remoteDebuggerUrl); |
155 } | 161 } |
156 | 162 |
157 /// Tells the browser the load a test suite from the URL [url]. | 163 /// Tells the browser the load a test suite from the URL [url]. |
158 /// | 164 /// |
159 /// [url] should be an HTML page with a reference to the JS-compiled test | 165 /// [url] should be an HTML page with a reference to the JS-compiled test |
160 /// suite. [path] is the path of the original test suite file, which is used | 166 /// suite. [path] is the path of the original test suite file, which is used |
161 /// for reporting. [metadata] is the parsed metadata for the test suite. | 167 /// for reporting. [metadata] is the parsed metadata for the test suite. |
162 /// | 168 /// |
163 /// If [mapper] is passed, it's used to map stack traces for errors coming | 169 /// If [mapper] is passed, it's used to map stack traces for errors coming |
164 /// from this test suite. | 170 /// from this test suite. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 284 } |
279 | 285 |
280 /// An implementation of [Environment] for the browser. | 286 /// An implementation of [Environment] for the browser. |
281 /// | 287 /// |
282 /// All methods forward directly to [BrowserManager]. | 288 /// All methods forward directly to [BrowserManager]. |
283 class _BrowserEnvironment implements Environment { | 289 class _BrowserEnvironment implements Environment { |
284 final BrowserManager _manager; | 290 final BrowserManager _manager; |
285 | 291 |
286 final Uri observatoryUrl; | 292 final Uri observatoryUrl; |
287 | 293 |
288 _BrowserEnvironment(this._manager, this.observatoryUrl); | 294 final Uri remoteDebuggerUrl; |
| 295 |
| 296 _BrowserEnvironment(this._manager, this.observatoryUrl, |
| 297 this.remoteDebuggerUrl); |
289 | 298 |
290 CancelableFuture displayPause() => _manager._displayPause(); | 299 CancelableFuture displayPause() => _manager._displayPause(); |
291 } | 300 } |
OLD | NEW |