OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |