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

Unified Diff: tests/isolate/message_stream2_test.dart

Issue 12919011: Remove streamSpawnUri and mangler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 9 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/mandel_isolate_stream_test.dart ('k') | tests/isolate/message_stream_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}));
});
}
« no previous file with comments | « tests/isolate/mandel_isolate_stream_test.dart ('k') | tests/isolate/message_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698