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

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

Issue 798743004: Add support for starting a detached process (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/io/process_detached_script.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/process_detached_test.dart
diff --git a/tests/standalone/io/process_detached_test.dart b/tests/standalone/io/process_detached_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..483b9ca24dfd9dbe6a1dedbe8c5a332ae794ae3e
--- /dev/null
+++ b/tests/standalone/io/process_detached_test.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Process test program to test detached processes.
+
+import 'dart:async';
+import 'dart:io';
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+import "process_test_util.dart";
+
+void test() {
+ asyncStart();
+ var script =
+ Platform.script.resolve('process_detached_script.dart').toFilePath();
+ var future = Process.start(Platform.executable, [script], detach: true);
+ future.then((process) {
+ print(process.pid);
+ Expect.isNotNull(process.pid);
+ Expect.isTrue(process.pid is int);
+ Expect.isNull(process.exitCode);
+ Expect.isNull(process.stderr);
+ Expect.isNull(process.stdin);
+ Expect.isNull(process.stdout);
+ Expect.isTrue(process.kill());
+ }).whenComplete(() {
+ asyncEnd();
+ });
+}
+
+void testFailure() {
+ asyncStart();
+ Directory.systemTemp.createTemp('dart_detached_process').then((temp) {
+ var future = Process.start(temp.path, ['a', 'b'], detach: true);
+ future.then((process) {
+ Expect.fail('Starting process from invalid executable succeeded');
+ }, onError: (e) {
+ Expect.isTrue(e is ProcessException);
+ }).whenComplete(() {
+ temp.deleteSync();
+ asyncEnd();
+ });
+ });
+}
+
+main() {
+ test();
+ testFailure();
+}
« no previous file with comments | « tests/standalone/io/process_detached_script.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698