-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[google_maps_flutter] Started dispatching platform messages from platform thread #6069
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
Conversation
8db0774
to
3e13780
Compare
The criteria for testing is not that we only test new functionality, it's https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
The thing you are fixing here is not meaningfully covered by current tests, as evidenced by the fact that they pass. This can be tested via native unit tests. Some relevant examples:
|
Do the engine builders publish those artifacts? |
Right, the point is that the code in this PR has test coverage. It is executed inside of a test and it is evaluated to give the correct results, not that the thing that caused issue is asserted to be fixed in a test. Those examples aren't doing exactly this. I'll be the first one asserting that platform channels are being used from the correct thread. Mocking out platform channels will be a poor substitute for asserting proper platform channel usage across all channels though. We'd get that with a debug engine, but that's outside of the scope of this PR. It also doesn't solve the problem for 3p customers either since they should have access to this kind of testing without having to build a debug engine. I'll see if I can come up with a mocking unit test in the meantime.
I don't think so. |
@stuartmorgan I looked into adding a test at
Let me know if there exists a better place to test or if I'm running these wrong. |
So we do serve debug builds, but they are jit. So I'm not sure if that will work. |
I'm not sure why you are asserting things that aren't in dispute and aren't related to the policy for test exemptions. The policy is that changes need to be tested, and this change is not being tested, as evidenced by the fact that no tests are failing in our CI without this PR.
It looks like you may have an old Cocoapods cache, and are getting an old version of Google Maps even with the iOS 14 example. If so you could update Cocoapods locally, but since this isn't iOS-version specific, it should be in the oldest iOS example per the README in the enclosing directory (which will avoid the issue altogether). |
Test against the private API has been added. I still urge the plugin maintainers to consider a more holistic solution to testing the thread safety of platform channels. @hellohuanlin PTAL |
haven't reviewed yet. it doesn't seem to be related to the linked issue. if so, maybe a good idea to create a new issue about calling method channel on the wrong thread, in case of confusion to future readers. |
...utter/google_maps_flutter_ios/example/ios12/ios/RunnerTests/FLTTileProviderControllerTests.m
Outdated
Show resolved
Hide resolved
...utter/google_maps_flutter_ios/example/ios12/ios/RunnerTests/FLTTileProviderControllerTests.m
Outdated
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 could be missing something, but this doesn't seem to be related to the linked issue on tiles not being displayed, but it's rather a separate issue that you discovered while researching it? Could you update the PR description and maybe link to a new issue, in case of confusion to future readers?
|
||
@implementation FLTTileProviderControllerTests | ||
|
||
- (void)testCallChannelOnPlatformThread { |
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.
nit: include function name being tested testRequestTileMustCallChannelOnPlatformThread
XCTestExpectation *expectation = [self expectationWithDescription:@"invokeMethod"]; | ||
OCMStub([channel invokeMethod:[OCMArg any] arguments:[OCMArg any] result:[OCMArg any]]) | ||
.andDo(^(NSInvocation *invocation) { | ||
XCTAssertTrue([[NSThread currentThread] isMainThread]); |
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.
nit: XCTAssertTrue([[NSThread currentThread] isMainThread], @"Method channel must be called on main thread")
[expectation fulfill]; | ||
}); | ||
id receiver = OCMProtocolMock(@protocol(GMSTileReceiver)); | ||
[controller requestTileForX:0 y:0 zoom:0 receiver:receiver]; |
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.
nit: can just inline this receiver
?
I cannot rule out that it isn't applicable. This PR fixes a race condition and how it manifests is difficult for me to guess. It may result in lost message or crashes. |
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.
LGTM
Looks like once the CHANGELOG conflict is resolved, this is ready to be merged? |
6bdfa26
to
6ab94c6
Compare
rebased and put in the queue |
auto label is removed for flutter/packages/6069, due to - The status or check suite Linux repo_checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
auto label is removed for flutter/packages/6069, due to - The status or check suite Linux_web web_build_all_packages master has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…rom platform thread (flutter/packages#6069)
flutter/packages@b21c542...756dcc1 2024-03-15 [email protected] [go_router] Use `leak_tracker_flutter_testing` (flutter/packages#6210) 2024-03-15 [email protected] [camera_web][google_maps_flutter] Fix tests throwing errors after test completion with manual roll (flutter/packages#6318) 2024-03-14 [email protected] [pigeon] Fixes double prefixes added to enum names for Objc HostApis and FlutterApis (flutter/packages#6263) 2024-03-14 [email protected] [webview_flutter_android][webview_flutter_wkwebview] Adds platform implementations for onHttpError (flutter/packages#6149) 2024-03-14 [email protected] [image_picker_android] Fix deprecation warnings by branching based on build version, and suppressing only when needed (flutter/packages#6233) 2024-03-14 [email protected] [google_maps_flutter] Started dispatching platform messages from platform thread (flutter/packages#6069) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…form thread (flutter#6069) Issue: flutter/flutter#135252 Testing: This adds no new functionality and thus should be covered in tests. The problem is that we are permissive to unsafe platform channel usage in the release flutter engine. We should maybe consider running tests against a debug version of the engine.
Issue: flutter/flutter#135252
Testing: This adds no new functionality and thus should be covered in tests. The problem is that we are permissive to unsafe platform channel usage in the release flutter engine. We should maybe consider running tests against a debug version of the engine.
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.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.