diff --git a/packages/flutter_tools/lib/src/commands/drive.dart b/packages/flutter_tools/lib/src/commands/drive.dart index 8b2e084c96c..37f56399bef 100644 --- a/packages/flutter_tools/lib/src/commands/drive.dart +++ b/packages/flutter_tools/lib/src/commands/drive.dart @@ -211,7 +211,7 @@ Future findTargetDevice() async { return null; } else if (devices.length > 1) { printStatus('Found multiple connected devices:'); - printStatus(devices.map((Device d) => ' - ${d.name}\n').join('')); + await Device.printDevices(devices); } printStatus('Using device ${devices.first.name}.'); return devices.first; diff --git a/packages/flutter_tools/test/general.shard/commands/drive_test.dart b/packages/flutter_tools/test/general.shard/commands/drive_test.dart index aad02288faa..a3324be369d 100644 --- a/packages/flutter_tools/test/general.shard/commands/drive_test.dart +++ b/packages/flutter_tools/test/general.shard/commands/drive_test.dart @@ -13,6 +13,7 @@ import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/commands/drive.dart'; import 'package:flutter_tools/src/device.dart'; +import 'package:flutter_tools/src/build_info.dart'; import 'package:mockito/mockito.dart'; import '../../src/common.dart'; @@ -261,9 +262,22 @@ void main() { mockUnsupportedDevice = MockDevice(); when(mockUnsupportedDevice.isSupportedForProject(any)) .thenReturn(false); + when(mockUnsupportedDevice.isSupported()) + .thenReturn(false); + when(mockUnsupportedDevice.name).thenReturn('mock-web'); + when(mockUnsupportedDevice.id).thenReturn('web-1'); + when(mockUnsupportedDevice.targetPlatform).thenAnswer((_) => Future(() => TargetPlatform.web_javascript)); + when(mockUnsupportedDevice.isLocalEmulator).thenAnswer((_) => Future(() => false)); + when(mockUnsupportedDevice.sdkNameAndVersion).thenAnswer((_) => Future(() => 'html5')); + when(mockDevice.name).thenReturn('mock-android-device'); + when(mockDevice.id).thenReturn('mad-28'); + when(mockDevice.isSupported()) + .thenReturn(true); when(mockDevice.isSupportedForProject(any)) .thenReturn(true); - when(mockDevice.name).thenReturn('mock-android-device'); + when(mockDevice.targetPlatform).thenAnswer((_) => Future(() => TargetPlatform.android_x64)); + when(mockDevice.isLocalEmulator).thenAnswer((_) => Future(() => false)); + when(mockDevice.sdkNameAndVersion).thenAnswer((_) => Future(() => 'sdk-28')); testDeviceManager.addDevice(mockDevice); testDeviceManager.addDevice(mockUnsupportedDevice); @@ -310,6 +324,7 @@ void main() { }); Future appStarterSetup() async { + mockDevice = MockDevice(); testDeviceManager.addDevice(mockDevice); final MockDeviceLogReader mockDeviceLogReader = MockDeviceLogReader();