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 IsolateSink mainIsolate; | 12 IsolateSink mainIsolate; |
12 stream.listen((msg) { | 13 stream.listen((msg) { |
13 mainIsolate = msg; | 14 mainIsolate = msg; |
14 throw new RuntimeError("ignore exception"); | 15 throw new RuntimeError("ignore exception"); |
15 }, onDone: () { | 16 }, onDone: () { |
16 mainIsolate.add("received done"); | 17 mainIsolate.add("received done"); |
(...skipping 22 matching lines...) Expand all Loading... |
39 // the handling of the previous event. We therefore delay the closing. | 40 // the handling of the previous event. We therefore delay the closing. |
40 // Note: if the done is sent too early it won't lead to failing tests, but | 41 // Note: if the done is sent too early it won't lead to failing tests, but |
41 // just won't make sure that the globalErrorHandler works. | 42 // just won't make sure that the globalErrorHandler works. |
42 new Timer(const Duration(milliseconds: 10), otherIsolate.close); | 43 new Timer(const Duration(milliseconds: 10), otherIsolate.close); |
43 box.stream.single.then((msg) { | 44 box.stream.single.then((msg) { |
44 Expect.equals("received done", msg); | 45 Expect.equals("received done", msg); |
45 timer.cancel(); | 46 timer.cancel(); |
46 keepRunningBox.stream.close(); | 47 keepRunningBox.stream.close(); |
47 }); | 48 }); |
48 } | 49 } |
OLD | NEW |