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

Unified Diff: pkg/scheduled_test/lib/src/utils.dart

Issue 14886015: Use runAsync for Futures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comment Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/unittest/test/unittest_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/lib/src/utils.dart
diff --git a/pkg/scheduled_test/lib/src/utils.dart b/pkg/scheduled_test/lib/src/utils.dart
index 4bd4505f8aefc57f8b88ba0bab43a05b77d813f1..1f1485ab2b20c93757349702f74647cc70ce2c95 100644
--- a/pkg/scheduled_test/lib/src/utils.dart
+++ b/pkg/scheduled_test/lib/src/utils.dart
@@ -52,7 +52,11 @@ String prefixLines(String text, {String prefix: '| ', String firstPrefix}) {
/// any code to run, as long as it's not waiting on some external event.
Future pumpEventQueue([int times=20]) {
if (times == 0) return new Future.value();
- return new Future.value().then((_) => pumpEventQueue(times - 1));
+ // We use a delayed future to allow runAsync events to finish. The
+ // Future.value or Future() constructors use runAsync themselves and would
+ // therefore not wait for runAsync callbacks that are scheduled after invoking
+ // this method.
+ return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
}
/// Returns whether [iterable1] has the same elements in the same order as
« no previous file with comments | « no previous file | pkg/unittest/test/unittest_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698