Commit ed88d28d authored by Ingo Reinhart's avatar Ingo Reinhart Committed by Jonah Williams

use common emulator/device list (#38296)

parent 1033155f
......@@ -211,7 +211,7 @@ Future<Device> findTargetDevice() async {
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;
......
......@@ -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>(() => 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 @@ void main() {
});
Future<void> appStarterSetup() async {
mockDevice = MockDevice();
testDeviceManager.addDevice(mockDevice);
final MockDeviceLogReader mockDeviceLogReader = MockDeviceLogReader();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment