Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flutter_tools] Launch DevTools with 'v' #53902

Merged
merged 1 commit into from
Apr 5, 2020
Merged

[flutter_tools] Launch DevTools with 'v' #53902

merged 1 commit into from
Apr 5, 2020

Conversation

zanderso
Copy link
Member

@zanderso zanderso commented Apr 3, 2020

Description

Launch DevTools from the resident runner with 'v' when there is a vm service available.

Related Issues

#41407

Tests

I added the following tests:

I updated tests of the command help.

Breaking Change

Did any tests fail when you ran them? Please read [Handling breaking changes].

  • No, no existing tests failed, so this is not a breaking change.

@zanderso zanderso added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 3, 2020
@zanderso
Copy link
Member Author

zanderso commented Apr 3, 2020

/cc @jonahwilliams for thoughts on testing. One option would be to wrap the devtools_server methods in an inject-able class, and then verify in existing tests that the methods are called when a mock is injected. wdyt?

@@ -982,6 +985,33 @@ abstract class ResidentRunner {
}
}

io.HttpServer _devtoolsServer;

Future<void> launchDevTools() async {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For testing: what I would do is give the ResidentRunner an optional constructor argument:

Future<io.HttpServer> Function({bool enableStdinCommands}) serveDevTools

Then in the launchDevTools method do something like:

await (serveDevTools ?? devtools_server.serveDevTools)(enabledStinCommands: false)

That way we can test it without adding more to the context in the short term

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After further thought, not much of the behavior of the devtools server and its client in the browser can be tested. Instead, I added a test to terminal_handler_test.dart that ensures that ResidentRunner.launchDevTools is called when we get 'v' on the terminal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah seems reasonable to me

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jacob314
Copy link
Contributor

jacob314 commented Apr 6, 2020

This is great.
It would be nice to display a link to this URL in the console rather than
"An Observatory debugger and profiler on iPhone 11 Pro Max is available at:
http:https://127.0.0.1:56450/asdfasdfw=/"
We could provide a link from DevTools to the observatory as an affordance for advanced users who need functionality not yet in DevTools.

@zanderso zanderso deleted the launch-devtools branch April 6, 2020 18:47
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants