| 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.engine; | 5 library test.runner.engine; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:async/async.dart' hide Result; | 10 import 'package:async/async.dart' hide Result; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 final _activeLoadTests = new List<LiveTest>(); | 137 final _activeLoadTests = new List<LiveTest>(); |
| 138 | 138 |
| 139 /// Creates an [Engine] that will run all tests provided via [suiteSink]. | 139 /// Creates an [Engine] that will run all tests provided via [suiteSink]. |
| 140 /// | 140 /// |
| 141 /// [concurrency] controls how many suites are run at once, and defaults to 1. | 141 /// [concurrency] controls how many suites are run at once, and defaults to 1. |
| 142 /// [maxSuites] controls how many suites are *loaded* at once, and defaults to | 142 /// [maxSuites] controls how many suites are *loaded* at once, and defaults to |
| 143 /// four times [concurrency]. | 143 /// four times [concurrency]. |
| 144 Engine({int concurrency, int maxSuites}) | 144 Engine({int concurrency, int maxSuites}) |
| 145 : _runPool = new Pool(concurrency == null ? 1 : concurrency), | 145 : _runPool = new Pool(concurrency == null ? 1 : concurrency), |
| 146 _loadPool = new Pool(maxSuites == null | 146 _loadPool = new Pool(maxSuites == null |
| 147 ? (concurrency == null ? 4 : concurrency * 4) | 147 ? (concurrency == null ? 2 : concurrency * 2) |
| 148 : maxSuites) { | 148 : maxSuites) { |
| 149 _group.future.then((_) { | 149 _group.future.then((_) { |
| 150 if (_closedBeforeDone == null) _closedBeforeDone = false; | 150 if (_closedBeforeDone == null) _closedBeforeDone = false; |
| 151 }).catchError((_) { | 151 }).catchError((_) { |
| 152 // Don't top-level errors. They'll be thrown via [success] anyway. | 152 // Don't top-level errors. They'll be thrown via [success] anyway. |
| 153 }); | 153 }); |
| 154 } | 154 } |
| 155 | 155 |
| 156 /// Creates an [Engine] that will run all tests in [suites]. | 156 /// Creates an [Engine] that will run all tests in [suites]. |
| 157 /// | 157 /// |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 // Close the running tests first so that we're sure to wait for them to | 320 // Close the running tests first so that we're sure to wait for them to |
| 321 // finish before we close their suites and cause them to become unloaded. | 321 // finish before we close their suites and cause them to become unloaded. |
| 322 var allLiveTests = liveTests.toSet()..addAll(_activeLoadTests); | 322 var allLiveTests = liveTests.toSet()..addAll(_activeLoadTests); |
| 323 await Future.wait(allLiveTests.map((liveTest) => liveTest.close())); | 323 await Future.wait(allLiveTests.map((liveTest) => liveTest.close())); |
| 324 | 324 |
| 325 var allSuites = allLiveTests.map((liveTest) => liveTest.suite).toSet(); | 325 var allSuites = allLiveTests.map((liveTest) => liveTest.suite).toSet(); |
| 326 await Future.wait(allSuites.map((suite) => suite.close())); | 326 await Future.wait(allSuites.map((suite) => suite.close())); |
| 327 } | 327 } |
| 328 } | 328 } |
| OLD | NEW |