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 isolate communication with | 5 // Dart test program for testing isolate communication with |
6 // complex messages. | 6 // complex messages. |
7 | 7 |
8 library IsolateComplexMessagesTest; | 8 library IsolateComplexMessagesTest; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 import '../../pkg/unittest/lib/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 11 import "remote_unittest_helper.dart"; |
11 | 12 |
12 main() { | 13 void main([args, port]) { |
| 14 if (testRemote(main, port)) return; |
13 test("complex messages are serialized correctly", () { | 15 test("complex messages are serialized correctly", () { |
14 ReceivePort local = new ReceivePort(); | 16 ReceivePort local = new ReceivePort(); |
15 Isolate.spawn(logMessages, local.sendPort); | 17 Isolate.spawn(logMessages, local.sendPort); |
16 var done = expectAsync0((){}); | 18 var done = expectAsync0((){}); |
17 local.listen(expectAsync1((msg) { | 19 local.listen(expectAsync1((msg) { |
18 switch (msg[0]) { | 20 switch (msg[0]) { |
19 case "init": | 21 case "init": |
20 var remote = msg[1]; | 22 var remote = msg[1]; |
21 remote.send(1); | 23 remote.send(1); |
22 remote.send("Hello"); | 24 remote.send("Hello"); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 expect(message.length, 3); | 78 expect(message.length, 3); |
77 expect(message[0], "Hello"); | 79 expect(message[0], "Hello"); |
78 expect(message[1], "World"); | 80 expect(message[1], "World"); |
79 expect(message[2], 0xffffffffff); | 81 expect(message[2], 0xffffffffff); |
80 break; | 82 break; |
81 } | 83 } |
82 count++; | 84 count++; |
83 } | 85 } |
84 }); | 86 }); |
85 } | 87 } |
OLD | NEW |