-
Notifications
You must be signed in to change notification settings - Fork 6k
Make a mock messenger that can easily mock channels #56867
Make a mock messenger that can easily mock channels #56867
Conversation
This could occur if a request is cancelled, without this it might not chain up to the original caller correctly.
Incorrect reference counting of GTask objects meant platform channel method calls would leave tasks alive that would leak memory and leave unclosed references to the binary memssenger.
The previous mock required knowing the specific functions used in the binary messenger, this method instead allows test code to provide complete platform channel implementation for testing and make simulated platform channel calls into embedder code.
|
This branch was motivated by refactoring the platform channel code and the tests often breaking. It will hopefully be easier to write and maintain tests using this new mocking infrastructure. |
hbatagelo
left a comment
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.
The changes look great overall! One minor suggestion is to reduce code duplication in files like fl_key_channel_responder_test.cc where the non-capturing lambdas used as callbacks are repeated and could be refactored.
Also, some checks are failing: linux_unopt seems to have failed due to formatting.
The issue I had was if you added captures they no longer matched the function pointers, which meant I couldn't cleanly make them share code. In the end, I accepted the duplication, but would be interested if there is a clean way to update these in the future. |
…159706) flutter/engine@5001e2a...349ad27 2024-12-03 [email protected] [Impeller] set GLES viewport once, remove extra unbind/validation. (flutter/engine#56902) 2024-12-03 [email protected] Make a mock messenger that can easily mock channels (flutter/engine#56867) 2024-12-03 [email protected] Manual roll Dart SDK from c579d193341d to 61bfa9bbb91d (1 revision) (flutter/engine#56909) 2024-12-03 [email protected] Fix GTask reference counting (flutter/engine#56866) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [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
…6867) The previous mock required knowing the specific functions used in the binary messenger, this method instead allows test code to provide complete platform channel implementation for testing and make simulated platform channel calls into embedder code.
The previous mock required knowing the specific functions used in the binary messenger, this method instead allows test code to provide complete platform channel implementation for testing and make simulated platform channel calls into embedder code.