| 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 import 'dart:isolate'; | 10 import 'dart:isolate'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 })); | 50 })); |
| 51 })); | 51 })); |
| 52 })); | 52 })); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void main([args, port]) { | 55 void main([args, port]) { |
| 56 if (testRemote(main, port)) return; | 56 if (testRemote(main, port)) return; |
| 57 test("spawned isolate can spawn other isolates", () { | 57 test("spawned isolate can spawn other isolates", () { |
| 58 ReceivePort init = new ReceivePort(); | 58 ReceivePort init = new ReceivePort(); |
| 59 Isolate.spawn(isolateA, init.sendPort); | 59 Isolate.spawn(isolateA, init.sendPort); |
| 60 init.first.then(expectAsync((port) { | 60 return init.first.then(expectAsync((port) { |
| 61 _call(port, "launch nested!", expectAsync((msg, replyTo) { | 61 _call(port, "launch nested!", expectAsync((msg, replyTo) { |
| 62 expect(msg[0], "0"); | 62 expect(msg[0], "0"); |
| 63 _call(replyTo, msg1, expectAsync((msg, replyTo) { | 63 _call(replyTo, msg1, expectAsync((msg, replyTo) { |
| 64 expect(msg[0], "2"); | 64 expect(msg[0], "2"); |
| 65 _call(replyTo, msg3, expectAsync((msg, replyTo) { | 65 _call(replyTo, msg3, expectAsync((msg, replyTo) { |
| 66 expect(msg[0], "4"); | 66 expect(msg[0], "4"); |
| 67 _call(replyTo, msg5, expectAsync((msg, _) { | 67 _call(replyTo, msg5, expectAsync((msg, _) { |
| 68 expect(msg[0], "6"); | 68 expect(msg[0], "6"); |
| 69 })); | 69 })); |
| 70 })); | 70 })); |
| 71 })); | 71 })); |
| 72 })); | 72 })); |
| 73 })); | 73 })); |
| 74 }); | 74 }); |
| 75 } | 75 } |
| OLD | NEW |