diff --git a/packages/flutter_tools/lib/src/macos/xcode.dart b/packages/flutter_tools/lib/src/macos/xcode.dart index e82a4da6a5..fe2106edb2 100644 --- a/packages/flutter_tools/lib/src/macos/xcode.dart +++ b/packages/flutter_tools/lib/src/macos/xcode.dart @@ -275,9 +275,9 @@ class XCDevice { List _cachedListResults; - /// [timeout] defaults to 1 second. + /// [timeout] defaults to 2 seconds. Future> getAvailableTetheredIOSDevices({ Duration timeout }) async { - final List allAvailableDevices = await _getAllDevices(timeout: timeout ?? const Duration(seconds: 1)); + final List allAvailableDevices = await _getAllDevices(timeout: timeout ?? const Duration(seconds: 2)); if (allAvailableDevices == null) { return const []; @@ -515,7 +515,7 @@ class XCDevice { Future> getDiagnostics() async { final List allAvailableDevices = await _getAllDevices( useCache: true, - timeout: const Duration(seconds: 1) + timeout: const Duration(seconds: 2) ); if (allAvailableDevices == null) { diff --git a/packages/flutter_tools/test/general.shard/macos/xcode_test.dart b/packages/flutter_tools/test/general.shard/macos/xcode_test.dart index dbf273c288..6f90097275 100644 --- a/packages/flutter_tools/test/general.shard/macos/xcode_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/xcode_test.dart @@ -262,8 +262,8 @@ void main() { when(processManager.runSync(['xcrun', '--find', 'xcdevice'])) .thenReturn(ProcessResult(1, 0, '/path/to/xcdevice', '')); - when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '1'])) - .thenThrow(const ProcessException('xcrun', ['xcdevice', 'list', '--timeout', '1'])); + when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '2'])) + .thenThrow(const ProcessException('xcrun', ['xcdevice', 'list', '--timeout', '2'])); expect(await xcdevice.getAvailableTetheredIOSDevices(), isEmpty); }); @@ -367,7 +367,7 @@ void main() { ] '''; - when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '1'])) + when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '2'])) .thenAnswer((_) => Future.value(ProcessResult(1, 0, devicesOutput, ''))); final List devices = await xcdevice.getAvailableTetheredIOSDevices(); expect(devices, hasLength(3)); @@ -429,7 +429,7 @@ void main() { ] '''; - when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '1'])) + when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '2'])) .thenAnswer((_) => Future.value(ProcessResult(1, 0, devicesOutput, ''))); final List devices = await xcdevice.getAvailableTetheredIOSDevices(); expect(devices, hasLength(1)); @@ -456,8 +456,8 @@ void main() { when(processManager.runSync(['xcrun', '--find', 'xcdevice'])) .thenReturn(ProcessResult(1, 0, '/path/to/xcdevice', '')); - when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '1'])) - .thenThrow(const ProcessException('xcrun', ['xcdevice', 'list', '--timeout', '1'])); + when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '2'])) + .thenThrow(const ProcessException('xcrun', ['xcdevice', 'list', '--timeout', '2'])); expect(await xcdevice.getDiagnostics(), isEmpty); }); @@ -489,7 +489,7 @@ void main() { ] '''; - when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '1'])) + when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '2'])) .thenAnswer((_) => Future.value(ProcessResult(1, 0, devicesOutput, ''))); await xcdevice.getAvailableTetheredIOSDevices(); final List errors = await xcdevice.getDiagnostics(); @@ -591,7 +591,7 @@ void main() { ] '''; - when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '1'])) + when(processManager.run(['xcrun', 'xcdevice', 'list', '--timeout', '2'])) .thenAnswer((_) => Future.value(ProcessResult(1, 0, devicesOutput, ''))); final List errors = await xcdevice.getDiagnostics(); expect(errors, hasLength(4));