| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library test; | 5 library test; |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; |
| 7 import 'dart:async'; | 8 import 'dart:async'; |
| 8 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 9 | 10 |
| 10 runTest() { | 11 runTest() { |
| 11 SendPort mainIsolate; | 12 SendPort mainIsolate; |
| 12 bool isFirst = true; | 13 bool isFirst = true; |
| 13 port.receive((msg, replyTo) { | 14 port.receive((msg, replyTo) { |
| 14 if (isFirst) { | 15 if (isFirst) { |
| 15 mainIsolate = msg; | 16 mainIsolate = msg; |
| 16 isFirst = false; | 17 isFirst = false; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 var port = new ReceivePort(); | 33 var port = new ReceivePort(); |
| 33 SendPort otherIsolate = spawnFunction(runTest, globalErrorHandler); | 34 SendPort otherIsolate = spawnFunction(runTest, globalErrorHandler); |
| 34 otherIsolate.send(port.toSendPort()); | 35 otherIsolate.send(port.toSendPort()); |
| 35 otherIsolate.send("message 2"); | 36 otherIsolate.send("message 2"); |
| 36 port.receive((msg, replyPort) { | 37 port.receive((msg, replyPort) { |
| 37 Expect.equals("received", msg); | 38 Expect.equals("received", msg); |
| 38 port.close(); | 39 port.close(); |
| 39 timer.cancel(); | 40 timer.cancel(); |
| 40 }); | 41 }); |
| 41 } | 42 } |
| OLD | NEW |