Unverified Commit b860a391 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Increase xcdevice timeout to 2 seconds (#53184)

parent 207efd4c
......@@ -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) {
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment