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

Side by Side Diff: pkg/scheduled_test/lib/scheduled_process.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/oauth2/test/utils.dart ('k') | pkg/scheduled_test/lib/scheduled_server.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library scheduled_test.scheduled_process; 5 library scheduled_test.scheduled_process;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'scheduled_test.dart'; 10 import 'scheduled_test.dart';
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 _process = new ValueFuture(schedule(() { 128 _process = new ValueFuture(schedule(() {
129 if (!_endScheduled) { 129 if (!_endScheduled) {
130 throw new StateError("Scheduled process '$description' must " 130 throw new StateError("Scheduled process '$description' must "
131 "have shouldExit() or kill() called before the test is run."); 131 "have shouldExit() or kill() called before the test is run.");
132 } 132 }
133 133
134 _handleExit(exitCodeCompleter); 134 _handleExit(exitCodeCompleter);
135 135
136 return Future.wait([ 136 return Future.wait([
137 new Future.of(() => executable), 137 new Future.sync(() => executable),
138 awaitObject(arguments), 138 awaitObject(arguments),
139 new Future.of(() => options) 139 new Future.sync(() => options)
140 ]).then((results) { 140 ]).then((results) {
141 executable = results[0]; 141 executable = results[0];
142 arguments = results[1]; 142 arguments = results[1];
143 options = results[2]; 143 options = results[2];
144 _updateDescription(executable, arguments); 144 _updateDescription(executable, arguments);
145 return Process.start(executable, arguments, options).then((process) { 145 return Process.start(executable, arguments, options).then((process) {
146 // TODO(nweiz): enable this when issue 9020 is fixed. 146 // TODO(nweiz): enable this when issue 9020 is fixed.
147 // process.stdin.encoding = Encoding.UTF_8; 147 // process.stdin.encoding = Encoding.UTF_8;
148 return process; 148 return process;
149 }); 149 });
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 schedule(() { 305 schedule(() {
306 _endExpected = true; 306 _endExpected = true;
307 return _exitCode.then((exitCode) { 307 return _exitCode.then((exitCode) {
308 if (expectedExitCode != null) { 308 if (expectedExitCode != null) {
309 expect(exitCode, equals(expectedExitCode)); 309 expect(exitCode, equals(expectedExitCode));
310 } 310 }
311 }); 311 });
312 }, "waiting for process '$description' to exit"); 312 }, "waiting for process '$description' to exit");
313 } 313 }
314 } 314 }
OLDNEW
« no previous file with comments | « pkg/oauth2/test/utils.dart ('k') | pkg/scheduled_test/lib/scheduled_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698