| 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 "dart:utf"; | 8 import "dart:utf"; |
| 9 import "../../../tools/testing/dart/test_runner.dart"; | 9 import "../../../tools/testing/dart/test_runner.dart"; |
| 10 import "../../../tools/testing/dart/test_suite.dart"; | 10 import "../../../tools/testing/dart/test_suite.dart"; |
| 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 CommandOutput output = testCase.lastCommandOutput; | |
| 26 if (testCase.displayName == "fail-unexpected") { | 25 if (testCase.displayName == "fail-unexpected") { |
| 27 if (!output.unexpectedOutput) { | 26 if (!testCase.unexpectedOutput) { |
| 28 throw "Expected fail-unexpected"; | 27 throw "Expected fail-unexpected"; |
| 29 } | 28 } |
| 30 } else { | 29 } else { |
| 31 if (output.unexpectedOutput) { | 30 if (testCase.unexpectedOutput) { |
| 32 throw "Unexpected fail"; | 31 throw "Unexpected fail"; |
| 33 } | 32 } |
| 34 } | 33 } |
| 35 } | 34 } |
| 36 | 35 |
| 37 static void finished() { | 36 static void finished() { |
| 38 if (numTests != numCompletedTests) { | 37 if (numTests != numCompletedTests) { |
| 39 throw "bad completion count. " | 38 throw "bad completion count. " |
| 40 "expected: $numTests, actual: $numCompletedTests"; | 39 "expected: $numTests, actual: $numCompletedTests"; |
| 41 } | 40 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 break; | 123 break; |
| 125 case 'timeout': | 124 case 'timeout': |
| 126 // Run for 10 seconds, then exit. This tests a 2 second timeout. | 125 // Run for 10 seconds, then exit. This tests a 2 second timeout. |
| 127 new Timer(new Duration(seconds: 10), (){ }); | 126 new Timer(new Duration(seconds: 10), (){ }); |
| 128 break; | 127 break; |
| 129 default: | 128 default: |
| 130 throw "Unknown option ${arguments[0]} passed to test_runner_test"; | 129 throw "Unknown option ${arguments[0]} passed to test_runner_test"; |
| 131 } | 130 } |
| 132 } | 131 } |
| 133 } | 132 } |
| OLD | NEW |