OLD | NEW |
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 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 }); | 55 }); |
56 replyPort.send(port.sendPort); | 56 replyPort.send(port.sendPort); |
57 } | 57 } |
58 | 58 |
59 void main([args, port]) { | 59 void main([args, port]) { |
60 if (testRemote(main, port)) return; | 60 if (testRemote(main, port)) return; |
61 test("map is equal after it is sent back and forth", () { | 61 test("map is equal after it is sent back and forth", () { |
62 ReceivePort port = new ReceivePort(); | 62 ReceivePort port = new ReceivePort(); |
63 Isolate.spawn(pingPong, port.sendPort); | 63 Isolate.spawn(pingPong, port.sendPort); |
64 port.first.then(expectAsync1((remote) { | 64 port.first.then(expectAsync((remote) { |
65 Map m = new Map(); | 65 Map m = new Map(); |
66 m[1] = "eins"; | 66 m[1] = "eins"; |
67 m[2] = "deux"; | 67 m[2] = "deux"; |
68 m[3] = "tre"; | 68 m[3] = "tre"; |
69 m[4] = "four"; | 69 m[4] = "four"; |
70 ReceivePort replyPort = new ReceivePort(); | 70 ReceivePort replyPort = new ReceivePort(); |
71 remote.send([m, replyPort.sendPort]); | 71 remote.send([m, replyPort.sendPort]); |
72 replyPort.first.then(expectAsync1((var received) { | 72 replyPort.first.then(expectAsync((var received) { |
73 MessageTest.mapEqualsDeep(m, received); | 73 MessageTest.mapEqualsDeep(m, received); |
74 remote.send(null); | 74 remote.send(null); |
75 })); | 75 })); |
76 })); | 76 })); |
77 }); | 77 }); |
78 } | 78 } |
OLD | NEW |