| 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 |
| 11 import 'scheduled_test.dart'; | 11 import 'scheduled_test.dart'; |
| 12 import 'src/utils.dart'; | 12 import 'src/utils.dart'; |
| 13 import 'src/value_future.dart'; | 13 import 'src/value_future.dart'; |
| 14 | 14 |
| 15 /// A class representing a [Process] that is scheduled to run in the course of | 15 /// A class representing a [Process] that is scheduled to run in the course of |
| 16 /// the test. This class allows actions on the process to be scheduled | 16 /// the test. This class allows actions on the process to be scheduled |
| 17 /// synchronously. All operations on this class are scheduled. | 17 /// synchronously. All operations on this class are scheduled. |
| 18 /// | 18 /// |
| 19 /// Before running the test, either [shouldExit] or [kill] must be called on | 19 /// Before running the test, either [shouldExit] or [kill] must be called on |
| 20 /// this to ensure that the process terminates when expected. Note that [kill] | 20 /// this to ensure that the process terminates when expected. Note that [kill] |
| 21 /// is using SIGKILL, to ensure the process is killed on Mac OS X (an early | 21 /// is using SIGKILL, to ensure the process is killed on Mac OS X (an early |
| 22 /// SIGTERM on Mac OS X may be ignore). | 22 /// SIGTERM on Mac OS X may be ignored). |
| 23 /// | 23 /// |
| 24 /// If the test fails, this will automatically print out any stdout and stderr | 24 /// If the test fails, this will automatically print out any stdout and stderr |
| 25 /// from the process to aid debugging. | 25 /// from the process to aid debugging. |
| 26 class ScheduledProcess { | 26 class ScheduledProcess { |
| 27 /// A description of the process. Used for error reporting. | 27 /// A description of the process. Used for error reporting. |
| 28 String get description => _description; | 28 String get description => _description; |
| 29 String _description; | 29 String _description; |
| 30 | 30 |
| 31 /// Whether a description was passed explicitly by the user. | 31 /// Whether a description was passed explicitly by the user. |
| 32 bool _explicitDescription; | 32 bool _explicitDescription; |
| (...skipping 315 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 |