| 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 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 11 import "remote_unittest_helper.dart"; | 11 import "remote_unittest_helper.dart"; |
| 12 | 12 |
| 13 void main([args, port]) { | 13 void main([args, port]) { |
| 14 if (testRemote(main, port)) return; | 14 if (testRemote(main, port)) return; |
| 15 test("complex messages are serialized correctly", () { | 15 test("complex messages are serialized correctly", () { |
| 16 ReceivePort local = new ReceivePort(); | 16 ReceivePort local = new ReceivePort(); |
| 17 Isolate.spawn(logMessages, local.sendPort); | 17 Isolate.spawn(logMessages, local.sendPort); |
| 18 var done = expectAsync0((){}); | 18 var done = expectAsync((){}); |
| 19 local.listen(expectAsync1((msg) { | 19 local.listen(expectAsync((msg) { |
| 20 switch (msg[0]) { | 20 switch (msg[0]) { |
| 21 case "init": | 21 case "init": |
| 22 var remote = msg[1]; | 22 var remote = msg[1]; |
| 23 remote.send(1); | 23 remote.send(1); |
| 24 remote.send("Hello"); | 24 remote.send("Hello"); |
| 25 remote.send("World"); | 25 remote.send("World"); |
| 26 remote.send(const [null, 1, 2, 3, 4]); | 26 remote.send(const [null, 1, 2, 3, 4]); |
| 27 remote.send(const [1, 2.0, true, false, 0xffffffffff]); | 27 remote.send(const [1, 2.0, true, false, 0xffffffffff]); |
| 28 remote.send(const ["Hello", "World", 0xffffffffff]); | 28 remote.send(const ["Hello", "World", 0xffffffffff]); |
| 29 // Shutdown the LogRunner. | 29 // Shutdown the LogRunner. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 expect(message.length, 3); | 78 expect(message.length, 3); |
| 79 expect(message[0], "Hello"); | 79 expect(message[0], "Hello"); |
| 80 expect(message[1], "World"); | 80 expect(message[1], "World"); |
| 81 expect(message[2], 0xffffffffff); | 81 expect(message[2], 0xffffffffff); |
| 82 break; | 82 break; |
| 83 } | 83 } |
| 84 count++; | 84 count++; |
| 85 } | 85 } |
| 86 }); | 86 }); |
| 87 } | 87 } |
| OLD | NEW |