Skip to content

[flutter_tools] Remove web specific vm_service handlers, move handler tests to single location#80440

Merged
fluttergithubbot merged 4 commits intoflutter:masterfrom
jonahwilliams:updated_android_sdk_tools
Apr 18, 2021
Merged

[flutter_tools] Remove web specific vm_service handlers, move handler tests to single location#80440
fluttergithubbot merged 4 commits intoflutter:masterfrom
jonahwilliams:updated_android_sdk_tools

Conversation

@jonahwilliams
Copy link
Contributor

@jonahwilliams jonahwilliams commented Apr 14, 2021

The goal of this PR is to move the resident runners closer to a state where enough of the implementation is shared to enable 1) profile/release/debug autodetect for flutter attach and 2) simultaneous connections to web and non-web devices. I also wanted to remove the vast amounts of duplicated test logic due to the web and non-web resident runners having different service extension impls as well as remove the mocks from the terminal handler test and re-imagine it as a fairly high level interaction test.

Changes in resident_runner.dart:

  • Creates a new class ResidentHandlers which contains the vm service delegation, make it easier to share with the web impl for now. This required exposing Logger and FileSystem as protected members.
  • Removes all of the wrapper vm service functionality from the FlutterDevice class. Now that the logic is in a single place it doesn't make as much sense to split it up.
  • Updates FlutterDevice to conditionally use getVM's isolate list instead of listing the flutter views. The flutter view RPC is not supported on the web, but since there is only ever one isolate we can use the VM list. This required exposing the TargetPlatform field on FlutterDevice, which was already part of the constructor.

Changes in resident runner testing:

  • Deleted all tests that only checked that service extensions were called correctly

Changes in resident_web_runner testing:

  • Deleted all tests that only checked that service extensions were called correctly

Changes in terminal_handler testing:

Updated the test set up to remove the use of mocks, and to extend most test cases to include a web case.

clean ups:

  • Remove the requirement to inject fsUtils to grab the unique file functionality, since all this needs is a FileSystem.
  • Removes the feature flag check for debug target platform. I think its OK to let people toggle to macOS .

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 14, 2021
@google-cla google-cla bot added the cla: yes label Apr 14, 2021
}

@override
Future<bool> debugDumpApp() async {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of these now use the same implementation as the "regular" resident runner.

return devFS.create();
}

Future<void> debugDumpApp() async {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Inlined all of these into the resident runner.

/// Invoke an RPC extension method on the first attached ui isolate of the first device.
// TODO(jonahwilliams): Update/Remove this method when refactoring the resident
// runner to support a single flutter device.
Future<Map<String, dynamic>> invokeFlutterExtensionRpcRawOnFirstIsolate(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

inlined into the remaining use site in daemon.dart

@jonahwilliams jonahwilliams marked this pull request as ready for review April 17, 2021 00:40
@jonahwilliams
Copy link
Contributor Author

Rebased on the previous PR, now this is only the test re-arrangement and the removal of the web specific vm service delegation

@jonahwilliams jonahwilliams requested a review from jmagman April 17, 2021 00:42
@jonahwilliams jonahwilliams changed the title Refactor resident runners to use shared devfs interactions Remove web specific vm_service handlers, move handler tests to single location Apr 17, 2021
@jonahwilliams jonahwilliams changed the title Remove web specific vm_service handlers, move handler tests to single location [flutter_tools] Remove web specific vm_service handlers, move handler tests to single location Apr 17, 2021
Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

Thanks, this was much easier to review in two pieces.
LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

3 participants