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

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: Added co19 issue number. 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
« no previous file with comments | « pkg/scheduled_test/lib/src/task.dart ('k') | pkg/scheduled_test/test/descriptor/async_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 17f0fbda4003e684caacab6c30f92fc357cd0b3b..6e4c636d03b5d3ef78fe06d8d3bc4d7ea959da78 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
@@ -163,7 +163,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) {
« no previous file with comments | « pkg/scheduled_test/lib/src/task.dart ('k') | pkg/scheduled_test/test/descriptor/async_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698