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

Unified Diff: pkg/scheduled_test/lib/src/schedule.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/schedule.dart
diff --git a/pkg/scheduled_test/lib/src/schedule.dart b/pkg/scheduled_test/lib/src/schedule.dart
index 2569b4bd9efebd4b70f2e7bf4a4cfc4035c051d3..123e980e83d1d9a638a5012812f95d58f1eb753e 100644
--- a/pkg/scheduled_test/lib/src/schedule.dart
+++ b/pkg/scheduled_test/lib/src/schedule.dart
@@ -131,7 +131,7 @@ class Schedule {
/// Sets up this schedule by running [setUp], then runs all the task queues in
/// order. Any errors in [setUp] will cause [onException] to run.
Future run(void setUp()) {
- return new Future.immediate(null).then((_) {
+ return new Future.value().then((_) {
try {
setUp();
} catch (e, stackTrace) {
@@ -432,13 +432,13 @@ class TaskQueue {
if (isRunning) {
var task = _schedule.currentTask;
var wrappedFn = () => _schedule.wrapFuture(
- new Future.immediate(null).then((_) => fn()));
+ new Future.value().then((_) => fn()));
if (task == null) return wrappedFn();
return task.runChild(wrappedFn, description);
}
var task = new Task(() {
- return new Future.of(fn).catchError((e) {
+ return new Future.sync(fn).catchError((e) {
throw new ScheduleError.from(_schedule, e);
});
}, description, this);
@@ -557,7 +557,7 @@ class TaskQueue {
} else if (_taskFuture != null) {
// Catch errors coming off the old task future, in case it completes after
// timing out.
- _taskFuture.substitute(new Future.immediateError(error)).catchError((e) {
+ _taskFuture.substitute(new Future.error(error)).catchError((e) {
_schedule._signalPostTimeoutError(e);
});
} else {

Powered by Google App Engine
This is Rietveld 408576698