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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 new DateTime.now(), [new CustomTestSuite()], | 118 new DateTime.now(), [new CustomTestSuite()], |
119 [new EventListener()], TestController.finished); | 119 [new EventListener()], TestController.finished); |
120 } | 120 } |
121 | 121 |
122 class EventListener extends progress.EventListener{ | 122 class EventListener extends progress.EventListener{ |
123 void done(TestCase test) { | 123 void done(TestCase test) { |
124 TestController.processCompletedTest(test); | 124 TestController.processCompletedTest(test); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 void main() { | 128 void main(List<String> arguments) { |
129 // Run the test_runner_test if there are no command-line options. | 129 // Run the test_runner_test if there are no command-line options. |
130 // Otherwise, run one of the component tests that always pass, | 130 // Otherwise, run one of the component tests that always pass, |
131 // fail, or timeout. | 131 // fail, or timeout. |
132 var arguments = new Options().arguments; | |
133 if (arguments.isEmpty) { | 132 if (arguments.isEmpty) { |
134 testProcessQueue(); | 133 testProcessQueue(); |
135 } else { | 134 } else { |
136 switch (arguments[0]) { | 135 switch (arguments[0]) { |
137 case 'pass': | 136 case 'pass': |
138 return; | 137 return; |
139 case 'fail-unexpected': | 138 case 'fail-unexpected': |
140 case 'fail': | 139 case 'fail': |
141 throw "This test always fails, to test the test scripts."; | 140 throw "This test always fails, to test the test scripts."; |
142 break; | 141 break; |
143 case 'timeout': | 142 case 'timeout': |
144 // Run for 10 seconds, then exit. This tests a 2 second timeout. | 143 // Run for 10 seconds, then exit. This tests a 2 second timeout. |
145 new Timer(new Duration(seconds: 10), (){ }); | 144 new Timer(new Duration(seconds: 10), (){ }); |
146 break; | 145 break; |
147 default: | 146 default: |
148 throw "Unknown option ${arguments[0]} passed to test_runner_test"; | 147 throw "Unknown option ${arguments[0]} passed to test_runner_test"; |
149 } | 148 } |
150 } | 149 } |
151 } | 150 } |
OLD | NEW |