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 // Dart test program for testing isolate communication with | 4 // Dart test program for testing isolate communication with |
5 // typed objects. | 5 // typed objects. |
6 // VMOptions=--checked | 6 // VMOptions=--checked |
7 | 7 |
8 library TypedMessageTest; | 8 library TypedMessageTest; |
| 9 |
9 import "dart:async"; | 10 import "dart:async"; |
10 import "package:expect/expect.dart"; | 11 import "package:expect/expect.dart"; |
11 import "package:async_helper/async_helper.dart"; | 12 import "package:async_helper/async_helper.dart"; |
12 import "dart:isolate"; | 13 import "dart:isolate"; |
13 | 14 |
14 void logMessages(SendPort replyTo) { | 15 void logMessages(SendPort replyTo) { |
15 print("Starting log server."); | 16 print("Starting log server."); |
16 ReceivePort port = new ReceivePort(); | 17 ReceivePort port = new ReceivePort(); |
17 replyTo.send(port.sendPort); | 18 replyTo.send(port.sendPort); |
18 port.first.then((List<int> message) { | 19 port.first.then((List<int> message) { |
(...skipping 22 matching lines...) Expand all Loading... |
41 iterator.moveNext().then((b) { | 42 iterator.moveNext().then((b) { |
42 SendPort sendPort = iterator.current; | 43 SendPort sendPort = iterator.current; |
43 sendPort.send(msg); | 44 sendPort.send(msg); |
44 return iterator.moveNext(); | 45 return iterator.moveNext(); |
45 }).then((b) { | 46 }).then((b) { |
46 Expect.equals(1, iterator.current); | 47 Expect.equals(1, iterator.current); |
47 receivePort.close(); | 48 receivePort.close(); |
48 asyncEnd(); | 49 asyncEnd(); |
49 }); | 50 }); |
50 } | 51 } |
OLD | NEW |