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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 } | 322 } |
323 | 323 |
324 /// Returns the [BrowserManager] for [platform], which should be a browser. | 324 /// Returns the [BrowserManager] for [platform], which should be a browser. |
325 /// | 325 /// |
326 /// If no browser manager is running yet, starts one. | 326 /// If no browser manager is running yet, starts one. |
327 Future<BrowserManager> _browserManagerFor(TestPlatform platform) { | 327 Future<BrowserManager> _browserManagerFor(TestPlatform platform) { |
328 var manager = _browserManagers[platform]; | 328 var manager = _browserManagers[platform]; |
329 if (manager != null) return manager; | 329 if (manager != null) return manager; |
330 | 330 |
331 var completer = new Completer(); | 331 var completer = new Completer(); |
332 _browserManagers[platform] = completer.future; | 332 |
| 333 // Swallow errors, since they're already being surfaced through the return |
| 334 // value and [browser.onError]. |
| 335 _browserManagers[platform] = completer.future.catchError((_) {}); |
333 var path = _webSocketHandler.create(webSocketHandler((webSocket) { | 336 var path = _webSocketHandler.create(webSocketHandler((webSocket) { |
334 completer.complete(new BrowserManager(webSocket)); | 337 completer.complete(new BrowserManager(webSocket)); |
335 })); | 338 })); |
336 | 339 |
337 var webSocketUrl = url.replace(scheme: 'ws').resolve(path); | 340 var webSocketUrl = url.replace(scheme: 'ws').resolve(path); |
338 | 341 |
339 var hostUrl = (_pubServeUrl == null ? url : _pubServeUrl) | 342 var hostUrl = (_pubServeUrl == null ? url : _pubServeUrl) |
340 .resolve('packages/test/src/runner/browser/static/index.html'); | 343 .resolve('packages/test/src/runner/browser/static/index.html'); |
341 | 344 |
342 var browser = _newBrowser(hostUrl.replace(queryParameters: { | 345 var browser = _newBrowser(hostUrl.replace(queryParameters: { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 if (_pubServeUrl == null) { | 391 if (_pubServeUrl == null) { |
389 new Directory(_compiledDir).deleteSync(recursive: true); | 392 new Directory(_compiledDir).deleteSync(recursive: true); |
390 } else { | 393 } else { |
391 _http.close(); | 394 _http.close(); |
392 } | 395 } |
393 | 396 |
394 _closeCompleter.complete(); | 397 _closeCompleter.complete(); |
395 }).catchError(_closeCompleter.completeError); | 398 }).catchError(_closeCompleter.completeError); |
396 } | 399 } |
397 } | 400 } |
OLD | NEW |