mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
use common emulator/device list (#38296)
This commit is contained in:
parent
1033155fb9
commit
ed88d28d52
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user