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

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

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
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 419e47eb8bc30e224f997cd5920922b9f844a36d..736f56d663f7a4e782d0eba28b29871b048d1ffe 100644
--- a/pkg/scheduled_test/lib/src/utils.dart
+++ b/pkg/scheduled_test/lib/src/utils.dart
@@ -50,8 +50,8 @@ String prefixLines(String text, {String prefix: '| ', String firstPrefix}) {
/// times. By default, this should pump the event queue enough times to allow
/// 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.immediate(null);
- return new Future.immediate(null).then((_) => pumpEventQueue(times - 1));
+ if (times == 0) return new Future.value();
+ return new Future.value().then((_) => pumpEventQueue(times - 1));
}
/// Returns whether [iterable1] has the same elements in the same order as
@@ -71,7 +71,7 @@ bool orderedIterableEquals(Iterable iterable1, Iterable iterable2) {
// TODO(nweiz): remove this when issue 8731 is fixed.
/// Returns a [Stream] that will immediately emit [error] and then close.
-Stream errorStream(error) => new Future.immediateError(error).asStream();
+Stream errorStream(error) => new Future.error(error).asStream();
/// Returns a buffered stream that will emit the same values as the stream
/// returned by [future] once [future] completes. If [future] completes to an
@@ -162,7 +162,7 @@ Future awaitObject(object) {
if (object is Iterable) {
return Future.wait(object.map(awaitObject).toList());
}
- if (object is! Map) return new Future.immediate(object);
+ if (object is! Map) return new Future.value(object);
var pairs = <Future<Pair>>[];
object.forEach((key, value) {

Powered by Google App Engine
This is Rietveld 408576698