OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Helper utilities for testing. | 5 /// Helper utilities for testing. |
6 library async.test.util; | |
7 | |
8 import "dart:async"; | 6 import "dart:async"; |
9 | 7 |
10 import "package:async/async.dart"; | 8 import "package:async/async.dart"; |
11 import "package:test/test.dart"; | 9 import "package:test/test.dart"; |
12 | 10 |
13 /// A zero-millisecond timer should wait until after all microtasks. | 11 /// A zero-millisecond timer should wait until after all microtasks. |
14 Future flushMicrotasks() => new Future.delayed(Duration.ZERO); | 12 Future flushMicrotasks() => new Future.delayed(Duration.ZERO); |
15 | 13 |
16 /// A generic unreachable callback function. | 14 /// A generic unreachable callback function. |
17 /// | 15 /// |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 stream.listen(add, onError: addError, onDone: completer.complete); | 76 stream.listen(add, onError: addError, onDone: completer.complete); |
79 return completer.future; | 77 return completer.future; |
80 } | 78 } |
81 | 79 |
82 Future close() { | 80 Future close() { |
83 _isClosed = true; | 81 _isClosed = true; |
84 _doneCompleter.complete(new Future.microtask(_onDone)); | 82 _doneCompleter.complete(new Future.microtask(_onDone)); |
85 return done; | 83 return done; |
86 } | 84 } |
87 } | 85 } |
OLD | NEW |