-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[google_maps_flutter] Use an interface for test inspection #6116
[google_maps_flutter] Use an interface for test inspection #6116
Conversation
/// A method-channel-based implementation of [GoogleMapsInspectorPlatform], for | ||
/// use in tests in conjunction with [MethodChannelGoogleMapsFlutter]. | ||
// TODO(stuartmorgan): Move this into the platform implementations when | ||
// federating the mobile implementations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is here with a TODO instead of being moved to live with the default method channel implementation in the platform interface package because I plan to federate the mobile implementations shortly, and move them to in-package method channel implementations, at which point the default method channel inspector would be unused, but we'd be stuck with the extra copy indefinitely since removing it again would be a breaking change. Leaving it local for now lets us avoid that extra copy.
/// Populates [GoogleMapsFlutterInspectorPlatform.instance] to allow | ||
/// inspecting the platform map state. | ||
@visibleForTesting | ||
void enableDebugInspection() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ditman Does this structure address flutter/flutter#80688 (comment)?
My thought was that by having the population controlled from here, you should be able to do whatever bridging is necessary between the private data you mentioned and the web implementation of the inspector. E.g., its constructor could take a reference to the "very private" data you mentioned, or if that's too much access, maybe to a provider object that can access pieces of it via lambas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be enough. The end goal is to "leak" this _googleMap
object to whatever extends GoogleMapsInspectorPlatform
we created for the web:
Which is wrapped by a Controller object that is indexed by mapId here:
(Maybe this method can just enable a boolean that lets us user a _googleMap getter?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks for tackling it.
The only weirdness that I can think of when we eventually endorse the web implementation (with its own Inspector), is that there's certain values that are being passed in as configuration that don't make sense in the web.
So we either store whatever the user wanted and parrot it back, or we adapt the tests to face the truth of the web, where some of the inspected attributes will always be "false" :P
...ps_flutter_platform_interface/lib/src/platform_interface/google_maps_inspector_platform.dart
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_maps_test.dart
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_maps_test.dart
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/example/integration_test/google_maps_test.dart
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter/lib/src/controller.dart
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to implement the web-version of the inspector ASAP next week!
Is there an internal timeline to endorse the web implementation? |
@charlieforward9 Please follow the issue I pointed you to earlier rather than pinging old PRs. PR comments are only for discussion of the PR itself. |
Instead of hard-coding knowledge of platform channel details in the integration test inspector, which makes it impossible to run with any other implementation, add an inspector interface to the platform interface, and use that for the tests.
Fixes flutter/flutter#55504
Precursor to federating mobile implementations for flutter/flutter#68498
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).