-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Permit a null response in TextureAndroidViewController #139151
Conversation
When running under a unit test environment the platform view create method will return null (because there is no implementation). Relax the type check to permit a null response.
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
This is necessary to land flutter/packages#5408 |
if (response is int) { | ||
_internals.textureId = response; | ||
} else { | ||
assert(response == null, 'response will be null when running under test'); |
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.
Relaxing production code requirements to satisfy tests is kind of worrying. Why can't we do a dummy channel response in the unit tests?
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.
Here is a trivial example of that, if it helps. A more complex version could check the call details and return an appropriate fake response.
That would mean delaying that PR by months, which would be another argument for mocking things out in tests instead. |
How so? flutter/packages is tested against stable releases of Flutter and not head? |
It's tested against both, due to https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#supported-flutter-versions |
Given the testing policy, I am abandoning this PR. |
When running under a unit test environment the platform view create method will return null (because there is no implementation). Relax the type check to permit a null response.