Ensure web-server does not force usage of dwds (#44744)

This commit is contained in:
Jonah Williams
2019-11-12 15:24:45 -08:00
committed by GitHub
parent 3383b564a1
commit 2779361b38
2 changed files with 19 additions and 3 deletions

View File

@@ -602,7 +602,7 @@ class _DwdsResidentWebRunner extends ResidentWebRunner {
initializePlatform: debuggingOptions.initializePlatform,
hostname: debuggingOptions.hostname,
port: debuggingOptions.port,
skipDwds: device is WebServerDevice || !debuggingOptions.buildInfo.isDebug,
skipDwds: device.device is WebServerDevice || !debuggingOptions.buildInfo.isDebug,
dartDefines: dartDefines,
);
// When connecting to a browser, update the message with a seemsSlow notification

View File

@@ -48,6 +48,7 @@ void main() {
MockChromeTab mockChromeTab;
MockWipConnection mockWipConnection;
MockWipDebugger mockWipDebugger;
bool didSkipDwds;
setUp(() {
resetChromeForTesting();
@@ -87,6 +88,7 @@ void main() {
@required String port,
@required List<String> dartDefines,
}) async {
didSkipDwds = skipDwds;
return mockWebFs;
},
},
@@ -127,9 +129,9 @@ void main() {
when(mockWipConnection.debugger).thenReturn(mockWipDebugger);
}
test('runner with web server device does not support debugging', () => testbed.run(() {
test('runner with web server device does not support debugging', () => testbed.run(() async {
when(mockFlutterDevice.device).thenReturn(WebServerDevice());
final ResidentRunner profileResidentWebRunner = residentWebRunner = DwdsWebRunnerFactory().createWebRunner(
final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner(
mockFlutterDevice,
flutterProject: FlutterProject.current(),
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
@@ -145,6 +147,20 @@ void main() {
expect(residentWebRunner.debuggingEnabled, true);
}));
test('runner with web server device does not initialize dwds', () => testbed.run(() async {
_setupMocks();
when(mockFlutterDevice.device).thenReturn(WebServerDevice());
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
unawaited(residentWebRunner.run(
connectionInfoCompleter: connectionInfoCompleter,
));
await connectionInfoCompleter.future;
expect(didSkipDwds, true);
}));
test('profile does not supportsServiceProtocol', () => testbed.run(() {
when(mockFlutterDevice.device).thenReturn(mockChromeDevice);
final ResidentRunner profileResidentWebRunner = DwdsWebRunnerFactory().createWebRunner(