| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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:io"; | 5 import "dart:io"; |
| 6 import "dart:isolate"; | 6 import "dart:isolate"; |
| 7 import "dart:async"; | 7 import "dart:async"; |
| 8 import "../../../tools/testing/dart/test_runner.dart"; | 8 import "../../../tools/testing/dart/test_runner.dart"; |
| 9 import "../../../tools/testing/dart/test_suite.dart"; | 9 import "../../../tools/testing/dart/test_suite.dart"; |
| 10 import "../../../tools/testing/dart/test_progress.dart" as progress; | 10 import "../../../tools/testing/dart/test_progress.dart" as progress; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 static void finished() { | 50 static void finished() { |
| 51 if (numTests != numCompletedTests) { | 51 if (numTests != numCompletedTests) { |
| 52 throw "bad completion count. " | 52 throw "bad completion count. " |
| 53 "expected: $numTests, actual: $numCompletedTests"; | 53 "expected: $numTests, actual: $numCompletedTests"; |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 | 58 |
| 59 class CustomTestSuite extends TestSuite { | 59 class CustomTestSuite extends TestSuite { |
| 60 CustomTestSuite() : super({}, "CustomTestSuite"); | 60 CustomTestSuite(Map configuration) : super(configuration, "CustomTestSuite"); |
| 61 | 61 |
| 62 void forEachTest(TestCaseEvent onTest, Map testCache, [onDone]) { | 62 void forEachTest(TestCaseEvent onTest, Map testCache, [onDone]) { |
| 63 void enqueueTestCase(testCase) { | 63 void enqueueTestCase(testCase) { |
| 64 TestController.numTests++; | 64 TestController.numTests++; |
| 65 onTest(testCase); | 65 onTest(testCase); |
| 66 } | 66 } |
| 67 | 67 |
| 68 var testCaseCrash = _makeCrashTestCase("crash", [Expectation.CRASH]); | 68 var testCaseCrash = _makeCrashTestCase("crash", [Expectation.CRASH]); |
| 69 var testCasePass = _makeNormalTestCase("pass", [Expectation.PASS]); | 69 var testCasePass = _makeNormalTestCase("pass", [Expectation.PASS]); |
| 70 var testCaseFail = _makeNormalTestCase("fail", [Expectation.FAIL]); | 70 var testCaseFail = _makeNormalTestCase("fail", [Expectation.FAIL]); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 configuration, | 110 configuration, |
| 111 new Set<Expectation>.from(expectations)); | 111 new Set<Expectation>.from(expectations)); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 void testProcessQueue() { | 115 void testProcessQueue() { |
| 116 var maxProcesses = 2; | 116 var maxProcesses = 2; |
| 117 var maxBrowserProcesses = maxProcesses; | 117 var maxBrowserProcesses = maxProcesses; |
| 118 var config = new TestOptionsParser().parse(['--nobatch'])[0]; | 118 var config = new TestOptionsParser().parse(['--nobatch'])[0]; |
| 119 new ProcessQueue(config, maxProcesses, maxBrowserProcesses, | 119 new ProcessQueue(config, maxProcesses, maxBrowserProcesses, |
| 120 new DateTime.now(), [new CustomTestSuite()], | 120 new DateTime.now(), [new CustomTestSuite(config)], |
| 121 [new EventListener()], TestController.finished); | 121 [new EventListener()], TestController.finished); |
| 122 } | 122 } |
| 123 | 123 |
| 124 class EventListener extends progress.EventListener{ | 124 class EventListener extends progress.EventListener{ |
| 125 void done(TestCase test) { | 125 void done(TestCase test) { |
| 126 TestController.processCompletedTest(test); | 126 TestController.processCompletedTest(test); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 void main(List<String> arguments) { | 130 void main(List<String> arguments) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 143 break; | 143 break; |
| 144 case 'timeout': | 144 case 'timeout': |
| 145 // This process should be killed by the test after DEFAULT_TIMEOUT | 145 // This process should be killed by the test after DEFAULT_TIMEOUT |
| 146 new Timer(new Duration(hours: 42), (){ }); | 146 new Timer(new Duration(hours: 42), (){ }); |
| 147 break; | 147 break; |
| 148 default: | 148 default: |
| 149 throw "Unknown option ${arguments[0]} passed to test_runner_test"; | 149 throw "Unknown option ${arguments[0]} passed to test_runner_test"; |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 } | 152 } |
| OLD | NEW |