[flutter_tools] allow hiding web server device, provide flags to re-enable (#71434)

This commit is contained in:
Jonah Williams
2020-12-01 09:53:27 -08:00
committed by GitHub
parent 0a08f8afff
commit 5d201a35aa
3 changed files with 34 additions and 2 deletions

View File

@@ -159,7 +159,8 @@ void main() {
isNot(contains(isA<MicrosoftEdgeDevice>())));
});
testWithoutContext('Web Server device is listed by default', () async {
testWithoutContext('Web Server device is listed if enabled via showWebServerDevice', () async {
WebServerDevice.showWebServerDevice = true;
final WebDevices webDevices = WebDevices(
featureFlags: TestFeatureFlags(isWebEnabled: true),
fileSystem: MemoryFileSystem.test(),
@@ -175,6 +176,23 @@ void main() {
contains(isA<WebServerDevice>()));
});
testWithoutContext('Web Server device is not listed if disabled via showWebServerDevice', () async {
WebServerDevice.showWebServerDevice = false;
final WebDevices webDevices = WebDevices(
featureFlags: TestFeatureFlags(isWebEnabled: true),
fileSystem: MemoryFileSystem.test(),
logger: BufferLogger.test(),
platform: FakePlatform(
operatingSystem: 'linux',
environment: <String, String>{}
),
processManager: FakeProcessManager.any(),
);
expect(await webDevices.pollingGetDevices(),
isNot(contains(isA<WebServerDevice>())));
});
testWithoutContext('Chrome invokes version command on non-Windows platforms', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(