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

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

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
11 class ProcessWorkingDirectoryTest { 11 class ProcessWorkingDirectoryTest {
12 static String get fullTestFilePath { 12 static String get fullTestFilePath {
13 // Extract full path, since we run processes from another directory. 13 // Extract full path, since we run processes from another directory.
14 File path = new File(getProcessTestFileName()); 14 File path = new File(getProcessTestFileName());
15 Expect.isTrue(path.existsSync()); 15 Expect.isTrue(path.existsSync());
16 return path.fullPathSync(); 16 return path.fullPathSync();
17 } 17 }
18 18
19 static void testValidDirectory() { 19 static void testValidDirectory() {
20 Directory directory = new Directory("").createTempSync(); 20 Directory directory = new Directory("").createTempSync();
21 Expect.isTrue(directory.existsSync()); 21 Expect.isTrue(directory.existsSync());
22 22
23 var options = new ProcessOptions(); 23 var options = new ProcessOptions();
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.exitCode.then((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.listen((_) {});
33 process.stderr.onData = process.stderr.read; 33 process.stderr.listen((_) {});
34 }).catchError((error) { 34 }).catchError((error) {
35 directory.deleteSync(); 35 directory.deleteSync();
36 Expect.fail("Couldn't start process"); 36 Expect.fail("Couldn't start process");
37 }); 37 });
38 } 38 }
39 39
40 static void testInvalidDirectory() { 40 static void testInvalidDirectory() {
41 Directory directory = new Directory("").createTempSync(); 41 Directory directory = new Directory("").createTempSync();
42 Expect.isTrue(directory.existsSync()); 42 Expect.isTrue(directory.existsSync());
43 43
(...skipping 11 matching lines...) Expand all
55 }); 55 });
56 } 56 }
57 } 57 }
58 58
59 59
60 60
61 main() { 61 main() {
62 ProcessWorkingDirectoryTest.testValidDirectory(); 62 ProcessWorkingDirectoryTest.testValidDirectory();
63 ProcessWorkingDirectoryTest.testInvalidDirectory(); 63 ProcessWorkingDirectoryTest.testInvalidDirectory();
64 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698