| 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; |
| 11 import "../../../tools/testing/dart/status_file_parser.dart"; | 11 import "../../../tools/testing/dart/status_file_parser.dart"; |
| 12 import "../../../tools/testing/dart/test_options.dart"; | 12 import "../../../tools/testing/dart/test_options.dart"; |
| 13 import "process_test_util.dart"; | 13 import "process_test_util.dart"; |
| 14 | 14 |
| 15 final DEFAULT_TIMEOUT = 2; | 15 final DEFAULT_TIMEOUT = 2; |
| 16 final LONG_TIMEOUT = 30; | 16 final LONG_TIMEOUT = 30; |
| 17 | 17 |
| 18 class TestController { | 18 class TestController { |
| 19 static int numTests = 0; | 19 static int numTests = 0; |
| 20 static int numCompletedTests = 0; | 20 static int numCompletedTests = 0; |
| 21 | 21 |
| 22 // Used as TestCase.completedCallback. | 22 // Used as TestCase.completedCallback. |
| 23 static processCompletedTest(TestCase testCase) { | 23 static processCompletedTest(TestCase testCase) { |
| 24 numCompletedTests++; | 24 numCompletedTests++; |
| 25 if (testCase.displayName == "fail-unexpected") { | 25 if (testCase.displayName == "fail-unexpected") { |
| 26 if (!testCase.unexpectedOutput) { | 26 if (!testCase.unexpectedOutput) { |
| 27 throw "Expected fail-unexpected"; | 27 var stdout = |
| 28 new String.fromCharCodes(testCase.lastCommandOutput.stdout); |
| 29 var stderr = |
| 30 new String.fromCharCodes(testCase.lastCommandOutput.stderr); |
| 31 print("stdout = [$stdout]"); |
| 32 print("stderr = [$stderr]"); |
| 33 throw "Expected fail-unexpected: ${testCase.result}"; |
| 28 } | 34 } |
| 29 } else { | 35 } else { |
| 30 if (testCase.unexpectedOutput) { | 36 if (testCase.unexpectedOutput) { |
| 37 var stdout = |
| 38 new String.fromCharCodes(testCase.lastCommandOutput.stdout); |
| 39 var stderr = |
| 40 new String.fromCharCodes(testCase.lastCommandOutput.stderr); |
| 41 print("stdout = [$stdout]"); |
| 42 print("stderr = [$stderr]"); |
| 31 throw "Unexpected fail"; | 43 throw "Unexpected fail"; |
| 32 } | 44 } |
| 33 } | 45 } |
| 34 } | 46 } |
| 35 | 47 |
| 36 static void finished() { | 48 static void finished() { |
| 37 if (numTests != numCompletedTests) { | 49 if (numTests != numCompletedTests) { |
| 38 throw "bad completion count. " | 50 throw "bad completion count. " |
| 39 "expected: $numTests, actual: $numCompletedTests"; | 51 "expected: $numTests, actual: $numCompletedTests"; |
| 40 } | 52 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 break; | 141 break; |
| 130 case 'timeout': | 142 case 'timeout': |
| 131 // 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. |
| 132 new Timer(new Duration(seconds: 10), (){ }); | 144 new Timer(new Duration(seconds: 10), (){ }); |
| 133 break; | 145 break; |
| 134 default: | 146 default: |
| 135 throw "Unknown option ${arguments[0]} passed to test_runner_test"; | 147 throw "Unknown option ${arguments[0]} passed to test_runner_test"; |
| 136 } | 148 } |
| 137 } | 149 } |
| 138 } | 150 } |
| OLD | NEW |