[flutter_tools] Launch DevTools with 'v' (#53902)

This commit is contained in:
Zachary Anderson
2020-04-04 19:51:01 -07:00
committed by GitHub
parent caeaac7739
commit fef9d4d7cd
5 changed files with 55 additions and 0 deletions

View File

@@ -66,6 +66,7 @@ void _testMessageLength({
expect(commandHelp.r.toString().length, lessThanOrEqualTo(expectedWidth));
expect(commandHelp.s.toString().length, lessThanOrEqualTo(expectedWidth));
expect(commandHelp.t.toString().length, lessThanOrEqualTo(expectedWidth));
expect(commandHelp.v.toString().length, lessThanOrEqualTo(expectedWidth));
expect(commandHelp.w.toString().length, lessThanOrEqualTo(expectedWidth));
expect(commandHelp.z.toString().length, lessThanOrEqualTo(expectedWidth));
}
@@ -95,6 +96,7 @@ void main() {
expect(commandHelp.r.toString(), startsWith('\x1B[1mr\x1B[22m'));
expect(commandHelp.s.toString(), startsWith('\x1B[1ms\x1B[22m'));
expect(commandHelp.t.toString(), startsWith('\x1B[1mt\x1B[22m'));
expect(commandHelp.v.toString(), startsWith('\x1B[1mv\x1B[22m'));
expect(commandHelp.w.toString(), startsWith('\x1B[1mw\x1B[22m'));
expect(commandHelp.z.toString(), startsWith('\x1B[1mz\x1B[22m'));
});
@@ -170,6 +172,7 @@ void main() {
expect(commandHelp.r.toString(), equals('\x1B[1mr\x1B[22m Hot reload. $fire$fire$fire'));
expect(commandHelp.s.toString(), equals('\x1B[1ms\x1B[22m Save a screenshot to flutter.png.'));
expect(commandHelp.t.toString(), equals('\x1B[1mt\x1B[22m Dump rendering tree to the console. \x1B[1;30m(debugDumpRenderTree)\x1B[39m'));
expect(commandHelp.v.toString(), equals('\x1B[1mv\x1B[22m Launch DevTools.'));
expect(commandHelp.w.toString(), equals('\x1B[1mw\x1B[22m Dump widget hierarchy to the console. \x1B[1;30m(debugDumpApp)\x1B[39m'));
expect(commandHelp.z.toString(), equals('\x1B[1mz\x1B[22m Toggle elevation checker.'));
});
@@ -195,6 +198,7 @@ void main() {
expect(commandHelp.r.toString(), equals('r Hot reload. $fire$fire$fire'));
expect(commandHelp.s.toString(), equals('s Save a screenshot to flutter.png.'));
expect(commandHelp.t.toString(), equals('t Dump rendering tree to the console. (debugDumpRenderTree)'));
expect(commandHelp.v.toString(), equals('v Launch DevTools.'));
expect(commandHelp.w.toString(), equals('w Dump widget hierarchy to the console. (debugDumpApp)'));
expect(commandHelp.z.toString(), equals('z Toggle elevation checker.'));
});

View File

@@ -406,6 +406,7 @@ void main() {
commandHelp.p,
commandHelp.o,
commandHelp.z,
commandHelp.v,
commandHelp.P,
commandHelp.a,
'An Observatory debugger and profiler on null is available at: null',

View File

@@ -364,6 +364,13 @@ void main() {
verifyNever(mockResidentRunner.debugDumpSemanticsTreeInInverseHitTestOrder());
});
testUsingContext('v - launchDevTools', () async {
when(mockResidentRunner.supportsServiceProtocol).thenReturn(true);
await terminalHandler.processTerminalInput('v');
verify(mockResidentRunner.launchDevTools()).called(1);
});
testUsingContext('w,W - debugDumpApp with service protocol', () async {
await terminalHandler.processTerminalInput('w');
await terminalHandler.processTerminalInput('W');