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

Unified Diff: utils/tests/pub/test_pub.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 | « utils/tests/pub/error_group_test.dart ('k') | utils/tests/pub/validator/dependency_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/test_pub.dart
diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart
index 3ba46a4d5ba97abc406dc0f7ec87e22a29663538..ba049989aec8d9dbdde93eb1570473688ced64a9 100644
--- a/utils/tests/pub/test_pub.dart
+++ b/utils/tests/pub/test_pub.dart
@@ -119,7 +119,7 @@ void serve([List<d.Descriptor> contents]) {
/// Closes [_server]. Returns a [Future] that will complete after the [_server]
/// is closed.
Future _closeServer() {
- if (_server == null) return new Future.immediate(null);
+ if (_server == null) return new Future.value();
_server.close();
_server = null;
_portCompleterCache = null;
@@ -356,7 +356,7 @@ ScheduledProcess startPub({List args, Future<Uri> tokenEndpoint}) {
'--trace'];
dartArgs.addAll(args);
- if (tokenEndpoint == null) tokenEndpoint = new Future.immediate(null);
+ if (tokenEndpoint == null) tokenEndpoint = new Future.value();
var optionsFuture = tokenEndpoint.then((tokenEndpoint) {
var options = new ProcessOptions();
options.workingDirectory = pathInSandbox(appPath);
@@ -588,7 +588,7 @@ Future<Pair<List<String>, List<String>>> schedulePackageValidation(
return schedule(() {
var cache = new SystemCache.withSources(path.join(sandboxDir, cachePath));
- return new Future.of(() {
+ return new Future.sync(() {
var validator = fn(new Entrypoint(path.join(sandboxDir, appPath), cache));
return validator.validate().then((_) {
return new Pair(validator.errors, validator.warnings);
« no previous file with comments | « utils/tests/pub/error_group_test.dart ('k') | utils/tests/pub/validator/dependency_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698