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:io'; | 6 import 'dart:io'; |
7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart' hide Configuration; | 9 import 'package:analyzer/analyzer.dart' hide Configuration; |
10 import 'package:async/async.dart'; | 10 import 'package:async/async.dart'; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 /// Deserializes [test] into a concrete [Test] class. | 253 /// Deserializes [test] into a concrete [Test] class. |
254 /// | 254 /// |
255 /// Returns `null` if [test] is `null`. | 255 /// Returns `null` if [test] is `null`. |
256 Test _deserializeTest(Map test) { | 256 Test _deserializeTest(Map test) { |
257 if (test == null) return null; | 257 if (test == null) return null; |
258 | 258 |
259 var metadata = new Metadata.deserialize(test['metadata']); | 259 var metadata = new Metadata.deserialize(test['metadata']); |
260 return new IsolateTest(test['name'], metadata, test['sendPort']); | 260 return new IsolateTest(test['name'], metadata, test['sendPort']); |
261 } | 261 } |
262 | 262 |
| 263 /// Close all the browsers that the loader currently has open. |
| 264 /// |
| 265 /// Note that this doesn't close the loader itself. Browser tests can still be |
| 266 /// loaded, they'll just spawn new browsers. |
| 267 Future closeBrowsers() async { |
| 268 if (!_browserServerMemo.hasRun) return; |
| 269 await (await _browserServer).closeBrowsers(); |
| 270 } |
| 271 |
263 /// Closes the loader and releases all resources allocated by it. | 272 /// Closes the loader and releases all resources allocated by it. |
264 Future close() { | 273 Future close() { |
265 return _closeMemo.runOnce(() async { | 274 return _closeMemo.runOnce(() async { |
266 await Future.wait(_suites.map((suite) => suite.close())); | 275 await Future.wait(_suites.map((suite) => suite.close())); |
267 _suites.clear(); | 276 _suites.clear(); |
268 | 277 |
269 if (!_browserServerMemo.hasRun) return; | 278 if (!_browserServerMemo.hasRun) return; |
270 await (await _browserServer).close(); | 279 await (await _browserServer).close(); |
271 }); | 280 }); |
272 } | 281 } |
273 } | 282 } |
OLD | NEW |