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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/process.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // 4 //
5 // Process test program to test process communication. 5 // Process test program to test process communication.
6 6
7 library ProcessKillTest; 7 library ProcessKillTest;
8
9 import 'dart:io';
10
11 import "package:async_helper/async_helper.dart";
8 import "package:expect/expect.dart"; 12 import "package:expect/expect.dart";
9 import "dart:io"; 13
10 import "process_test_util.dart"; 14 import "process_test_util.dart";
11 15
12 testKill() { 16 testKill() {
17 asyncStart();
13 // Start a process that will hang waiting for input until killed. 18 // Start a process that will hang waiting for input until killed.
14 Process.start(getProcessTestFileName(), const ["0", "1", "0", "0"]).then((p) { 19 Process.start(getProcessTestFileName(), const ["0", "1", "0", "0"]).then((p) {
15 p.exitCode.then((exitCode) { 20 p.exitCode.then((exitCode) {
16 // Process killed from the side so exit code is not 0. 21 // Process killed from the side so exit code is not 0.
17 Expect.isTrue(exitCode != 0); 22 Expect.isTrue(exitCode != 0);
18 // Killing a process that is already dead returns false. 23 // Killing a process that is already dead returns false.
19 Expect.isFalse(p.kill()); 24 Expect.isFalse(p.kill());
25 asyncEnd();
20 }); 26 });
21 Expect.isTrue(p.kill()); 27 Expect.isTrue(p.kill());
22 }); 28 });
23 } 29 }
24 30
31 testKillPid() {
32 asyncStart();
33 // Start a process that will hang waiting for input until killed.
34 Process.start(getProcessTestFileName(), const ["0", "1", "0", "0"]).then((p) {
35 p.exitCode.then((exitCode) {
36 // Process killed from the side so exit code is not 0.
37 Expect.isTrue(exitCode != 0);
38 // Killing a process that is already dead returns false.
39 Expect.isFalse(Process.killPid(p.pid));
40 asyncEnd();
41 });
42 Expect.isTrue(Process.killPid(p.pid));
43 });
44 }
45
25 main() { 46 main() {
26 testKill(); 47 testKill();
48 testKillPid();
27 } 49 }
OLDNEW
« 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