| 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 import "dart:async"; | 5 import "dart:async"; |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
| 8 | 8 |
| 9 bool cancelled; | 9 bool cancelled; |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } finally { | 44 } finally { |
| 45 Expect.isTrue(cancelled); | 45 Expect.isTrue(cancelled); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 test() async { | 49 test() async { |
| 50 await test1(); | 50 await test1(); |
| 51 await test2(); | 51 await test2(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 main() async { | 54 main() { |
| 55 asyncStart(); | 55 asyncStart(); |
| 56 test().then((_) { | 56 test().then((_) { |
| 57 asyncEnd(); | 57 asyncEnd(); |
| 58 }); | 58 }); |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 // Create a stream that produces numbers [1, 2, ... ] | 62 // Create a stream that produces numbers [1, 2, ... ] |
| 63 StreamController infiniteStreamController() { | 63 StreamController infiniteStreamController() { |
| 64 StreamController controller; | 64 StreamController controller; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 85 onListen: startTimer, | 85 onListen: startTimer, |
| 86 onPause: stopTimer, | 86 onPause: stopTimer, |
| 87 onResume: startTimer, | 87 onResume: startTimer, |
| 88 onCancel: () { | 88 onCancel: () { |
| 89 cancelled = true; | 89 cancelled = true; |
| 90 stopTimer(); | 90 stopTimer(); |
| 91 }); | 91 }); |
| 92 | 92 |
| 93 return controller; | 93 return controller; |
| 94 } | 94 } |
| OLD | NEW |