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:pool/pool.dart'; | 10 import 'package:pool/pool.dart'; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 var controller; | 73 var controller; |
74 controller = new LiveTestController(suite, test, () { | 74 controller = new LiveTestController(suite, test, () { |
75 controller.setState(const State(Status.running, Result.success)); | 75 controller.setState(const State(Status.running, Result.success)); |
76 controller.setState(const State(Status.complete, Result.success)); | 76 controller.setState(const State(Status.complete, Result.success)); |
77 controller.completer.complete(); | 77 controller.completer.complete(); |
78 }, () {}); | 78 }, () {}); |
79 return controller.liveTest; | 79 return controller.liveTest; |
80 } | 80 } |
81 | 81 |
82 /// Creates an [Engine] that will run all tests in [suites]. | 82 /// Creates an [Engine] that will run all tests in [suites]. |
| 83 /// |
| 84 /// [concurrency] controls how many suites are run at once. |
83 Engine(Iterable<Suite> suites, {int concurrency}) | 85 Engine(Iterable<Suite> suites, {int concurrency}) |
84 : _liveTestsBySuite = _computeLiveTestsBySuite(suites), | 86 : _liveTestsBySuite = _computeLiveTestsBySuite(suites), |
85 _pool = new Pool(concurrency == null ? 1 : concurrency); | 87 _pool = new Pool(concurrency == null ? 1 : concurrency); |
86 | 88 |
87 /// Runs all tests in all suites defined by this engine. | 89 /// Runs all tests in all suites defined by this engine. |
88 /// | 90 /// |
89 /// This returns `true` if all tests succeed, and `false` otherwise. It will | 91 /// This returns `true` if all tests succeed, and `false` otherwise. It will |
90 /// only return once all tests have finished running. | 92 /// only return once all tests have finished running. |
91 Future<bool> run() { | 93 Future<bool> run() { |
92 if (_runCalled) { | 94 if (_runCalled) { |
(...skipping 25 matching lines...) Expand all Loading... |
118 /// engine should release any resources it has allocated. | 120 /// engine should release any resources it has allocated. |
119 /// | 121 /// |
120 /// Any actively-running tests are also closed. VM tests are allowed to finish | 122 /// Any actively-running tests are also closed. VM tests are allowed to finish |
121 /// running so that any modifications they've made to the filesystem can be | 123 /// running so that any modifications they've made to the filesystem can be |
122 /// cleaned up. | 124 /// cleaned up. |
123 Future close() { | 125 Future close() { |
124 _closed = true; | 126 _closed = true; |
125 return Future.wait(liveTests.map((liveTest) => liveTest.close())); | 127 return Future.wait(liveTests.map((liveTest) => liveTest.close())); |
126 } | 128 } |
127 } | 129 } |
OLD | NEW |