OLD | NEW |
| (Empty) |
1 diff --git a/../dart/pkg/async_helper/lib/async_helper.dart b/pkg/async_helper/l
ib/async_helper.dart | |
2 index 37496bc..1b8acf4 100644 | |
3 --- a/../dart/pkg/async_helper/lib/async_helper.dart | |
4 +++ b/pkg/async_helper/lib/async_helper.dart | |
5 @@ -27,16 +27,22 @@ library async_helper; | |
6 // 'dart:isolate' (i.e. it is in particular problematic with dart2js). | |
7 // It would be nice if we could use a different mechanism for different | |
8 // runtimes. | |
9 -import 'dart:isolate'; | |
10 +import 'dart:fletch'; | |
11 | |
12 bool _initialized = false; | |
13 -ReceivePort _port = null; | |
14 +Port _port = null; | |
15 int _asyncLevel = 0; | |
16 | |
17 Exception _buildException(String msg) { | |
18 return new Exception('Fatal: $msg. This is most likely a bug in your test.'); | |
19 } | |
20 | |
21 +void _waitForMessage(Port port) { | |
22 + Channel channel = new Channel(); | |
23 + port.send(new Port(channel)); | |
24 + channel.receive(); | |
25 +} | |
26 + | |
27 /// Call this method before an asynchronous test is created. | |
28 void asyncStart() { | |
29 if (_initialized && _asyncLevel == 0) { | |
30 @@ -46,7 +52,9 @@ void asyncStart() { | |
31 if (!_initialized) { | |
32 print('unittest-suite-wait-for-done'); | |
33 _initialized = true; | |
34 - _port = new ReceivePort(); | |
35 + var channel = new Channel(); | |
36 + Process.spawn(_waitForMessage, new Port(channel)); | |
37 + _port = channel.receive(); | |
38 } | |
39 _asyncLevel++; | |
40 } | |
41 @@ -63,7 +71,7 @@ void asyncEnd() { | |
42 } | |
43 _asyncLevel--; | |
44 if (_asyncLevel == 0) { | |
45 - _port.close(); | |
46 + _port.send(null); | |
47 _port = null; | |
48 print('unittest-suite-success'); | |
49 } | |
OLD | NEW |