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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Dart test program for testing serialization of messages. 5 // Dart test program for testing serialization of messages.
6 // VMOptions=--enable_type_checks --enable_asserts 6 // VMOptions=--enable_type_checks --enable_asserts
7 7
8 library Message2Test; 8 library Message2Test;
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import '../../pkg/unittest/lib/unittest.dart'; 10 import '../../pkg/unittest/lib/unittest.dart';
(...skipping 24 matching lines...) Expand all
35 } else if (expected[i] is Map) { 35 } else if (expected[i] is Map) {
36 mapEqualsDeep(expected[i], actual[i]); 36 mapEqualsDeep(expected[i], actual[i]);
37 } else { 37 } else {
38 expect(actual[i], expected[i]); 38 expect(actual[i], expected[i]);
39 } 39 }
40 } 40 }
41 } 41 }
42 } 42 }
43 43
44 void pingPong() { 44 void pingPong() {
45 port.receive((var message, SendPort replyTo) { 45 bool isFirst = true;
46 if (message == -1) { 46 IsolateSink replyTo;
47 port.close(); 47 stream.listen((var message) {
48 } else { 48 if (isFirst) {
49 // Bounce the received object back so that the sender 49 isFirst = false;
50 // can make sure that the object matches. 50 replyTo = message;
51 replyTo.send(message, null); 51 return;
52 } 52 }
53 // Bounce the received object back so that the sender
54 // can make sure that the object matches.
55 replyTo.add(message);
53 }); 56 });
54 } 57 }
55 58
56 main() { 59 main() {
57 test("map is equal after it is sent back and forth", () { 60 test("map is equal after it is sent back and forth", () {
58 SendPort remote = spawnFunction(pingPong); 61 IsolateSink remote = streamSpawnFunction(pingPong);
59 Map m = new Map(); 62 Map m = new Map();
60 m[1] = "eins"; 63 m[1] = "eins";
61 m[2] = "deux"; 64 m[2] = "deux";
62 m[3] = "tre"; 65 m[3] = "tre";
63 m[4] = "four"; 66 m[4] = "four";
64 remote.call(m).then(expectAsync1((var received) { 67 MessageBox box = new MessageBox();
68 remote.add(box.sink);
69 remote.add(m);
70 box.stream.listen(expectAsync1((var received) {
65 MessageTest.mapEqualsDeep(m, received); 71 MessageTest.mapEqualsDeep(m, received);
66 remote.send(-1, null); 72 remote.close();
73 box.stream.close();
67 })); 74 }));
68 }); 75 });
69 } 76 }
OLDNEW
« 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