| OLD | NEW |
| 1 // 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 |
| 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 // Process test program to test process communication. | 5 // Process test program to test process communication. |
| 6 | 6 |
| 7 class ProcessStartExceptionTest { | 7 class ProcessStartExceptionTest { |
| 8 | 8 |
| 9 static void testStartException() { | 9 static void testStartException() { |
| 10 Process process = | 10 Process process = |
| 11 new Process("__path_to_something_that_hopefully_does_not_exist__", | 11 new Process("__path_to_something_that_hopefully_does_not_exist__", |
| 12 const []); | 12 const []); |
| 13 | 13 |
| 14 void exitHandler(int exitCode) { | 14 void exitHandler(int exitCode) { |
| 15 exitHandlerCalled = false; | 15 exitHandlerCalled = false; |
| 16 } | 16 } |
| 17 | 17 |
| 18 process.setExitHandler(exitHandler); | 18 process.exitHandler = exitHandler; |
| 19 try { | 19 try { |
| 20 process.start(); | 20 process.start(); |
| 21 } catch (ProcessException e) { | 21 } catch (ProcessException e) { |
| 22 errorCode = e.errorCode; | 22 errorCode = e.errorCode; |
| 23 } | 23 } |
| 24 } | 24 } |
| 25 | 25 |
| 26 static void testMain() { | 26 static void testMain() { |
| 27 exitHandlerCalled = false; | 27 exitHandlerCalled = false; |
| 28 testStartException(); | 28 testStartException(); |
| 29 Expect.equals(2, errorCode); | 29 Expect.equals(2, errorCode); |
| 30 Expect.equals(false, exitHandlerCalled); | 30 Expect.equals(false, exitHandlerCalled); |
| 31 } | 31 } |
| 32 | 32 |
| 33 static int errorCode; | 33 static int errorCode; |
| 34 static bool exitHandlerCalled; | 34 static bool exitHandlerCalled; |
| 35 } | 35 } |
| 36 | 36 |
| 37 main() { | 37 main() { |
| 38 ProcessStartExceptionTest.testMain(); | 38 ProcessStartExceptionTest.testMain(); |
| 39 } | 39 } |
| OLD | NEW |