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

Unified Diff: tests/standalone/io/process_working_directory_test.dart

Issue 11091070: Change Process.start to return a future that completes with a (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: tests/standalone/io/process_working_directory_test.dart
diff --git a/tests/standalone/io/process_working_directory_test.dart b/tests/standalone/io/process_working_directory_test.dart
index 55a0ad721bd90f7e35ea29a0eb707860f53fe0a1..52304a6377d79df6c446cafdc8384457ba15474a 100644
--- a/tests/standalone/io/process_working_directory_test.dart
+++ b/tests/standalone/io/process_working_directory_test.dart
@@ -22,20 +22,20 @@ class ProcessWorkingDirectoryTest {
var options = new ProcessOptions();
options.workingDirectory = directory.path;
- Process process = Process.start(fullTestFilePath,
- const ["0", "0", "99", "0"],
- options);
+ Process.start(fullTestFilePath,
+ const ["0", "0", "99", "0"],
+ options).then((process) {
+ process.onExit = (int exitCode) {
+ Expect.equals(exitCode, 99);
+ process.close();
+ directory.deleteSync();
+ };
- process.onExit = (int exitCode) {
- Expect.equals(exitCode, 99);
- process.close();
- directory.deleteSync();
- };
-
- process.onError = (error) {
- Expect.fail("error running process $error");
- directory.deleteSync();
- };
+ process.onError = (error) {
+ Expect.fail("error running process $error");
+ directory.deleteSync();
+ };
+ });
}
static void testInvalidDirectory() {
@@ -44,20 +44,20 @@ class ProcessWorkingDirectoryTest {
var options = new ProcessOptions();
options.workingDirectory = directory.path.concat("/subPath");
- Process process = Process.start(fullTestFilePath,
- const ["0", "0", "99", "0"],
- options);
-
- process.onExit = (int exitCode) {
+ var future = Process.start(fullTestFilePath,
Søren Gjesse 2012/10/12 07:47:22 One could consider writing this with cascades and
Mads Ager (google) 2012/10/12 08:44:46 I actually did a couple of places and removed it a
+ const ["0", "0", "99", "0"],
+ options);
+ future.then((process) {
Expect.fail("bad process completed");
process.close();
directory.deleteSync();
- };
+ });
- process.onError = (error) {
- Expect.isNotNull(error);
+ future.handleException((e) {
+ Expect.isNotNull(e);
directory.deleteSync();
- };
+ return true;
+ });
}
}

Powered by Google App Engine
This is Rietveld 408576698