| Index: tests/isolate/message_stream2_test.dart
|
| diff --git a/tests/isolate/message2_test.dart b/tests/isolate/message_stream2_test.dart
|
| similarity index 75%
|
| copy from tests/isolate/message2_test.dart
|
| copy to tests/isolate/message_stream2_test.dart
|
| index 07b34e6716bc020ba7722c64d7a05b96ec98626e..c9a6a6702c240987883651f4a7847625f0398764 100644
|
| --- a/tests/isolate/message2_test.dart
|
| +++ b/tests/isolate/message_stream2_test.dart
|
| @@ -42,28 +42,35 @@ class MessageTest {
|
| }
|
|
|
| void pingPong() {
|
| - port.receive((var message, SendPort replyTo) {
|
| - if (message == -1) {
|
| - port.close();
|
| - } else {
|
| - // Bounce the received object back so that the sender
|
| - // can make sure that the object matches.
|
| - replyTo.send(message, null);
|
| + bool isFirst = true;
|
| + IsolateSink replyTo;
|
| + stream.listen((var message) {
|
| + if (isFirst) {
|
| + isFirst = false;
|
| + replyTo = message;
|
| + return;
|
| }
|
| + // Bounce the received object back so that the sender
|
| + // can make sure that the object matches.
|
| + replyTo.add(message);
|
| });
|
| }
|
|
|
| main() {
|
| test("map is equal after it is sent back and forth", () {
|
| - SendPort remote = spawnFunction(pingPong);
|
| + IsolateSink remote = streamSpawnFunction(pingPong);
|
| Map m = new Map();
|
| m[1] = "eins";
|
| m[2] = "deux";
|
| m[3] = "tre";
|
| m[4] = "four";
|
| - remote.call(m).then(expectAsync1((var received) {
|
| + MessageBox box = new MessageBox();
|
| + remote.add(box.sink);
|
| + remote.add(m);
|
| + box.stream.listen(expectAsync1((var received) {
|
| MessageTest.mapEqualsDeep(m, received);
|
| - remote.send(-1, null);
|
| + remote.close();
|
| + box.stream.close();
|
| }));
|
| });
|
| }
|
|
|