anchor.diff:        testWithoutContext('pollingGetDevices throws Unsupported Operation exception on ${unsupportedPlatform.operatingSystem}', () async {
           final IOSDevices iosDevices = IOSDevices(
             platform: unsupportedPlatform,
  -          xcdevice: mockXcdevice,
  -          iosWorkflow: mockIosWorkflow,
  +          xcdevice: xcdevice,
  +          iosWorkflow: iosWorkflow,
             logger: logger,
           );
  -        when(mockXcdevice.isInstalled).thenReturn(false);
  +        xcdevice.isInstalled = false;
           expect(
             () async { await iosDevices.pollingGetDevices(); },
             throwsUnsupportedError,
  
positive.code: 
        await iosDevices.stopPolling();
  
        expect(eventStream.hasListener, isFalse);
      });
  
      testWithoutContext('polling can be restarted if stream is closed', () async {
        final IOSDevices iosDevices = IOSDevices(
          platform: macPlatform,
          xcdevice: mockXcdevice,
          iosWorkflow: mockIosWorkflow,
          logger: logger,
        );
        when(mockXcdevice.isInstalled).thenReturn(true);
  
        when(mockXcdevice.getAvailableIOSDevices())
          .thenAnswer((Invocation invocation) => Future<List<IOSDevice>>.value(<IOSDevice>[]));
  
        final StreamController<Map<XCDeviceEvent, String>> eventStream = StreamController<Map<XCDeviceEvent, String>>();
        final StreamController<Map<XCDeviceEvent, String>> rescheduledStream = StreamController<Map<XCDeviceEvent, String>>();
  
        bool reschedule = false;
        when(mockXcdevice.observedDeviceEvents()).thenAnswer((Invocation invocation) {
          if (!reschedule) {
            reschedule = true;
            return eventStream.stream;
          }
          return rescheduledStream.stream;
        });
  
        await iosDevices.startPolling();
        expect(eventStream.hasListener, isTrue);
        verify(mockXcdevice.getAvailableIOSDevices()).called(1);
  
        // Pretend xcdevice crashed.
        await eventStream.close();
        expect(logger.traceText, contains('xcdevice observe stopped'));
  
        // Confirm a restart still gets streamed events.
        await iosDevices.startPolling();
  
        expect(eventStream.hasListener, isFalse);
        expect(rescheduledStream.hasListener, isTrue);
  
        await iosDevices.stopPolling();
  
negative.code:     testWithoutContext('pollingGetDevices returns attached devices', () async {
        final IOSDevices iosDevices = IOSDevices(
          platform: macPlatform,
          xcdevice: xcdevice,
          iosWorkflow: iosWorkflow,
          logger: logger,
        );
        xcdevice.isInstalled = true;
        xcdevice.devices.add(<IOSDevice>[device1]);
  
        final List<Device> devices = await iosDevices.pollingGetDevices();
  
        expect(devices, hasLength(1));
        expect(devices.first, same(device1));
      });
    });
  
    group('getDiagnostics', () {
      FakeXcdevice xcdevice;
      IOSWorkflow iosWorkflow;
      Logger logger;
  
      setUp(() {
        xcdevice = FakeXcdevice();
        iosWorkflow = FakeIOSWorkflow();
        logger = BufferLogger.test();
      });
  
  