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 that isolates can spawn other isolates and | 5 // Dart test program for testing that isolates can spawn other isolates and |
6 // that the nested isolates can communicate with the main once the spawner has | 6 // that the nested isolates can communicate with the main once the spawner has |
7 // disappeared. | 7 // disappeared. |
8 | 8 |
9 library NestedSpawn2Test; | 9 library NestedSpawn2Test; |
| 10 |
10 import 'dart:isolate'; | 11 import 'dart:isolate'; |
11 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
12 import "remote_unittest_helper.dart"; | 13 import "remote_unittest_helper.dart"; |
13 | 14 |
14 void isolateA(SendPort init) { | 15 void isolateA(SendPort init) { |
15 ReceivePort port = new ReceivePort(); | 16 ReceivePort port = new ReceivePort(); |
16 init.send(port.sendPort); | 17 init.send(port.sendPort); |
17 port.first.then((message) { | 18 port.first.then((message) { |
18 expect(message[0], "launch nested!"); | 19 expect(message[0], "launch nested!"); |
19 SendPort replyTo = message[1]; | 20 SendPort replyTo = message[1]; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 expect(msg[0], "4"); | 67 expect(msg[0], "4"); |
67 _call(replyTo, msg5, expectAsync((msg, _) { | 68 _call(replyTo, msg5, expectAsync((msg, _) { |
68 expect(msg[0], "6"); | 69 expect(msg[0], "6"); |
69 })); | 70 })); |
70 })); | 71 })); |
71 })); | 72 })); |
72 })); | 73 })); |
73 })); | 74 })); |
74 }); | 75 }); |
75 } | 76 } |
OLD | NEW |