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 | 7 |
8 import 'package:async/async.dart'; | 8 import 'package:async/async.dart'; |
9 | 9 |
10 import 'backend/group.dart'; | 10 import 'backend/group.dart'; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 }); | 159 }); |
160 } | 160 } |
161 | 161 |
162 if (_debugOperation != null) await _debugOperation.cancel(); | 162 if (_debugOperation != null) await _debugOperation.cancel(); |
163 | 163 |
164 if (_suiteSubscription != null) _suiteSubscription.cancel(); | 164 if (_suiteSubscription != null) _suiteSubscription.cancel(); |
165 _suiteSubscription = null; | 165 _suiteSubscription = null; |
166 | 166 |
167 // Make sure we close the engine *before* the loader. Otherwise, | 167 // Make sure we close the engine *before* the loader. Otherwise, |
168 // LoadSuites provided by the loader may get into bad states. | 168 // LoadSuites provided by the loader may get into bad states. |
169 await _engine.close(); | 169 // |
| 170 // We close the loader's browsers while we're closing the engine because |
| 171 // browser tests don't store any state we care about and we want them to |
| 172 // shut down without waiting for their tear-downs. |
| 173 await Future.wait([ |
| 174 _loader.closeBrowsers(), |
| 175 _engine.close() |
| 176 ]); |
170 if (timer != null) timer.cancel(); | 177 if (timer != null) timer.cancel(); |
171 await _loader.close(); | 178 await _loader.close(); |
172 }); | 179 }); |
173 | 180 |
174 /// Return a stream of [LoadSuite]s in [_config.paths]. | 181 /// Return a stream of [LoadSuite]s in [_config.paths]. |
175 /// | 182 /// |
176 /// Only tests that match [_config.pattern] will be included in the | 183 /// Only tests that match [_config.pattern] will be included in the |
177 /// suites once they're loaded. | 184 /// suites once they're loaded. |
178 Stream<LoadSuite> _loadSuites() { | 185 Stream<LoadSuite> _loadSuites() { |
179 return mergeStreams(_config.paths.map((path) { | 186 return mergeStreams(_config.paths.map((path) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 await _debugOperation.valueOrCancellation(); | 306 await _debugOperation.valueOrCancellation(); |
300 }).listen(null); | 307 }).listen(null); |
301 | 308 |
302 var results = await Future.wait([ | 309 var results = await Future.wait([ |
303 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), | 310 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), |
304 _engine.run() | 311 _engine.run() |
305 ]); | 312 ]); |
306 return results.last; | 313 return results.last; |
307 } | 314 } |
308 } | 315 } |
OLD | NEW |