Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@robert-ancell
Copy link
Contributor

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 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.
@robert-ancell
Copy link
Contributor Author

This PR includes both #56856 and #56866 which were discovered when making this branch.

@robert-ancell
Copy link
Contributor Author

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.

Copy link
Contributor

@hbatagelo hbatagelo left a 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.

@robert-ancell
Copy link
Contributor Author

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.

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.

@robert-ancell robert-ancell merged commit c9fa56d into flutter:main Dec 3, 2024
28 checks passed
@robert-ancell robert-ancell deleted the linux-mock-messenger branch December 3, 2024 00:41
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 3, 2024
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Dec 3, 2024
…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
nick9822 pushed a commit to nick9822/flutter that referenced this pull request Dec 18, 2024
…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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants