[flutter_tools] guard L service extension in debug mode (#79173)

This commit is contained in:
Jonah Williams
2021-03-29 20:54:05 -07:00
committed by GitHub
parent e6920662ad
commit cf6d4a35a5
2 changed files with 17 additions and 1 deletions

View File

@@ -1009,7 +1009,7 @@ abstract class ResidentRunner {
}
Future<bool> debugDumpLayerTree() async {
if (!supportsServiceProtocol) {
if (!supportsServiceProtocol || !isRunningDebug) {
return false;
}
for (final FlutterDevice device in flutterDevices) {

View File

@@ -1976,6 +1976,22 @@ void main() {
verifyNever(mockFlutterDevice.debugDumpLayerTree());
}));
testUsingContext('ResidentRunner debugDumpLayerTree does not call flutter device if not running in debug mode', () => testbed.run(() async {
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
residentRunner = HotRunner(
<FlutterDevice>[
mockFlutterDevice,
],
stayResident: false,
debuggingOptions: DebuggingOptions.enabled(BuildInfo.profile),
target: 'main.dart',
devtoolsHandler: createNoOpHandler,
);
expect(await residentRunner.debugDumpLayerTree(), false);
verifyNever(mockFlutterDevice.debugDumpLayerTree());
}));
testUsingContext('ResidentRunner debugDumpSemanticsTreeInTraversalOrder calls flutter device', () => testbed.run(() async {
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);