[flutter_tools] flutter logs no longer requires supported device (#66696)
Flutter logs should not attempt to filter the device list based on the current project, because it does not require a current project. Also fix disabled polling test Fixes #47996 Fixes #63550
This commit is contained in:
@@ -79,6 +79,4 @@ void main() {
|
||||
});
|
||||
}
|
||||
|
||||
class MockDeviceManager extends Mock implements DeviceManager {
|
||||
|
||||
}
|
||||
class MockDeviceManager extends Mock implements DeviceManager {}
|
||||
|
||||
@@ -137,26 +137,26 @@ void main() {
|
||||
});
|
||||
|
||||
group('PollingDeviceDiscovery', () {
|
||||
testUsingContext('startPolling', () async {
|
||||
await FakeAsync().run((FakeAsync time) async {
|
||||
testUsingContext('startPolling', () {
|
||||
FakeAsync().run((FakeAsync time) {
|
||||
final FakePollingDeviceDiscovery pollingDeviceDiscovery = FakePollingDeviceDiscovery();
|
||||
await pollingDeviceDiscovery.startPolling();
|
||||
pollingDeviceDiscovery.startPolling();
|
||||
time.elapse(const Duration(milliseconds: 4001));
|
||||
time.flushMicrotasks();
|
||||
|
||||
// First check should use the default polling timeout
|
||||
// to quickly populate the list.
|
||||
expect(pollingDeviceDiscovery.lastPollingTimeout, isNull);
|
||||
|
||||
time.elapse(const Duration(milliseconds: 4001));
|
||||
time.flushMicrotasks();
|
||||
|
||||
// Subsequent polling should be much longer.
|
||||
expect(pollingDeviceDiscovery.lastPollingTimeout, const Duration(seconds: 30));
|
||||
await pollingDeviceDiscovery.stopPolling();
|
||||
pollingDeviceDiscovery.stopPolling();
|
||||
});
|
||||
}, overrides: <Type, Generator>{
|
||||
Artifacts: () => Artifacts.test(),
|
||||
Cache: () => cache,
|
||||
}, skip: true); // TODO(jonahwilliams): clean up with https://github.com/flutter/flutter/issues/60675
|
||||
});
|
||||
});
|
||||
|
||||
group('Filter devices', () {
|
||||
@@ -369,6 +369,20 @@ void main() {
|
||||
Cache: () => cache,
|
||||
});
|
||||
|
||||
testUsingContext('Does not remove an unsupported device if FlutterProject is null', () async {
|
||||
final List<Device> devices = <Device>[
|
||||
unsupported,
|
||||
];
|
||||
|
||||
final DeviceManager deviceManager = TestDeviceManager(devices);
|
||||
final List<Device> filtered = await deviceManager.findTargetDevices(null);
|
||||
|
||||
expect(filtered, <Device>[unsupported]);
|
||||
}, overrides: <Type, Generator>{
|
||||
Artifacts: () => Artifacts.test(),
|
||||
Cache: () => cache,
|
||||
});
|
||||
|
||||
testUsingContext('Removes web and fuchsia from --all', () async {
|
||||
final List<Device> devices = <Device>[
|
||||
webDevice,
|
||||
@@ -428,9 +442,7 @@ void main() {
|
||||
];
|
||||
final MockDeviceDiscovery mockDeviceDiscovery = MockDeviceDiscovery();
|
||||
when(mockDeviceDiscovery.supportsPlatform).thenReturn(true);
|
||||
// when(mockDeviceDiscovery.discoverDevices(timeout: timeout)).thenAnswer((_) async => devices);
|
||||
when(mockDeviceDiscovery.devices).thenAnswer((_) async => devices);
|
||||
// when(mockDeviceDiscovery.discoverDevices(timeout: timeout)).thenAnswer((_) async => devices);
|
||||
|
||||
final DeviceManager deviceManager = TestDeviceManager(<Device>[], deviceDiscoveryOverrides: <DeviceDiscovery>[
|
||||
mockDeviceDiscovery
|
||||
@@ -457,7 +469,6 @@ void main() {
|
||||
when(mockDeviceDiscovery.supportsPlatform).thenReturn(true);
|
||||
when(mockDeviceDiscovery.discoverDevices(timeout: timeout)).thenAnswer((_) async => devices);
|
||||
when(mockDeviceDiscovery.devices).thenAnswer((_) async => devices);
|
||||
// when(mockDeviceDiscovery.discoverDevices(timeout: timeout)).thenAnswer((_) async => devices);
|
||||
|
||||
final DeviceManager deviceManager = TestDeviceManager(<Device>[], deviceDiscoveryOverrides: <DeviceDiscovery>[
|
||||
mockDeviceDiscovery
|
||||
|
||||
@@ -515,7 +515,7 @@ void main() {
|
||||
expect(iosDevices.deviceNotifier.items, isEmpty);
|
||||
expect(eventStream.hasListener, isTrue);
|
||||
|
||||
await iosDevices.dispose();
|
||||
iosDevices.dispose();
|
||||
expect(eventStream.hasListener, isFalse);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user