File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ class IOSDevices extends PollingDeviceDiscovery {
6969 'Control of iOS devices or simulators only supported on macOS.'
7070 );
7171 }
72+ if (! _xcdevice.isInstalled) {
73+ return ;
74+ }
7275
7376 deviceNotifier ?? = ItemListNotifier <Device >();
7477
@@ -77,7 +80,7 @@ class IOSDevices extends PollingDeviceDiscovery {
7780
7881 // cancel any outstanding subscriptions.
7982 await _observedDeviceEventsSubscription? .cancel ();
80- _observedDeviceEventsSubscription = _xcdevice.observedDeviceEvents ().listen (
83+ _observedDeviceEventsSubscription = _xcdevice.observedDeviceEvents ()? .listen (
8184 _onDeviceEvent,
8285 onError: (dynamic error, StackTrace stack) {
8386 _logger.printTrace ('Process exception running xcdevice observe:\n $error \n $stack ' );
Original file line number Diff line number Diff line change @@ -318,6 +318,19 @@ void main() {
318318 );
319319 });
320320
321+ testWithoutContext ('start polling without Xcode' , () async {
322+ final IOSDevices iosDevices = IOSDevices (
323+ platform: macPlatform,
324+ xcdevice: mockXcdevice,
325+ iosWorkflow: mockIosWorkflow,
326+ logger: logger,
327+ );
328+ when (mockXcdevice.isInstalled).thenReturn (false );
329+
330+ await iosDevices.startPolling ();
331+ verifyNever (mockXcdevice.getAvailableTetheredIOSDevices ());
332+ });
333+
321334 testWithoutContext ('start polling' , () async {
322335 final IOSDevices iosDevices = IOSDevices (
323336 platform: macPlatform,
You can’t perform that action at this time.
0 commit comments