Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: packages/async/test/future_group_test.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:async/src/future_group.dart'; 7 import 'package:async/src/future_group.dart';
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 9
10 import 'utils.dart'; 10 import 'utils.dart';
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 expect(futureGroup.isIdle, isTrue); 180 expect(futureGroup.isIdle, isTrue);
181 }); 181 });
182 182
183 test("emits an event when the group closes", () async { 183 test("emits an event when the group closes", () async {
184 // It's important that the order of events here stays consistent over 184 // It's important that the order of events here stays consistent over
185 // time, since code may rely on it in subtle ways. 185 // time, since code may rely on it in subtle ways.
186 var idle = false; 186 var idle = false;
187 var onIdleDone = false; 187 var onIdleDone = false;
188 var futureFired = false; 188 var futureFired = false;
189 189
190 futureGroup.onIdle.listen(expectAsync((_) { 190 futureGroup.onIdle.listen(expectAsync1((_) {
191 expect(futureFired, isFalse); 191 expect(futureFired, isFalse);
192 idle = true; 192 idle = true;
193 }), onDone: expectAsync(() { 193 }), onDone: expectAsync0(() {
194 expect(idle, isTrue); 194 expect(idle, isTrue);
195 expect(futureFired, isFalse); 195 expect(futureFired, isFalse);
196 onIdleDone = true; 196 onIdleDone = true;
197 })); 197 }));
198 198
199 futureGroup.future.then(expectAsync((_) { 199 futureGroup.future.then(expectAsync1((_) {
200 expect(idle, isTrue); 200 expect(idle, isTrue);
201 expect(onIdleDone, isTrue); 201 expect(onIdleDone, isTrue);
202 futureFired = true; 202 futureFired = true;
203 })); 203 }));
204 204
205 var completer = new Completer(); 205 var completer = new Completer();
206 futureGroup.add(completer.future); 206 futureGroup.add(completer.future);
207 futureGroup.close(); 207 futureGroup.close();
208 208
209 await flushMicrotasks(); 209 await flushMicrotasks();
210 expect(idle, isFalse); 210 expect(idle, isFalse);
211 expect(futureGroup.isIdle, isFalse); 211 expect(futureGroup.isIdle, isFalse);
212 212
213 completer.complete(); 213 completer.complete();
214 await flushMicrotasks(); 214 await flushMicrotasks();
215 expect(idle, isTrue); 215 expect(idle, isTrue);
216 expect(futureGroup.isIdle, isTrue); 216 expect(futureGroup.isIdle, isTrue);
217 expect(futureFired, isTrue); 217 expect(futureFired, isTrue);
218 }); 218 });
219 }); 219 });
220 } 220 }
OLDNEW
« no previous file with comments | « packages/async/test/cancelable_operation_test.dart ('k') | packages/async/test/lazy_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698