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 import 'package:async_helper/async_helper.dart'; | 5 import 'package:async_helper/async_helper.dart'; |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'catch_errors.dart'; | 8 import 'catch_errors.dart'; |
9 | 9 |
10 class A { | 10 class A { |
(...skipping 16 matching lines...) Expand all Loading... |
27 events.add("async handler done"); | 27 events.add("async handler done"); |
28 } | 28 } |
29 | 29 |
30 onErrorHandler(e) { | 30 onErrorHandler(e) { |
31 events.add("error: $e"); | 31 events.add("error: $e"); |
32 } | 32 } |
33 | 33 |
34 main() { | 34 main() { |
35 asyncStart(); | 35 asyncStart(); |
36 | 36 |
37 // Test that runZonedExperimental works when async, error and done are used. | 37 // Test that runZonedScheduleMicrotask works when async, error and done |
| 38 // are used. |
38 var result = runZonedScheduleMicrotask( | 39 var result = runZonedScheduleMicrotask( |
39 body, | 40 body, |
40 onScheduleMicrotask: onAsyncHandler, | 41 onScheduleMicrotask: onAsyncHandler, |
41 onError: onErrorHandler); | 42 onError: onErrorHandler); |
42 events.add("after"); | 43 events.add("after"); |
43 Timer.run(() { | 44 Timer.run(() { |
44 Expect.listEquals( | 45 Expect.listEquals( |
45 ["body entry", | 46 ["body entry", |
46 "async handler", "async handler done", | 47 "async handler", "async handler done", |
47 "after", | 48 "after", |
48 "run async body", | 49 "run async body", |
49 "error: foo"], | 50 "error: foo"], |
50 events); | 51 events); |
51 asyncEnd(); | 52 asyncEnd(); |
52 }); | 53 }); |
53 } | 54 } |
OLD | NEW |