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
Add debugNetworkImageHttpClientProvider #32857
Conversation
Currently, the fact that NetworkImage uses a static HttpClient makes it impossible to properly test, as a mock in one test will be reused in another test. This change fixes that. flutter#32374
This change depends on #32853, since otherwise we'd receive compressed bytes after consolidation. |
@tvolkert Is there a chance to extend this provide a specific In our testing we have a "record" mode (with With the approach introduces here, we'd still have to write a rather smart HTTP client mock that in recording mode returns fallback images for some requests (from |
@tp yep that makes sense. I'll update this PR shortly. |
You can provide a specific HttpClient using |
@jonahwilliams yes, but allowing debug builds direct access to the creation of the client does simplify things a lot (including the tests). |
You could add a test to verify that |
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
Currently, the fact that NetworkImage uses a static HttpClient makes it impossible to properly test, as a mock in one test will be reused in another test. This change fixes that. flutter#32374
Description
Currently, the fact that NetworkImage uses a static HttpClient
makes it impossible to properly test, as a mock in one test will
be reused in another test. This change fixes that.
Related Issues
#32374
Tests
This change is about preparing for tests that will land in a follow-on
PR - existing tests were restructured in this PR, but no new tests were added
(yet).
Checklist
///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change