| 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.loader; | 5 library test.runner.loader; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 /// The package root to use for loading tests, or `null` to use the automatic | 38 /// The package root to use for loading tests, or `null` to use the automatic |
| 39 /// root. | 39 /// root. |
| 40 final String _packageRoot; | 40 final String _packageRoot; |
| 41 | 41 |
| 42 /// The URL for the `pub serve` instance to use to load tests. | 42 /// The URL for the `pub serve` instance to use to load tests. |
| 43 /// | 43 /// |
| 44 /// This is `null` if tests should be loaded from the filesystem. | 44 /// This is `null` if tests should be loaded from the filesystem. |
| 45 final Uri _pubServeUrl; | 45 final Uri _pubServeUrl; |
| 46 | 46 |
| 47 /// All isolates that have been spun up by the loader. | 47 /// All isolates that have been spun up by the loader. |
| 48 final _isolates = new Set<Isolate>(); | 48 final _isolates = new Set<IsolateWrapper>(); |
| 49 | 49 |
| 50 /// The server that serves browser test pages. | 50 /// The server that serves browser test pages. |
| 51 /// | 51 /// |
| 52 /// This is lazily initialized the first time it's accessed. | 52 /// This is lazily initialized the first time it's accessed. |
| 53 Future<BrowserServer> get _browserServer { | 53 Future<BrowserServer> get _browserServer { |
| 54 if (_browserServerCompleter == null) { | 54 if (_browserServerCompleter == null) { |
| 55 _browserServerCompleter = new Completer(); | 55 _browserServerCompleter = new Completer(); |
| 56 BrowserServer.start( | 56 BrowserServer.start( |
| 57 root: _root, | 57 root: _root, |
| 58 packageRoot: _packageRoot, | 58 packageRoot: _packageRoot, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 Future close() { | 222 Future close() { |
| 223 for (var isolate in _isolates) { | 223 for (var isolate in _isolates) { |
| 224 isolate.kill(); | 224 isolate.kill(); |
| 225 } | 225 } |
| 226 _isolates.clear(); | 226 _isolates.clear(); |
| 227 | 227 |
| 228 if (_browserServerCompleter == null) return new Future.value(); | 228 if (_browserServerCompleter == null) return new Future.value(); |
| 229 return _browserServer.then((browserServer) => browserServer.close()); | 229 return _browserServer.then((browserServer) => browserServer.close()); |
| 230 } | 230 } |
| 231 } | 231 } |
| OLD | NEW |