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

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: Restructure to get rid of _onStart and _onError 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
« no previous file with comments | « tests/standalone/io/process_stdout_test.dart ('k') | tools/testing/dart/co19_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1255518b0b523e9f982302a6c1c8b48347178dce 100644
--- a/tests/standalone/io/process_working_directory_test.dart
+++ b/tests/standalone/io/process_working_directory_test.dart
@@ -22,20 +22,19 @@ class ProcessWorkingDirectoryTest {
var options = new ProcessOptions();
options.workingDirectory = directory.path;
- Process process = Process.start(fullTestFilePath,
- const ["0", "0", "99", "0"],
- options);
-
- process.onExit = (int exitCode) {
- Expect.equals(exitCode, 99);
- process.close();
+ var processFuture =
+ Process.start(fullTestFilePath, const ["0", "0", "99", "0"], options);
+ processFuture.then((process) {
+ process.onExit = (int exitCode) {
+ Expect.equals(exitCode, 99);
+ process.close();
+ directory.deleteSync();
+ };
+ });
+ processFuture.handleException((error) {
directory.deleteSync();
- };
-
- process.onError = (error) {
- Expect.fail("error running process $error");
- directory.deleteSync();
- };
+ Expect.fails("Couldn't start process");
+ });
}
static void testInvalidDirectory() {
@@ -44,20 +43,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,
+ 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;
+ });
}
}
« no previous file with comments | « tests/standalone/io/process_stdout_test.dart ('k') | tools/testing/dart/co19_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698