Index: tests/isolate/object_leak_test.dart |
diff --git a/tests/isolate/object_leak_test.dart b/tests/isolate/object_leak_test.dart |
index 4511b43fd99bfe74285ccb437f40588c55e85c14..d15f2b51ca8518a3dcf6be9109e7ad3e7f2c45df 100644 |
--- a/tests/isolate/object_leak_test.dart |
+++ b/tests/isolate/object_leak_test.dart |
@@ -16,25 +16,23 @@ class A { |
} |
fun(msg) { |
- print("received: ${msg.x}"); |
- msg.x = 1; |
- print("done updating: ${msg.x}"); |
+ var a = msg[0]; |
+ var replyTo = msg[1]; |
+ print("received: ${a.x}"); |
+ a.x = 1; |
+ print("done updating: ${a.x}"); |
+ replyTo.send("done"); |
} |
main() { |
asyncStart(); |
var a = new A(); |
- // Sending an A object to another isolate should not work. |
- Isolate.spawn(fun, a).then((isolate) { |
- new Timer(const Duration(milliseconds: 300), () { |
- // Changes in other isolate must not reach here. |
- Expect.equals(0, a.x); |
- asyncEnd(); |
- }); |
- }, onError: (e) { |
- // Sending an A isn't required to work. |
- // It works in the VM, but not in dart2js. |
- print("Send of A failed:\n$e"); |
+ ReceivePort rp = new ReceivePort(); |
+ Isolate.spawn(fun, [a, rp.sendPort]); |
+ rp.first.then((msg) { |
+ Expect.equals("done", msg); |
+ // Changes in other isolate must not reach here. |
+ Expect.equals(0, a.x); |
asyncEnd(); |
}); |
} |