| Index: tests/isolate/global_error_handler_stream_test.dart
|
| diff --git a/tests/isolate/global_error_handler_test.dart b/tests/isolate/global_error_handler_stream_test.dart
|
| similarity index 67%
|
| copy from tests/isolate/global_error_handler_test.dart
|
| copy to tests/isolate/global_error_handler_stream_test.dart
|
| index cbb659a2becab5df1518b4c40bccd462170e1b0b..6c2b59cfe800c828aa40194e4fc3b617395614e0 100644
|
| --- a/tests/isolate/global_error_handler_test.dart
|
| +++ b/tests/isolate/global_error_handler_stream_test.dart
|
| @@ -17,14 +17,14 @@ void runFunctions() {
|
| }
|
| }
|
|
|
| -void startTest(SendPort finishPort, replyPort) {
|
| +void startTest(StreamSink finishSink) {
|
| firstFunction = () { throw new RuntimeError("ignore exception"); };
|
| - finishFunction = () { finishPort.send("done"); };
|
| + finishFunction = () { finishSink.add("done"); finishPort.close(); };
|
| new Timer(Duration.ZERO, runFunctions);
|
| }
|
|
|
| runTest() {
|
| - port.receive(startTest);
|
| + stream.single.then(startTest);
|
| }
|
|
|
| bool globalErrorHandler(IsolateUnhandledException e) {
|
| @@ -32,10 +32,14 @@ bool globalErrorHandler(IsolateUnhandledException e) {
|
| }
|
|
|
| main() {
|
| - var port = new ReceivePort();
|
| + var box = new MessageBox();
|
| var timer;
|
| - SendPort otherIsolate = spawnFunction(runTest, globalErrorHandler);
|
| - otherIsolate.send(port.toSendPort());
|
| - port.receive((msg, replyPort) { port.close(); timer.cancel(); });
|
| + StreamSink otherIsolate = streamSpawnFunction(runTest, globalErrorHandler);
|
| + otherIsolate.add(box.sink);
|
| + otherIsolate.close();
|
| + box.stream.single.then((msg) {
|
| + box.stream.close();
|
| + timer.cancel();
|
| + });
|
| timer = new Timer(const Duration(seconds: 2), () { throw "failed"; });
|
| }
|
|
|