Chromium Code Reviews| Index: tests/standalone/io/signals_test.dart |
| diff --git a/tests/standalone/io/signals_test.dart b/tests/standalone/io/signals_test.dart |
| index 00805a5e5bf9c5bc1179947a263abbda7be0ab3b..f138f319d4709357bb5d8c97ab47942c8831c40a 100644 |
| --- a/tests/standalone/io/signals_test.dart |
| +++ b/tests/standalone/io/signals_test.dart |
| @@ -3,6 +3,7 @@ |
| // BSD-style license that can be found in the LICENSE file. |
| import "dart:io"; |
| +import "dart:convert"; |
| import "package:expect/expect.dart"; |
| import "package:async_helper/async_helper.dart"; |
| @@ -42,6 +43,32 @@ void testSignals(int usr1Expect, |
| }); |
| } |
| +void testSignal(ProcessSignal signal) { |
| + asyncStart(); |
| + Process.start(Platform.executable, |
| + [Platform.script.resolve('signal_test_script.dart').toFilePath(), |
| + signal.toString()]) |
| + .then((process) { |
| + process.stdin.close(); |
| + process.stderr.transform(UTF8.decoder).listen(print); |
|
Søren Gjesse
2014/02/13 10:54:27
Debug print?
Anders Johnsen
2014/02/13 12:08:03
Done.
|
| + |
| + var output = ""; |
| + process.stdout.transform(UTF8.decoder) |
| + .listen((str) { |
| + output += str; |
| + if (output == 'ready\n') { |
| + process.kill(signal); |
| + } |
| + }, onDone: () { |
| + Expect.equals('ready\ngot signal\n', output); |
| + }); |
| + process.exitCode.then((exitCode) { |
| + Expect.equals(0, exitCode); |
| + asyncEnd(); |
| + }); |
| + }); |
| +} |
| + |
| void testListenCancel() { |
| for (int i = 0; i < 10; i++) { |
| @@ -61,4 +88,11 @@ void main() { |
| testSignals(1, 10); |
| testSignals(1, 0, 0, 1, true); |
| testSignals(0, 1, 1, 0, true); |
| + |
|
Søren Gjesse
2014/02/13 10:54:27
Don't you need to skip some of these on Windows?
Anders Johnsen
2014/02/13 12:08:03
Already filtered out, see 10 lines above.
|
| + testSignal(ProcessSignal.SIGHUP); |
| + testSignal(ProcessSignal.SIGINT); |
| + testSignal(ProcessSignal.SIGTERM); |
| + testSignal(ProcessSignal.SIGUSR1); |
| + testSignal(ProcessSignal.SIGUSR2); |
| + testSignal(ProcessSignal.SIGWINCH); |
| } |