| 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:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 }), "waiting to reach shouldExit() or kill() for process " | 191 }), "waiting to reach shouldExit() or kill() for process " |
| 192 "'$description'"); | 192 "'$description'"); |
| 193 }); | 193 }); |
| 194 } | 194 } |
| 195 | 195 |
| 196 /// Converts a stream of bytes to a stream of lines and returns that along | 196 /// Converts a stream of bytes to a stream of lines and returns that along |
| 197 /// with a [StreamCanceller] controlling it. | 197 /// with a [StreamCanceller] controlling it. |
| 198 Pair<Stream<String>, StreamCanceller> _lineStreamWithCanceller( | 198 Pair<Stream<String>, StreamCanceller> _lineStreamWithCanceller( |
| 199 Future<Stream<List<int>>> streamFuture) { | 199 Future<Stream<List<int>>> streamFuture) { |
| 200 return streamWithCanceller(futureStream(streamFuture) | 200 return streamWithCanceller(futureStream(streamFuture) |
| 201 .handleError((e) => currentSchedule.signalError(e)) | 201 .handleError(currentSchedule.signalError) |
| 202 .map((chunk) { | 202 .map((chunk) { |
| 203 // Whenever the process produces any sort of output, reset the schedule's | 203 // Whenever the process produces any sort of output, reset the schedule's |
| 204 // timer. | 204 // timer. |
| 205 currentSchedule.heartbeat(); | 205 currentSchedule.heartbeat(); |
| 206 return chunk; | 206 return chunk; |
| 207 }) | 207 }) |
| 208 .transform(_encoding.decoder) | 208 .transform(_encoding.decoder) |
| 209 .transform(new LineSplitter())); | 209 .transform(new LineSplitter())); |
| 210 } | 210 } |
| 211 | 211 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 schedule(() { | 348 schedule(() { |
| 349 _endExpected = true; | 349 _endExpected = true; |
| 350 return _exitCode.then((exitCode) { | 350 return _exitCode.then((exitCode) { |
| 351 if (expectedExitCode != null) { | 351 if (expectedExitCode != null) { |
| 352 expect(exitCode, equals(expectedExitCode)); | 352 expect(exitCode, equals(expectedExitCode)); |
| 353 } | 353 } |
| 354 }); | 354 }); |
| 355 }, "waiting for process '$description' to exit"); | 355 }, "waiting for process '$description' to exit"); |
| 356 } | 356 } |
| 357 } | 357 } |
| OLD | NEW |