Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(877)

Side by Side Diff: tests/standalone/src/ProcessStartExceptionTest.dart

Issue 9024008: Change the process API to be completely asynchronous. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Presubmit fixes Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 testStartError() {
10 Process process = 10 Process process =
11 new Process("__path_to_something_that_hopefully_does_not_exist__", 11 new Process.start("__path_to_something_that_should_not_exist__",
12 const []); 12 const []);
13 13
14 void exitHandler(int exitCode) { 14 process.exitHandler = (int exitCode) {
15 exitHandlerCalled = false; 15 Expect.fail("exit handler called");
16 } 16 };
17 17
18 process.exitHandler = exitHandler; 18 process.errorHandler = (ProcessException e) {
19 try { 19 Expect.equals(2, e.errorCode);
20 process.start(); 20 };
21 } catch (ProcessException e) {
22 errorCode = e.errorCode;
23 }
24 } 21 }
25 22
26 static void testMain() { 23 static void testMain() {
27 exitHandlerCalled = false; 24 testStartError();
28 testStartException();
29 Expect.equals(2, errorCode);
30 Expect.equals(false, exitHandlerCalled);
31 } 25 }
32
33 static int errorCode;
34 static bool exitHandlerCalled;
35 } 26 }
36 27
37 main() { 28 main() {
38 ProcessStartExceptionTest.testMain(); 29 ProcessStartExceptionTest.testMain();
Søren Gjesse 2011/12/22 12:49:28 Maybe just ProcessStartExceptionTest.testStartErr
Mads Ager (google) 2011/12/22 12:56:13 Done.
39 } 30 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698