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.server; | 5 library test.runner.browser.server; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 Future<BrowserManager> _browserManagerFor(TestPlatform platform) { | 346 Future<BrowserManager> _browserManagerFor(TestPlatform platform) { |
347 var manager = _browserManagers[platform]; | 347 var manager = _browserManagers[platform]; |
348 if (manager != null) return manager; | 348 if (manager != null) return manager; |
349 | 349 |
350 var completer = new Completer(); | 350 var completer = new Completer(); |
351 | 351 |
352 // Swallow errors, since they're already being surfaced through the return | 352 // Swallow errors, since they're already being surfaced through the return |
353 // value and [browser.onError]. | 353 // value and [browser.onError]. |
354 _browserManagers[platform] = completer.future.catchError((_) {}); | 354 _browserManagers[platform] = completer.future.catchError((_) {}); |
355 var path = _webSocketHandler.create(webSocketHandler((webSocket) { | 355 var path = _webSocketHandler.create(webSocketHandler((webSocket) { |
356 completer.complete(new BrowserManager(webSocket)); | 356 completer.complete(new BrowserManager(platform, webSocket)); |
357 })); | 357 })); |
358 | 358 |
359 var webSocketUrl = url.replace(scheme: 'ws').resolve(path); | 359 var webSocketUrl = url.replace(scheme: 'ws').resolve(path); |
360 | 360 |
361 var hostUrl = (_pubServeUrl == null ? url : _pubServeUrl) | 361 var hostUrl = (_pubServeUrl == null ? url : _pubServeUrl) |
362 .resolve('packages/test/src/runner/browser/static/index.html'); | 362 .resolve('packages/test/src/runner/browser/static/index.html'); |
363 | 363 |
364 var browser = _newBrowser(hostUrl.replace(queryParameters: { | 364 var browser = _newBrowser(hostUrl.replace(queryParameters: { |
365 'managerUrl': webSocketUrl.toString() | 365 'managerUrl': webSocketUrl.toString() |
366 }), platform); | 366 }), platform); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 if (_pubServeUrl == null) { | 414 if (_pubServeUrl == null) { |
415 new Directory(_compiledDir).deleteSync(recursive: true); | 415 new Directory(_compiledDir).deleteSync(recursive: true); |
416 } else { | 416 } else { |
417 _http.close(); | 417 _http.close(); |
418 } | 418 } |
419 | 419 |
420 _closeCompleter.complete(); | 420 _closeCompleter.complete(); |
421 }).catchError(_closeCompleter.completeError); | 421 }).catchError(_closeCompleter.completeError); |
422 } | 422 } |
423 } | 423 } |
OLD | NEW |