| OLD | NEW |
| 1 | |
| 2 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 3 // 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 |
| 4 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 5 | 4 |
| 6 #library("TestRunnerTest"); | 5 #library("TestRunnerTest"); |
| 7 | 6 |
| 8 | |
| 9 #import("../../../tools/testing/dart/test_runner.dart"); | 7 #import("../../../tools/testing/dart/test_runner.dart"); |
| 10 | 8 |
| 11 // TODO(whesse) source("ProcessTestUtil.dart"); when it is committed. | 9 // TODO(whesse) source("ProcessTestUtil.dart"); when it is committed. |
| 12 | 10 |
| 13 class TestController { | 11 class TestController { |
| 14 static final int numTests = 4; | 12 static final int numTests = 4; |
| 15 static int numCompletedTests = 0; | 13 static int numCompletedTests = 0; |
| 16 | 14 |
| 17 // Used as TestCase.completedCallback. | 15 // Used as TestCase.completedCallback. |
| 18 static processCompletedTest(TestCase testCase) { | 16 static processCompletedTest(TestCase testCase) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 'Debug_ia32/process_test.exe']; | 60 'Debug_ia32/process_test.exe']; |
| 63 for (var name in names) { | 61 for (var name in names) { |
| 64 if (new File(name).existsSync()) { | 62 if (new File(name).existsSync()) { |
| 65 return name; | 63 return name; |
| 66 } | 64 } |
| 67 } | 65 } |
| 68 Expect.fail('Could not find the process_test program.'); | 66 Expect.fail('Could not find the process_test program.'); |
| 69 } | 67 } |
| 70 | 68 |
| 71 void main() { | 69 void main() { |
| 72 int timeout = 1; | 70 int timeout = 2; |
| 73 new RunningProcess(MakeTestCase("PassTest", [PASS]), timeout).start(); | 71 new RunningProcess(MakeTestCase("PassTest", [PASS]), timeout).start(); |
| 74 new RunningProcess(MakeTestCase("FailTest", [FAIL]), timeout).start(); | 72 new RunningProcess(MakeTestCase("FailTest", [FAIL]), timeout).start(); |
| 75 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), timeout).start(); | 73 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT]), timeout).start(); |
| 76 | 74 |
| 77 new RunningProcess(new TestCase("CrashTest", | 75 new RunningProcess(new TestCase("CrashTest", |
| 78 getProcessTestFileName(), | 76 getProcessTestFileName(), |
| 79 const ["0", "0", "1", "1"], | 77 const ["0", "0", "1", "1"], |
| 80 TestController.processCompletedTest, | 78 TestController.processCompletedTest, |
| 81 new Set<String>.from([CRASH])), | 79 new Set<String>.from([CRASH])), |
| 82 timeout).start(); | 80 timeout).start(); |
| 83 Expect.equals(4, TestController.numTests); | 81 Expect.equals(4, TestController.numTests); |
| 84 // Throw must be from body of start() function for this test to work. | 82 // Throw must be from body of start() function for this test to work. |
| 85 Expect.throws( | 83 Expect.throws( |
| 86 new RunningProcess(MakeTestCase("PassTest", [SKIP]), timeout).start); | 84 new RunningProcess(MakeTestCase("PassTest", [SKIP]), timeout).start); |
| 87 } | 85 } |
| 88 | 86 |
| OLD | NEW |