OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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"); | 5 #library("test_runner"); |
6 | 6 |
7 #import("status_file_parser.dart"); | 7 #import("status_file_parser.dart"); |
8 #import("test_progress.dart"); | 8 #import("test_progress.dart"); |
9 | 9 |
10 /** | 10 /** |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 class ProcessQueue { | 187 class ProcessQueue { |
188 int numProcesses = 0; | 188 int numProcesses = 0; |
189 final int maxProcesses; | 189 final int maxProcesses; |
190 Queue<TestCase> tests; | 190 Queue<TestCase> tests; |
191 ProgressIndicator progress; | 191 ProgressIndicator progress; |
192 var onDone; | 192 var onDone; |
193 | 193 |
194 ProcessQueue(Map configuration, this.onDone) | 194 ProcessQueue(int this.maxProcesses, |
| 195 String progress, |
| 196 Date start_time, |
| 197 this.onDone) |
195 : tests = new Queue<TestCase>(), | 198 : tests = new Queue<TestCase>(), |
196 maxProcesses = configuration['tasks'], | 199 progress = new ProgressIndicator.fromName(progress, start_time); |
197 progress = new ProgressIndicator.fromName(configuration['progress']); | |
198 | 200 |
199 tryRunTest() { | 201 tryRunTest() { |
200 if (tests.isEmpty() && numProcesses == 0) { | 202 if (tests.isEmpty() && numProcesses == 0) { |
201 progress.allDone(); | 203 progress.allDone(); |
202 onDone(); | 204 onDone(); |
203 } | 205 } |
204 if (numProcesses < maxProcesses && !tests.isEmpty()) { | 206 if (numProcesses < maxProcesses && !tests.isEmpty()) { |
205 TestCase test = tests.removeFirst(); | 207 TestCase test = tests.removeFirst(); |
206 progress.start(test); | 208 progress.start(test); |
207 Function oldCallback = test.completedHandler; | 209 Function oldCallback = test.completedHandler; |
208 Function wrapper = (TestCase test_arg) { | 210 Function wrapper = (TestCase test_arg) { |
209 numProcesses--; | 211 numProcesses--; |
210 progress.done(test_arg); | 212 progress.done(test_arg); |
211 tryRunTest(); | 213 tryRunTest(); |
212 oldCallback(test_arg); | 214 oldCallback(test_arg); |
213 }; | 215 }; |
214 test.completedHandler = wrapper; | 216 test.completedHandler = wrapper; |
215 new RunningProcess(test, test.timeout).start(); | 217 new RunningProcess(test, test.timeout).start(); |
216 numProcesses++; | 218 numProcesses++; |
217 } | 219 } |
218 } | 220 } |
219 | 221 |
220 runTest(TestCase test) { | 222 runTest(TestCase test) { |
221 progress.testAdded(); | 223 progress.testAdded(); |
222 tests.add(test); | 224 tests.add(test); |
223 tryRunTest(); | 225 tryRunTest(); |
224 } | 226 } |
225 } | 227 } |
OLD | NEW |