Unverified Commit 5c334d10 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

Revert "show web-server in flutter devices (#121373)" (#121532)

Revert "[flutter_tools] show web-server in flutter devices"
parent fd65fd1b
......@@ -18,6 +18,7 @@ import '../cache.dart';
import '../convert.dart';
import '../globals.dart' as globals;
import '../tester/flutter_tester.dart';
import '../web/web_device.dart';
class FlutterCommandRunner extends CommandRunner<void> {
FlutterCommandRunner({ bool verboseHelp = false }) : super(
......@@ -111,6 +112,11 @@ class FlutterCommandRunner extends CommandRunner<void> {
hide: !verboseHelp,
help: 'List the special "flutter-tester" device in device listings. '
'This headless device is used to test Flutter tooling.');
argParser.addFlag('show-web-server-device',
negatable: false,
hide: !verboseHelp,
help: 'List the special "web-server" device in device listings.',
);
}
@override
......@@ -209,6 +215,10 @@ class FlutterCommandRunner extends CommandRunner<void> {
|| topLevelResults['device-id'] == FlutterTesterDevices.kTesterDeviceId) {
FlutterTesterDevices.showFlutterTesterDevice = true;
}
if (((topLevelResults['show-web-server-device'] as bool?) ?? false)
|| topLevelResults['device-id'] == WebServerDevice.kWebServerDeviceId) {
WebServerDevice.showWebServerDevice = true;
}
// Set up the tooling configuration.
final EngineBuildPaths? engineBuildPaths = await globals.localEngineLocator?.findEnginePath(
......
......@@ -357,6 +357,7 @@ class WebDevices extends PollingDeviceDiscovery {
}
final MicrosoftEdgeDevice? edgeDevice = _edgeDevice;
return <Device>[
if (WebServerDevice.showWebServerDevice)
_webServerDevice,
if (_chromeDevice.isSupported())
_chromeDevice,
......@@ -391,6 +392,7 @@ class WebServerDevice extends Device {
);
static const String kWebServerDeviceId = 'web-server';
static bool showWebServerDevice = false;
final Logger _logger;
......
......@@ -189,7 +189,8 @@ void main() {
isNot(contains(isA<GoogleChromeDevice>())));
});
testWithoutContext('Web Server device is listed', () 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(),
......@@ -204,6 +205,22 @@ 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(
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(
......
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