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

Unified Diff: tests/isolate/nested_spawn_test.dart

Issue 27215002: Very simple version of Isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 2 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/nested_spawn_stream_test.dart ('k') | tests/isolate/port_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/nested_spawn_test.dart
diff --git a/tests/isolate/nested_spawn_test.dart b/tests/isolate/nested_spawn_test.dart
index 795ad995b8aa9876ff0fc3501c2ae499c8e50d6f..51157f336ed7cefa00ad31669b7c05f643f16d04 100644
--- a/tests/isolate/nested_spawn_test.dart
+++ b/tests/isolate/nested_spawn_test.dart
@@ -8,32 +8,24 @@ library NestedSpawnTest;
import 'dart:isolate';
import '../../pkg/unittest/lib/unittest.dart';
-void isolateA() {
- port.receive((msg, replyTo) {
- expect(msg, "launch nested!");
- SendPort p = spawnFunction(isolateB);
- p.call("alive?").then((msg) {
- expect(msg, "and kicking");
- replyTo.send(499, null);
- port.close();
- });
- });
+void isolateA(message) {
+ message.add("isolateA");
+ Isolate.spawn(isolateB, message);
}
-void isolateB() {
- port.receive((msg, replyTo) {
- expect(msg, "alive?");
- replyTo.send("and kicking", null);
- port.close();
- });
+void isolateB(message) {
+ message.add("isolateB");
+ message[0].send(message);
}
-
main() {
test("spawned isolates can spawn nested isolates", () {
- SendPort port = spawnFunction(isolateA);
- port.call("launch nested!").then(expectAsync1((msg) {
- expect(msg, 499);
- }));
+ ReceivePort port = new ReceivePort();
+ Isolate.spawn(isolateA, [port.sendPort, "main"]);
+ port.first.then((message) {
+ expect("main", message[1]);
+ expect("isolateA", message[2]);
+ expect("isolateB", message[3]);
+ });
});
}
« no previous file with comments | « tests/isolate/nested_spawn_stream_test.dart ('k') | tests/isolate/port_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698