| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 class ProcessQueue { | 177 class ProcessQueue { |
| 178 int numProcesses = 0; | 178 int numProcesses = 0; |
| 179 final int maxProcesses; | 179 final int maxProcesses; |
| 180 Queue<TestCase> tests; | 180 Queue<TestCase> tests; |
| 181 ProgressIndicator progress; | 181 ProgressIndicator progress; |
| 182 var onDone; | 182 var onDone; |
| 183 | 183 |
| 184 ProcessQueue(Map configuration, this.onDone) | 184 ProcessQueue(Map configuration, this.onDone) |
| 185 : tests = new Queue<TestCase>(), | 185 : tests = new Queue<TestCase>(), |
| 186 maxProcesses = configuration['tasks'], | 186 maxProcesses = configuration['tasks'], |
| 187 progress = new CompactProgressIndicator(); | 187 progress = new ProgressIndicator.fromName(configuration['progress']); |
| 188 | 188 |
| 189 tryRunTest() { | 189 tryRunTest() { |
| 190 if (tests.isEmpty() && numProcesses == 0) { | 190 if (tests.isEmpty() && numProcesses == 0) { |
| 191 progress.allDone(); |
| 191 onDone(); | 192 onDone(); |
| 192 } | 193 } |
| 193 if (numProcesses < maxProcesses && !tests.isEmpty()) { | 194 if (numProcesses < maxProcesses && !tests.isEmpty()) { |
| 194 TestCase test = tests.removeFirst(); | 195 TestCase test = tests.removeFirst(); |
| 195 progress.start(test); | 196 progress.start(test); |
| 196 Function oldCallback = test.completedHandler; | 197 Function oldCallback = test.completedHandler; |
| 197 Function wrapper = (TestCase test_arg) { | 198 Function wrapper = (TestCase test_arg) { |
| 198 numProcesses--; | 199 numProcesses--; |
| 199 progress.done(test_arg); | 200 progress.done(test_arg); |
| 200 tryRunTest(); | 201 tryRunTest(); |
| 201 oldCallback(test_arg); | 202 oldCallback(test_arg); |
| 202 }; | 203 }; |
| 203 test.completedHandler = wrapper; | 204 test.completedHandler = wrapper; |
| 204 new RunningProcess(test, test.timeout).start(); | 205 new RunningProcess(test, test.timeout).start(); |
| 205 numProcesses++; | 206 numProcesses++; |
| 206 } | 207 } |
| 207 } | 208 } |
| 208 | 209 |
| 209 runTest(TestCase test) { | 210 runTest(TestCase test) { |
| 210 progress.testAdded(); | 211 progress.testAdded(); |
| 211 tests.add(test); | 212 tests.add(test); |
| 212 tryRunTest(); | 213 tryRunTest(); |
| 213 } | 214 } |
| 214 } | 215 } |
| OLD | NEW |