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

Side by Side Diff: tests/standalone/io/process_working_directory_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 working directory test. 5 // Process working directory test.
6 6
7 library ProcessWorkingDirectoryTest; 7 library ProcessWorkingDirectoryTest;
8 import "dart:io"; 8 import "dart:io";
9 import "process_test_util.dart"; 9 import "process_test_util.dart";
10 10
(...skipping 13 matching lines...) Expand all
24 options.workingDirectory = directory.path; 24 options.workingDirectory = directory.path;
25 var processFuture = 25 var processFuture =
26 Process.start(fullTestFilePath, const ["0", "0", "99", "0"], options); 26 Process.start(fullTestFilePath, const ["0", "0", "99", "0"], options);
27 processFuture.then((process) { 27 processFuture.then((process) {
28 process.onExit = (int exitCode) { 28 process.onExit = (int exitCode) {
29 Expect.equals(exitCode, 99); 29 Expect.equals(exitCode, 99);
30 directory.deleteSync(); 30 directory.deleteSync();
31 }; 31 };
32 process.stdout.onData = process.stdout.read; 32 process.stdout.onData = process.stdout.read;
33 process.stderr.onData = process.stderr.read; 33 process.stderr.onData = process.stderr.read;
34 }); 34 }).catchError((error) {
35 processFuture.handleException((error) {
36 directory.deleteSync(); 35 directory.deleteSync();
37 Expect.fail("Couldn't start process"); 36 Expect.fail("Couldn't start process");
38 }); 37 });
39 } 38 }
40 39
41 static void testInvalidDirectory() { 40 static void testInvalidDirectory() {
42 Directory directory = new Directory("").createTempSync(); 41 Directory directory = new Directory("").createTempSync();
43 Expect.isTrue(directory.existsSync()); 42 Expect.isTrue(directory.existsSync());
44 43
45 var options = new ProcessOptions(); 44 var options = new ProcessOptions();
46 options.workingDirectory = directory.path.concat("/subPath"); 45 options.workingDirectory = directory.path.concat("/subPath");
47 var future = Process.start(fullTestFilePath, 46 var future = Process.start(fullTestFilePath,
48 const ["0", "0", "99", "0"], 47 const ["0", "0", "99", "0"],
49 options); 48 options);
50 future.then((process) { 49 future.then((process) {
51 Expect.fail("bad process completed"); 50 Expect.fail("bad process completed");
52 directory.deleteSync(); 51 directory.deleteSync();
53 }); 52 }).catchError((e) {
54
55 future.handleException((e) {
56 Expect.isNotNull(e); 53 Expect.isNotNull(e);
57 directory.deleteSync(); 54 directory.deleteSync();
58 return true;
59 }); 55 });
60 } 56 }
61 } 57 }
62 58
63 59
64 60
65 main() { 61 main() {
66 ProcessWorkingDirectoryTest.testValidDirectory(); 62 ProcessWorkingDirectoryTest.testValidDirectory();
67 ProcessWorkingDirectoryTest.testInvalidDirectory(); 63 ProcessWorkingDirectoryTest.testInvalidDirectory();
68 } 64 }
OLDNEW
« no previous file with comments | « tests/standalone/io/process_stdout_test.dart ('k') | tests/standalone/io/regress_7097_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698