OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Simulates a use of test_progress during a failing run of test.dart. | 5 // Simulates a use of test_progress during a failing run of test.dart. |
6 | 6 |
7 import "dart:io"; | 7 import "dart:io"; |
8 import "../../../tools/testing/dart/test_progress.dart"; | 8 import "../../../tools/testing/dart/test_progress.dart"; |
9 import "../../../tools/testing/dart/test_runner.dart"; | 9 import "../../../tools/testing/dart/test_runner.dart"; |
10 import "../../../tools/testing/dart/test_options.dart"; | 10 import "../../../tools/testing/dart/test_options.dart"; |
11 | 11 |
12 main() { | 12 main(List<String> arguments) { |
13 var progressType = new Options().arguments[0]; | 13 var progressType = arguments[0]; |
14 // Build a progress indicator. | 14 // Build a progress indicator. |
15 var startTime = new DateTime.now(); | 15 var startTime = new DateTime.now(); |
16 var progress = | 16 var progress = |
17 new ProgressIndicator.fromName(progressType, startTime, false); | 17 new ProgressIndicator.fromName(progressType, startTime, false); |
18 if (progressType == 'buildbot') { | 18 if (progressType == 'buildbot') { |
19 BuildbotProgressIndicator.stepName = 'myStepName'; | 19 BuildbotProgressIndicator.stepName = 'myStepName'; |
20 } | 20 } |
21 // Build a dummy test case. | 21 // Build a dummy test case. |
22 var configuration = new TestOptionsParser().parse(['--timeout', '2'])[0]; | 22 var configuration = new TestOptionsParser().parse(['--timeout', '2'])[0]; |
23 var dummyCommand = new Command("noop", []); | 23 var dummyCommand = new Command("noop", []); |
24 var testCase = new TestCase('failing_test.dart', | 24 var testCase = new TestCase('failing_test.dart', |
25 [dummyCommand], | 25 [dummyCommand], |
26 configuration, | 26 configuration, |
27 (_) => null, | 27 (_) => null, |
28 new Set<String>.from(['PASS'])); | 28 new Set<String>.from(['PASS'])); |
29 | 29 |
30 // Simulate the test.dart use of the progress indicator. | 30 // Simulate the test.dart use of the progress indicator. |
31 progress.testAdded(); | 31 progress.testAdded(); |
32 progress.allTestsKnown(); | 32 progress.allTestsKnown(); |
33 progress.start(testCase); | 33 progress.start(testCase); |
34 new CommandOutput.fromCase(testCase, dummyCommand, 1, false, false, [], [], | 34 new CommandOutput.fromCase(testCase, dummyCommand, 1, false, false, [], [], |
35 new DateTime.now().difference(startTime), false); | 35 new DateTime.now().difference(startTime), false); |
36 progress.done(testCase); | 36 progress.done(testCase); |
37 progress.allDone(); | 37 progress.allDone(); |
38 } | 38 } |
OLD | NEW |