Chromium Code Reviews| 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 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/status_file_parser.dart"; | 9 import "../../../tools/testing/dart/status_file_parser.dart"; |
| 10 import "../../../tools/testing/dart/test_options.dart"; | 10 import "../../../tools/testing/dart/test_options.dart"; |
| 11 import "process_test_util.dart"; | 11 import "process_test_util.dart"; |
| 12 | 12 |
| 13 class TestController { | 13 class TestController { |
| 14 static const int numTests = 4; | 14 static const int numTests = 4; |
| 15 static int numCompletedTests = 0; | 15 static int numCompletedTests = 0; |
| 16 | 16 |
| 17 // Used as TestCase.completedCallback. | 17 // Used as TestCase.completedCallback. |
| 18 static processCompletedTest(TestCase testCase) { | 18 static processCompletedTest(TestCase testCase) { |
| 19 CommandOutput output = testCase.lastCommandOutput; | 19 CommandOutput output = testCase.lastCommandOutput; |
| 20 print("Test: ${testCase.commands.last.commandLine}"); | 20 print("Test: ${testCase.commands.last.commandLine}"); |
| 21 if (output.unexpectedOutput) { | 21 if (output.unexpectedOutput) { |
| 22 throw "Unexpected output: ${output.result}"; | 22 throw "Unexpected output: ${output.result}"; |
| 23 } | 23 } |
| 24 print("stdout: "); | 24 print("stdout: "); |
| 25 for (var line in output.stdout) print(line); | 25 print(new String.fromCharCodes(output.stdout)); |
| 26 print("\n"); | |
|
ricow1
2013/01/10 09:29:43
remove this extra line
kustermann
2013/01/10 09:30:45
Done.
| |
| 26 print("stderr: "); | 27 print("stderr: "); |
| 27 for (var line in output.stderr) print(line); | 28 print(new String.fromCharCodes(output.stderr)); |
| 29 print("\n"); | |
|
ricow1
2013/01/10 09:29:43
remove this extra line
kustermann
2013/01/10 09:30:45
Done.
| |
| 28 | 30 |
| 29 print("Time: ${output.time}"); | 31 print("Time: ${output.time}"); |
| 30 print("Exit code: ${output.exitCode}"); | 32 print("Exit code: ${output.exitCode}"); |
| 31 | 33 |
| 32 ++numCompletedTests; | 34 ++numCompletedTests; |
| 33 print("$numCompletedTests/$numTests"); | 35 print("$numCompletedTests/$numTests"); |
| 34 if (numCompletedTests == numTests) { | 36 if (numCompletedTests == numTests) { |
| 35 print("test_runner_test.dart PASSED"); | 37 print("test_runner_test.dart PASSED"); |
| 36 } | 38 } |
| 37 } | 39 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 break; | 89 break; |
| 88 case 'timeout': | 90 case 'timeout': |
| 89 // Run for 10 seconds, then exit. This tests a 2 second timeout. | 91 // Run for 10 seconds, then exit. This tests a 2 second timeout. |
| 90 new Timer(10 * 1000, (t){ }); | 92 new Timer(10 * 1000, (t){ }); |
| 91 break; | 93 break; |
| 92 default: | 94 default: |
| 93 throw "Unknown option ${arguments[0]} passed to test_runner_test"; | 95 throw "Unknown option ${arguments[0]} passed to test_runner_test"; |
| 94 } | 96 } |
| 95 } | 97 } |
| 96 } | 98 } |
| OLD | NEW |