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

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: 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
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 84985c99973fe55e3a49c93ae1959f51f6d7dcea..ecdf4dd56814e054f22d5b90bf673e011bb3d131 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 {
« no previous file with comments | « pkg/scheduled_test/lib/src/mock_clock.dart ('k') | pkg/scheduled_test/lib/src/scheduled_server/handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698