| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 handle_error_test; | 5 library handle_error_test; |
| 6 | 6 |
| 7 import "dart:isolate"; | 7 import "dart:isolate"; |
| 8 import "dart:async"; | 8 import "dart:async"; |
| 9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 Future result = reply.first.then((sendPort) { | 40 Future result = reply.first.then((sendPort) { |
| 41 return [isolate, sendPort]; | 41 return [isolate, sendPort]; |
| 42 }); | 42 }); |
| 43 return result; | 43 return result; |
| 44 }); | 44 }); |
| 45 } | 45 } |
| 46 | 46 |
| 47 main(){ | 47 main(){ |
| 48 asyncStart(); | 48 asyncStart(); |
| 49 RawReceivePort reply = new RawReceivePort(null); | 49 RawReceivePort reply = new RawReceivePort(null); |
| 50 RawReceivePort reply2 = new RawReceivePort(null); | |
| 51 // Create two isolates waiting for commands, with errors non-fatal. | 50 // Create two isolates waiting for commands, with errors non-fatal. |
| 52 Future iso1 = spawn(isomain1); | 51 Future iso1 = spawn(isomain1); |
| 53 Future iso2 = spawn(isomain1); | 52 Future iso2 = spawn(isomain1); |
| 54 Future.wait([iso1, iso2]).then((l) { | 53 Future.wait([iso1, iso2]).then((l) { |
| 55 var isolate1 = l[0][0]; | 54 var isolate1 = l[0][0]; |
| 56 var sendPort1 = l[0][1]; | 55 var sendPort1 = l[0][1]; |
| 57 var isolate2 = l[1][0]; | 56 var isolate2 = l[1][0]; |
| 58 var sendPort2 = l[1][1]; | 57 var sendPort2 = l[1][1]; |
| 59 Stream errors = isolate1.errors; // Broadcast stream, never a done message. | 58 Stream errors = isolate1.errors; // Broadcast stream, never a done message. |
| 60 int state = 1; | 59 int state = 1; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 80 sendPort2.send(0); | 79 sendPort2.send(0); |
| 81 sendPort1.send(1); | 80 sendPort1.send(1); |
| 82 sendPort2.send(1); | 81 sendPort2.send(1); |
| 83 sendPort1.send(2); | 82 sendPort1.send(2); |
| 84 sendPort2.send(2); | 83 sendPort2.send(2); |
| 85 sendPort1.send(3); | 84 sendPort1.send(3); |
| 86 sendPort2.send(3); | 85 sendPort2.send(3); |
| 87 }); | 86 }); |
| 88 } | 87 } |
| 89 | 88 |
| OLD | NEW |