| 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:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'event_helper.dart'; | 8 import 'event_helper.dart'; |
| 9 | 9 |
| 10 | 10 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 }, onDone: () { | 148 }, onDone: () { |
| 149 Expect.listEquals(["error2", stackTrace, "future3", "future1"], events); | 149 Expect.listEquals(["error2", stackTrace, "future3", "future1"], events); |
| 150 asyncEnd(); | 150 asyncEnd(); |
| 151 }); | 151 }); |
| 152 Timer.run(() { | 152 Timer.run(() { |
| 153 completer2.complete("error2"); | 153 completer2.complete("error2"); |
| 154 Timer.run(() { | 154 Timer.run(() { |
| 155 completer3.complete("future3"); | 155 completer3.complete("future3"); |
| 156 Timer.run(() { | 156 Timer.run(() { |
| 157 completer1.complete("future1"); | 157 completer1.complete("future1"); |
| 158 runAsync(closeCompleter.complete); | 158 scheduleMicrotask(closeCompleter.complete); |
| 159 }); | 159 }); |
| 160 }); | 160 }); |
| 161 }); | 161 }); |
| 162 } | 162 } |
| 163 | 163 |
| 164 { | 164 { |
| 165 // Test that the output sink of the transformer can be used asynchronously | 165 // Test that the output sink of the transformer can be used asynchronously |
| 166 // and that events are paused if necessary. | 166 // and that events are paused if necessary. |
| 167 asyncStart(); | 167 asyncStart(); |
| 168 var controller; | 168 var controller; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 Expect.listEquals(["error2", stackTrace], events); | 205 Expect.listEquals(["error2", stackTrace], events); |
| 206 subscription.pause(); | 206 subscription.pause(); |
| 207 completer3.complete("future3"); | 207 completer3.complete("future3"); |
| 208 Timer.run(() { | 208 Timer.run(() { |
| 209 subscription.resume(); | 209 subscription.resume(); |
| 210 Timer.run(() { | 210 Timer.run(() { |
| 211 Expect.listEquals(["error2", stackTrace, "future3"], events); | 211 Expect.listEquals(["error2", stackTrace, "future3"], events); |
| 212 subscription.pause(); | 212 subscription.pause(); |
| 213 completer1.complete("future1"); | 213 completer1.complete("future1"); |
| 214 subscription.resume(); | 214 subscription.resume(); |
| 215 runAsync(closeCompleter.complete); | 215 scheduleMicrotask(closeCompleter.complete); |
| 216 }); | 216 }); |
| 217 }); | 217 }); |
| 218 }); | 218 }); |
| 219 }); | 219 }); |
| 220 }); | 220 }); |
| 221 } | 221 } |
| 222 | 222 |
| 223 { | 223 { |
| 224 // Test that the output sink of the transformer reports errors when the | 224 // Test that the output sink of the transformer reports errors when the |
| 225 // stream is already closed. | 225 // stream is already closed. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 new Stream.fromIterable([1, 2, 3]) | 304 new Stream.fromIterable([1, 2, 3]) |
| 305 .transform(new SinkTransformer<int, String>( | 305 .transform(new SinkTransformer<int, String>( |
| 306 (sink) => new TypeChangingSink(sink))) | 306 (sink) => new TypeChangingSink(sink))) |
| 307 .toList() | 307 .toList() |
| 308 .then((list) { | 308 .then((list) { |
| 309 Expect.listEquals(["1", "2", "3"], list); | 309 Expect.listEquals(["1", "2", "3"], list); |
| 310 asyncEnd(); | 310 asyncEnd(); |
| 311 }); | 311 }); |
| 312 } | 312 } |
| 313 } | 313 } |
| OLD | NEW |