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

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

Issue 895623002: Add support for killing a process with a given PID to dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 5 years, 10 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 | « sdk/lib/io/process.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_kill_test.dart
diff --git a/tests/standalone/io/process_kill_test.dart b/tests/standalone/io/process_kill_test.dart
index 673933649893dc9e0a3021218ae8b7cd8be36a9b..9816d41115a61e27e7d695a05452031f972fb52e 100644
--- a/tests/standalone/io/process_kill_test.dart
+++ b/tests/standalone/io/process_kill_test.dart
@@ -5,11 +5,16 @@
// Process test program to test process communication.
library ProcessKillTest;
+
+import 'dart:io';
+
+import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";
-import "dart:io";
+
import "process_test_util.dart";
testKill() {
+ asyncStart();
// Start a process that will hang waiting for input until killed.
Process.start(getProcessTestFileName(), const ["0", "1", "0", "0"]).then((p) {
p.exitCode.then((exitCode) {
@@ -17,11 +22,28 @@ testKill() {
Expect.isTrue(exitCode != 0);
// Killing a process that is already dead returns false.
Expect.isFalse(p.kill());
+ asyncEnd();
});
Expect.isTrue(p.kill());
});
}
+testKillPid() {
+ asyncStart();
+ // Start a process that will hang waiting for input until killed.
+ Process.start(getProcessTestFileName(), const ["0", "1", "0", "0"]).then((p) {
+ p.exitCode.then((exitCode) {
+ // Process killed from the side so exit code is not 0.
+ Expect.isTrue(exitCode != 0);
+ // Killing a process that is already dead returns false.
+ Expect.isFalse(Process.killPid(p.pid));
+ asyncEnd();
+ });
+ Expect.isTrue(Process.killPid(p.pid));
+ });
+}
+
main() {
testKill();
+ testKillPid();
}
« no previous file with comments | « sdk/lib/io/process.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698