-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[webview_flutter] Update Widget Unit Tests to be platform agnostic #4489
Conversation
|
||
testWidgets("Can't go back before loading a page", |
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.
This test was removed since it only tests the behavior of a fake Platform WebView and not the behavior of the WebView widget.
expect(fakePlatformViewsController.lastCreatedView!.hasCache, false); | ||
}); | ||
|
||
testWidgets("Can't go back with no history", (WidgetTester tester) async { |
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.
I removed this test for the same reason as the one above.
expect(canGoBackSecondPageLoaded, true); | ||
}); | ||
|
||
testWidgets("Can't go forward before loading a page", |
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.
I removed this test for the same reason as the one above.
|
||
testWidgets('Second cookie clear does not have cookies', |
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.
I removed this test for the same reason as the one above.
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!
As discussed in #4455 (comment), many of the unit tests for
webview_flutter
useAndroidView
andMethodChannelWebViewPlatform
as default platform implementations. Sincewebview_flutter
is moving away from using a defaultMethodChannel
implementation, many of the tests break when Android uses its own implementation.This PR replaces
WebView.platform
with aMockWebViewPlatform
and uses aMockWebViewPlatformController
.Pre-launch Checklist
dart format
.)[shared_preferences]
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.