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

Unified Diff: tests/isolate/kill_test.dart

Issue 190013005: Add Isolate.kill(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test kill2_test Created 6 years, 8 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/isolate/kill_self_test.dart ('k') | tests/isolate/ping_pause_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/kill_test.dart
diff --git a/tests/isolate/ping_pause_test.dart b/tests/isolate/kill_test.dart
similarity index 60%
copy from tests/isolate/ping_pause_test.dart
copy to tests/isolate/kill_test.dart
index 11fa951f0af29a4ba4ac2dba37ffd4eab5a0f3e5..d0da5abc6c29634777d8fcbd156f6fddfb80341e 100644
--- a/tests/isolate/ping_pause_test.dart
+++ b/tests/isolate/kill_test.dart
@@ -21,29 +21,24 @@ void main() {
var completer = new Completer(); // Completed by first reply from isolate.
RawReceivePort reply = new RawReceivePort(completer.complete);
Isolate.spawn(isomain1, reply.sendPort).then((Isolate isolate) {
- List result = [];
- completer.future.then((echoPort) {
+ completer.future.then((SendPort echoPort) {
+ List result = [];
reply.handler = (v) {
result.add(v);
- if (v == 0) {
- Expect.listEquals([4, 3, 2, 1, 0], result);
- reply.close();
- asyncEnd();
+ if (v == 2) {
+ isolate.kill(Isolate.IMMEDIATE);
}
+ echoPort.send(v - 1);
};
+ RawReceivePort exitSignal;
+ exitSignal = new RawReceivePort((_) {
+ Expect.listEquals([4, 3, 2], result);
+ exitSignal.close();
+ reply.close();
+ asyncEnd();
+ });
+ isolate.addOnExitListener(exitSignal.sendPort);
echoPort.send(4);
- echoPort.send(3);
- Capability resume = isolate.pause();
- var pingPort = new RawReceivePort();
- pingPort.handler = (_) {
- Expect.isTrue(result.length <= 2);
- echoPort.send(0);
- isolate.resume(resume);
- pingPort.close();
- };
- isolate.ping(pingPort.sendPort, Isolate.PING_CONTROL);
- echoPort.send(2);
- echoPort.send(1);
});
});
}
« no previous file with comments | « tests/isolate/kill_self_test.dart ('k') | tests/isolate/ping_pause_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698