-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[webview_flutter] Add platform interface method loadRequest
.
#4450
[webview_flutter] Add platform interface method loadRequest
.
#4450
Conversation
Co-authored-by: Yusuf Dağ <[email protected]>
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
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 with nit
), | ||
], | ||
); | ||
}); |
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.
Please add a second test that sets the optional parameters and ensures they come through as expected as well.
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.
@stuartmorgan Would that not just be testing WebViewRequest's toJson
method? We can of course add a second test, but as that toJson
is already being tested here, including the optional parameters, I feel like we would be testing for the same thing twice.
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.
How do you know that loadRequest
calls WebViewRequest
's toJson
method? Or to be more precise: how do you know that it will continue to do so?
I guarantee you that I could write a PR that breaks the test I am asking you to write without changing WebViewRequest.toJson
.
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.
That is indeed a fair point, I now see it wouldn't. I've added the test for the optional parameters.
Just for my own curiosity: Would it not be possible to avoid testing toJson
by instead mocking the WebViewRequest and checking if the return value of toJson
gets passed to invokeMethod
?
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.
Tests should assert the behavior you want to guarantee. Which is a better description of the thing you want to guarantee is true:
- "The method channel is sent the following specific keys with the expected values", or
- "The call to the method channel is implemented by calling
toJson
oninvokeMethod
"?
(As an example of why only one of these is a good description: if someone later decides that the JSON keys aren't very descriptive, and sends a PR that updates toJson
and its test to use different keys, what do you want to happen?)
* master: [webview_flutter] Deprecate evaluateJavascript in favour of runJavaScript and runJavaScriptForResult. (flutter#4403) [webview_flutter] Add interface methods to load local files and HTML strings. (flutter#4446) [ci] add pedantic dep to new in_app_purchase pkgs (flutter#4471) [ci] Remove unused dep from file_selector. (flutter#4468) [ci] update build_runner dep in android_intent and file_selector example (flutter#4467) [webview_flutter] Add platform interface method `loadRequest`. (flutter#4450) Remove -Werror from deprecated plugin Android builds (flutter#4466) [webview_flutter] Update webview packages for Android and iOS to implement `runJavascript` and `runJavascriptReturningResult`. (flutter#4402) [camera] Fix CamcorderProfile Usages (flutter#4423) [google_sign_in] Use a transparent image as a placeholder for the `GoogleUserCircleAvatar` (flutter#4391) [in_app_purchase]IAP/platform interface add cancel status (flutter#4093) [image_picker] doc:readme image picker misprints (flutter#4421) Support Hybrid Composition through the GoogleMaps Widget (flutter#4082) [path_provider] started supporting background platform channels (flutter#4443) [device_info] started using Background Platform Channels (flutter#4456) # Conflicts: # packages/webview_flutter/webview_flutter/CHANGELOG.md # packages/webview_flutter/webview_flutter/pubspec.yaml
Implements the `loadRequest` method added in #4450 for the Android package. Related issue: - flutter/flutter#27730
…4563) Implements the `loadRequest` method added in flutter#4450 for the Android package. Related issue: - flutter/flutter#27730
…4563) Implements the `loadRequest` method added in flutter#4450 for the Android package. Related issue: - flutter/flutter#27730
This PR is a partial resubmission of my colleague's PR: #4169.
It adds the
loadRequest
method to the webview plugin's platform interface, in order to support executing more specific requests when loading web pages.Related issue:
Pre-launch Checklist
dart format
.)[shared_preferences]
///
).