| Index: tests/isolate/src/CrossIsolateMessageTest.dart
|
| diff --git a/tests/isolate/src/CrossIsolateMessageTest.dart b/tests/isolate/src/CrossIsolateMessageTest.dart
|
| index 5b97533ff2c6c0b315f1a45be389e8ceb4308d21..a21874f1cc0d1f1815235457e8b59698a1aaa30d 100644
|
| --- a/tests/isolate/src/CrossIsolateMessageTest.dart
|
| +++ b/tests/isolate/src/CrossIsolateMessageTest.dart
|
| @@ -7,7 +7,7 @@
|
|
|
| #library('CrossIsolateMessageTest');
|
| #import('dart:isolate');
|
| -#import('TestFramework.dart');
|
| +#import('../../../lib/unittest/unittest.dart');
|
|
|
| class CrossIsolate1 extends Isolate {
|
| CrossIsolate1() : super.heavy();
|
| @@ -45,29 +45,26 @@ class CrossIsolate2 extends Isolate {
|
| }
|
| }
|
|
|
| -test(TestExpectation expect) {
|
| - // Create CrossIsolate1 and CrossIsolate2.
|
| - expect.completes(new CrossIsolate1().spawn()).then((SendPort port1) {
|
| - expect.completes(new CrossIsolate2().spawn()).then((SendPort port2) {
|
| - // Create a new receive port and send it to isolate2.
|
| - ReceivePort myPort = new ReceivePort();
|
| - port2.call(myPort.toSendPort()).then(expect.runs1((msg) {
|
| - Expect.equals("ready", msg[0]);
|
| - // Send port of isolate2 to isolate1.
|
| - port1.call(msg[1]).then(expect.runs1((msg) {
|
| +main() {
|
| + test("share port, and send message cross isolates ", () {
|
| + // Create CrossIsolate1 and CrossIsolate2.
|
| + new CrossIsolate1().spawn().then(later1((SendPort port1) {
|
| + new CrossIsolate2().spawn().then(later1((SendPort port2) {
|
| + // Create a new receive port and send it to isolate2.
|
| + ReceivePort myPort = new ReceivePort();
|
| + port2.call(myPort.toSendPort()).then(later1((msg) {
|
| Expect.equals("ready", msg[0]);
|
| - myPort.receive(expect.runs2((msg, replyTo) {
|
| - Expect.equals(499, msg);
|
| - expect.succeeded();
|
| - myPort.close();
|
| + // Send port of isolate2 to isolate1.
|
| + port1.call(msg[1]).then(later1((msg) {
|
| + Expect.equals("ready", msg[0]);
|
| + myPort.receive(later2((msg, replyTo) {
|
| + Expect.equals(499, msg);
|
| + myPort.close();
|
| + }));
|
| + msg[1].send(42, null);
|
| }));
|
| - msg[1].send(42, null);
|
| }));
|
| }));
|
| - });
|
| + }));
|
| });
|
| }
|
| -
|
| -main() {
|
| - runTests([test]);
|
| -}
|
|
|