OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import "dart:isolate"; |
| 6 import "package:expect/expect.dart"; |
| 7 |
| 8 class _Private { |
| 9 String data; |
| 10 _Private(this.data); |
| 11 } |
| 12 |
| 13 void child(message) { |
| 14 print("Got message: $message"); |
| 15 SendPort replyPort = message[0]; |
| 16 _Private object = message[1]; |
| 17 Expect.isTrue(object is _Private); |
| 18 Expect.equals("XYZ", object.data); |
| 19 replyPort.send(object); |
| 20 } |
| 21 |
| 22 void main() { |
| 23 var port; |
| 24 port = new RawReceivePort((message) { |
| 25 print("Got reply: $message"); |
| 26 Expect.isTrue(message is _Private); |
| 27 Expect.equals("XYZ", message.data); |
| 28 port.close(); |
| 29 }); |
| 30 |
| 31 Isolate.spawn(child, [port.sendPort, new _Private("XYZ")]); |
| 32 } |
OLD | NEW |