Increase xcdevice timeout to 2 seconds (#53184)

This commit is contained in:
Jenn Magder 2020-03-25 11:14:22 -07:00 committed by GitHub
parent 207efd4cee
commit b860a3912b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View file

@ -275,9 +275,9 @@ class XCDevice {
List<dynamic> _cachedListResults;
/// [timeout] defaults to 1 second.
/// [timeout] defaults to 2 seconds.
Future<List<IOSDevice>> getAvailableTetheredIOSDevices({ Duration timeout }) async {
final List<dynamic> allAvailableDevices = await _getAllDevices(timeout: timeout ?? const Duration(seconds: 1));
final List<dynamic> allAvailableDevices = await _getAllDevices(timeout: timeout ?? const Duration(seconds: 2));
if (allAvailableDevices == null) {
return const <IOSDevice>[];
@ -515,7 +515,7 @@ class XCDevice {
Future<List<String>> getDiagnostics() async {
final List<dynamic> allAvailableDevices = await _getAllDevices(
useCache: true,
timeout: const Duration(seconds: 1)
timeout: const Duration(seconds: 2)
);
if (allAvailableDevices == null) {

View file

@ -262,8 +262,8 @@ void main() {
when(processManager.runSync(<String>['xcrun', '--find', 'xcdevice']))
.thenReturn(ProcessResult(1, 0, '/path/to/xcdevice', ''));
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '1']))
.thenThrow(const ProcessException('xcrun', <String>['xcdevice', 'list', '--timeout', '1']));
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '2']))
.thenThrow(const ProcessException('xcrun', <String>['xcdevice', 'list', '--timeout', '2']));
expect(await xcdevice.getAvailableTetheredIOSDevices(), isEmpty);
});
@ -367,7 +367,7 @@ void main() {
]
''';
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '1']))
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '2']))
.thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 0, devicesOutput, '')));
final List<IOSDevice> devices = await xcdevice.getAvailableTetheredIOSDevices();
expect(devices, hasLength(3));
@ -429,7 +429,7 @@ void main() {
]
''';
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '1']))
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '2']))
.thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 0, devicesOutput, '')));
final List<IOSDevice> devices = await xcdevice.getAvailableTetheredIOSDevices();
expect(devices, hasLength(1));
@ -456,8 +456,8 @@ void main() {
when(processManager.runSync(<String>['xcrun', '--find', 'xcdevice']))
.thenReturn(ProcessResult(1, 0, '/path/to/xcdevice', ''));
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '1']))
.thenThrow(const ProcessException('xcrun', <String>['xcdevice', 'list', '--timeout', '1']));
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '2']))
.thenThrow(const ProcessException('xcrun', <String>['xcdevice', 'list', '--timeout', '2']));
expect(await xcdevice.getDiagnostics(), isEmpty);
});
@ -489,7 +489,7 @@ void main() {
]
''';
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '1']))
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '2']))
.thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 0, devicesOutput, '')));
await xcdevice.getAvailableTetheredIOSDevices();
final List<String> errors = await xcdevice.getDiagnostics();
@ -591,7 +591,7 @@ void main() {
]
''';
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '1']))
when(processManager.run(<String>['xcrun', 'xcdevice', 'list', '--timeout', '2']))
.thenAnswer((_) => Future<ProcessResult>.value(ProcessResult(1, 0, devicesOutput, '')));
final List<String> errors = await xcdevice.getDiagnostics();
expect(errors, hasLength(4));