| 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"; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 enqueueTestCase(testCaseFail); | 64 enqueueTestCase(testCaseFail); |
| 65 enqueueTestCase(testCaseTimeout); | 65 enqueueTestCase(testCaseTimeout); |
| 66 enqueueTestCase(testCaseFailUnexpected); | 66 enqueueTestCase(testCaseFailUnexpected); |
| 67 | 67 |
| 68 if (onDone != null) { | 68 if (onDone != null) { |
| 69 onDone(); | 69 onDone(); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 TestCase _makeNormalTestCase(name, expectations) { | 73 TestCase _makeNormalTestCase(name, expectations) { |
| 74 var command = new Command(new Options().executable, | 74 var command = new Command(Platform.executable, |
| 75 [new Options().script, name]); | 75 [Platform.script, name]); |
| 76 return _makeTestCase(name, DEFAULT_TIMEOUT, command, expectations); | 76 return _makeTestCase(name, DEFAULT_TIMEOUT, command, expectations); |
| 77 } | 77 } |
| 78 | 78 |
| 79 _makeCrashTestCase(name, expectations) { | 79 _makeCrashTestCase(name, expectations) { |
| 80 var crashCommand = new Command(getProcessTestFileName(), | 80 var crashCommand = new Command(getProcessTestFileName(), |
| 81 ["0", "0", "1", "1"]); | 81 ["0", "0", "1", "1"]); |
| 82 // The crash test sometimes times out. Run it with a large timeout | 82 // The crash test sometimes times out. Run it with a large timeout |
| 83 // to help diagnose the delay. | 83 // to help diagnose the delay. |
| 84 // The test loads a new executable, which may sometimes take a long time. | 84 // The test loads a new executable, which may sometimes take a long time. |
| 85 // It involves a wait on the VM event loop, and possible system | 85 // It involves a wait on the VM event loop, and possible system |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 var maxProcesses = 2; | 102 var maxProcesses = 2; |
| 103 var maxBrowserProcesses = maxProcesses; | 103 var maxBrowserProcesses = maxProcesses; |
| 104 new ProcessQueue(maxProcesses, maxBrowserProcesses, | 104 new ProcessQueue(maxProcesses, maxBrowserProcesses, |
| 105 new DateTime.now(), [new CustomTestSuite()], [], TestController.finished); | 105 new DateTime.now(), [new CustomTestSuite()], [], TestController.finished); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void main() { | 108 void main() { |
| 109 // Run the test_runner_test if there are no command-line options. | 109 // Run the test_runner_test if there are no command-line options. |
| 110 // Otherwise, run one of the component tests that always pass, | 110 // Otherwise, run one of the component tests that always pass, |
| 111 // fail, or timeout. | 111 // fail, or timeout. |
| 112 var arguments = new Options().arguments; | 112 var arguments = Platform.arguments; |
| 113 if (arguments.isEmpty) { | 113 if (arguments.isEmpty) { |
| 114 testProcessQueue(); | 114 testProcessQueue(); |
| 115 } else { | 115 } else { |
| 116 switch (arguments[0]) { | 116 switch (arguments[0]) { |
| 117 case 'pass': | 117 case 'pass': |
| 118 return; | 118 return; |
| 119 case 'fail-unexpected': | 119 case 'fail-unexpected': |
| 120 case 'fail': | 120 case 'fail': |
| 121 throw "This test always fails, to test the test scripts."; | 121 throw "This test always fails, to test the test scripts."; |
| 122 break; | 122 break; |
| 123 case 'timeout': | 123 case 'timeout': |
| 124 // Run for 10 seconds, then exit. This tests a 2 second timeout. | 124 // Run for 10 seconds, then exit. This tests a 2 second timeout. |
| 125 new Timer(new Duration(seconds: 10), (){ }); | 125 new Timer(new Duration(seconds: 10), (){ }); |
| 126 break; | 126 break; |
| 127 default: | 127 default: |
| 128 throw "Unknown option ${arguments[0]} passed to test_runner_test"; | 128 throw "Unknown option ${arguments[0]} passed to test_runner_test"; |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 } | 131 } |
| OLD | NEW |