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

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

Issue 9108008: Add optional workingDirectory argument to Process.start. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 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
« no previous file with comments | « runtime/bin/process_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 //
5 // Process working directory test.
6
7 #library("ProcessWorkingDirectoryTest");
8 #source("ProcessTestUtil.dart");
9
10 class ProcessWorkingDirectoryTest {
11 static String get fullTestFilePath() {
12 // Extract full path, since we run processes from another directory.
13 File path = new File(getProcessTestFileName());
14 Expect.isTrue(path.existsSync());
15 return path.fullPathSync();
16 }
17
18 static void testValidDirectory() {
19 Directory directory = new Directory("");
20 directory.createTempSync();
21 Expect.isTrue(directory.existsSync());
22
23 print(fullTestFilePath);
Mads Ager (google) 2012/01/05 10:09:21 Please remove this debug print.
24
25 Process process = new Process.start(fullTestFilePath,
26 const ["0", "0", "99", "0"],
27 directory.path);
28
29 process.exitHandler = (int exitCode) {
30 Expect.equals(exitCode, 99);
31 process.close();
32 directory.deleteSync();
33 };
34
35 process.errorHandler = (error) {
36 Expect.fail("error running process $error");
37 directory.deleteSync();
38 };
39 }
40
41 static void testInvalidDirectory() {
42 Directory directory = new Directory("");
43 directory.createTempSync();
44 Expect.isTrue(directory.existsSync());
45
46 Process process = new Process.start(fullTestFilePath,
47 const ["0", "0", "99", "0"],
48 directory.path + "/subPath");
49
50 process.exitHandler = (int exitCode) {
51 Expect.fail("bad process completed");
52 process.close();
53 directory.deleteSync();
54 };
55
56 process.errorHandler = (error) {
57 Expect.isNotNull(error);
58 directory.deleteSync();
59 };
60 }
61 }
62
63
64
65 main() {
66 ProcessWorkingDirectoryTest.testValidDirectory();
67 ProcessWorkingDirectoryTest.testInvalidDirectory();
68 }
OLDNEW
« no previous file with comments | « runtime/bin/process_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698