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

Unified Diff: tests/standalone/io/dart_std_io_pipe_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/dart_std_io_pipe_test.dart
diff --git a/tests/standalone/io/dart_std_io_pipe_test.dart b/tests/standalone/io/dart_std_io_pipe_test.dart
index 95019e5b535a65e24cda81d1fdc0a7ee5d86adbe..50c7a4616b7db9c7dbccf25c1510465a19288e0d 100644
--- a/tests/standalone/io/dart_std_io_pipe_test.dart
+++ b/tests/standalone/io/dart_std_io_pipe_test.dart
@@ -40,39 +40,38 @@ void test(String shellScript, String dartScript, String type) {
String executable = new Options().executable;
List args =
[executable, dartScript, type, pipeOutFile, redirectOutFile];
- Process process = Process.start(shellScript, args);
+ var future = Process.start(shellScript, args);
+ future.then((process) {
+ process.onExit = (exitCode) {
+ Expect.equals(0, exitCode);
+ process.close();
- // Wait for the process to exit and then check result.
- process.onExit = (exitCode) {
- Expect.equals(0, exitCode);
- process.close();
+ // Check the expected file contents.
+ if (type == "0") {
+ checkFileContent("${pipeOutFile}", "Hello\n");
+ checkFileEmpty("${redirectOutFile}.stderr");
+ checkFileContent("${redirectOutFile}.stdout", "Hello\nHello\n");
+ }
+ if (type == "1") {
+ checkFileContent("${pipeOutFile}", "Hello\n");
+ checkFileEmpty("${redirectOutFile}.stdout");
+ checkFileContent("${redirectOutFile}.stderr", "Hello\nHello\n");
+ }
+ if (type == "2") {
+ checkFileContent("${pipeOutFile}", "Hello\nHello\n");
+ checkFileContent("${redirectOutFile}.stdout",
+ "Hello\nHello\nHello\nHello\n");
+ checkFileContent("${redirectOutFile}.stderr",
+ "Hello\nHello\nHello\nHello\n");
+ }
- // Check the expected file contents.
- if (type == "0") {
- checkFileContent("${pipeOutFile}", "Hello\n");
- checkFileEmpty("${redirectOutFile}.stderr");
- checkFileContent("${redirectOutFile}.stdout", "Hello\nHello\n");
- }
- if (type == "1") {
- checkFileContent("${pipeOutFile}", "Hello\n");
- checkFileEmpty("${redirectOutFile}.stdout");
- checkFileContent("${redirectOutFile}.stderr", "Hello\nHello\n");
- }
- if (type == "2") {
- checkFileContent("${pipeOutFile}", "Hello\nHello\n");
- checkFileContent("${redirectOutFile}.stdout",
- "Hello\nHello\nHello\nHello\n");
- checkFileContent("${redirectOutFile}.stderr",
- "Hello\nHello\nHello\nHello\n");
- }
-
- // Cleanup test directory.
- dir.deleteRecursivelySync();
- };
-
- process.onError = (ProcessException error) {
+ // Cleanup test directory.
+ dir.deleteRecursivelySync();
+ };
+ });
+ future.handleException((ProcessException error) {
Expect.fail(error.toString());
ricow1 2012/10/11 17:27:34 we should probably do a dir.deleteRecursivelySync(
Mads Ager (google) 2012/10/12 08:44:46 Done for this particular test. I'm pretty sure tha
- };
+ });
}
// This tests that the Dart standalone VM can handle piping to stdin

Powered by Google App Engine
This is Rietveld 408576698