use common emulator/device list (#38296)
diff --git a/packages/flutter_tools/lib/src/commands/drive.dart b/packages/flutter_tools/lib/src/commands/drive.dart index 8b2e084..37f5639 100644 --- a/packages/flutter_tools/lib/src/commands/drive.dart +++ b/packages/flutter_tools/lib/src/commands/drive.dart
@@ -211,7 +211,7 @@ return null; } else if (devices.length > 1) { printStatus('Found multiple connected devices:'); - printStatus(devices.map<String>((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 aad0228..a3324be 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/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 @@ 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>(() => TargetPlatform.web_javascript)); + when(mockUnsupportedDevice.isLocalEmulator).thenAnswer((_) => Future<bool>(() => false)); + when(mockUnsupportedDevice.sdkNameAndVersion).thenAnswer((_) => Future<String>(() => '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>(() => TargetPlatform.android_x64)); + when(mockDevice.isLocalEmulator).thenAnswer((_) => Future<bool>(() => false)); + when(mockDevice.sdkNameAndVersion).thenAnswer((_) => Future<String>(() => 'sdk-28')); testDeviceManager.addDevice(mockDevice); testDeviceManager.addDevice(mockUnsupportedDevice); @@ -310,6 +324,7 @@ }); Future<void> appStarterSetup() async { + mockDevice = MockDevice(); testDeviceManager.addDevice(mockDevice); final MockDeviceLogReader mockDeviceLogReader = MockDeviceLogReader();