[webview_flutter_android] Added v4 implementation of AndroidWebViewCookieManager (#6460)
diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/v4/src/android_webview_cookie_manager.dart b/packages/webview_flutter/webview_flutter_android/lib/src/v4/src/android_webview_cookie_manager.dart new file mode 100644 index 0000000..9a64a62 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/lib/src/v4/src/android_webview_cookie_manager.dart
@@ -0,0 +1,80 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/foundation.dart'; +import 'package:webview_flutter_platform_interface/v4/webview_flutter_platform_interface.dart'; + +import '../../android_webview.dart'; + +/// Object specifying creation parameters for creating a [AndroidWebViewCookieManager]. +/// +/// When adding additional fields make sure they can be null or have a default +/// value to avoid breaking changes. See [PlatformWebViewCookieManagerCreationParams] for +/// more information. +@immutable +class AndroidWebViewCookieManagerCreationParams + extends PlatformWebViewCookieManagerCreationParams { + /// Creates a new [AndroidWebViewCookieManagerCreationParams] instance. + const AndroidWebViewCookieManagerCreationParams._( + // This parameter prevents breaking changes later. + // ignore: avoid_unused_constructor_parameters + PlatformWebViewCookieManagerCreationParams params, + ) : super(); + + /// Creates a [AndroidWebViewCookieManagerCreationParams] instance based on [PlatformWebViewCookieManagerCreationParams]. + factory AndroidWebViewCookieManagerCreationParams.fromPlatformWebViewCookieManagerCreationParams( + PlatformWebViewCookieManagerCreationParams params) { + return AndroidWebViewCookieManagerCreationParams._(params); + } +} + +/// Handles all cookie operations for the Android platform. +class AndroidWebViewCookieManager extends PlatformWebViewCookieManager { + /// Creates a new [AndroidWebViewCookieManager]. + AndroidWebViewCookieManager(AndroidWebViewCookieManagerCreationParams params) + : this.fromNativeApi( + params, + cookieManager: CookieManager.instance, + ); + + /// Creates a new [AndroidWebViewCookieManager] using the Android native [CookieManager] implementation. + /// + /// This constructor is only used for testing. An instance should be obtained + /// with the default [AndroidWebViewCookieManager] constructor. + @visibleForTesting + AndroidWebViewCookieManager.fromNativeApi( + AndroidWebViewCookieManagerCreationParams params, { + required CookieManager cookieManager, + }) : _cookieManager = cookieManager, + super.implementation(params); + + final CookieManager _cookieManager; + + @override + Future<bool> clearCookies() { + return _cookieManager.clearCookies(); + } + + @override + Future<void> setCookie(WebViewCookie cookie) { + if (!_isValidPath(cookie.path)) { + throw ArgumentError( + 'The path property for the provided cookie was not given a legal value.'); + } + return _cookieManager.setCookie( + cookie.domain, + '${Uri.encodeComponent(cookie.name)}=${Uri.encodeComponent(cookie.value)}; path=${cookie.path}', + ); + } + + bool _isValidPath(String path) { + // Permitted ranges based on RFC6265bis: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-02#section-4.1.1 + for (final int char in path.codeUnits) { + if ((char < 0x20 || char > 0x3A) && (char < 0x3C || char > 0x7E)) { + return false; + } + } + return true; + } +}
diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart index a53b639..6ffda42 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart
@@ -1,7 +1,8 @@ -// Mocks generated by Mockito 5.2.0 from annotations +// Mocks generated by Mockito 5.3.1 from annotations // in webview_flutter_android/test/android_webview_test.dart. // Do not manually edit this file. +// ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; import 'dart:typed_data' as _i7; import 'dart:ui' as _i4; @@ -21,24 +22,90 @@ // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class -class _FakeDownloadListener_0 extends _i1.Fake - implements _i2.DownloadListener {} +class _FakeDownloadListener_0 extends _i1.SmartFake + implements _i2.DownloadListener { + _FakeDownloadListener_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeJavaScriptChannel_1 extends _i1.Fake - implements _i2.JavaScriptChannel {} +class _FakeJavaScriptChannel_1 extends _i1.SmartFake + implements _i2.JavaScriptChannel { + _FakeJavaScriptChannel_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeWebViewPoint_2 extends _i1.Fake implements _i3.WebViewPoint {} +class _FakeWebViewPoint_2 extends _i1.SmartFake implements _i3.WebViewPoint { + _FakeWebViewPoint_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeWebChromeClient_3 extends _i1.Fake implements _i2.WebChromeClient {} +class _FakeWebChromeClient_3 extends _i1.SmartFake + implements _i2.WebChromeClient { + _FakeWebChromeClient_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeWebSettings_4 extends _i1.Fake implements _i2.WebSettings {} +class _FakeWebSettings_4 extends _i1.SmartFake implements _i2.WebSettings { + _FakeWebSettings_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeOffset_5 extends _i1.Fake implements _i4.Offset {} +class _FakeOffset_5 extends _i1.SmartFake implements _i4.Offset { + _FakeOffset_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeWebView_6 extends _i1.Fake implements _i2.WebView {} +class _FakeWebView_6 extends _i1.SmartFake implements _i2.WebView { + _FakeWebView_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeWebViewClient_7 extends _i1.Fake implements _i2.WebViewClient {} +class _FakeWebViewClient_7 extends _i1.SmartFake implements _i2.WebViewClient { + _FakeWebViewClient_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} /// A class which mocks [CookieManagerHostApi]. /// @@ -50,14 +117,29 @@ } @override - _i5.Future<bool> clearCookies() => - (super.noSuchMethod(Invocation.method(#clearCookies, []), - returnValue: Future<bool>.value(false)) as _i5.Future<bool>); + _i5.Future<bool> clearCookies() => (super.noSuchMethod( + Invocation.method( + #clearCookies, + [], + ), + returnValue: _i5.Future<bool>.value(false), + ) as _i5.Future<bool>); @override - _i5.Future<void> setCookie(String? arg_url, String? arg_value) => - (super.noSuchMethod(Invocation.method(#setCookie, [arg_url, arg_value]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setCookie( + String? arg_url, + String? arg_value, + ) => + (super.noSuchMethod( + Invocation.method( + #setCookie, + [ + arg_url, + arg_value, + ], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); } /// A class which mocks [DownloadListener]. @@ -69,15 +151,42 @@ } @override - void Function(String, String, String, String, int) get onDownloadStart => - (super.noSuchMethod(Invocation.getter(#onDownloadStart), - returnValue: (String url, String userAgent, String contentDisposition, - String mimetype, int contentLength) {}) as void Function( - String, String, String, String, int)); + void Function( + String, + String, + String, + String, + int, + ) get onDownloadStart => (super.noSuchMethod( + Invocation.getter(#onDownloadStart), + returnValue: ( + String url, + String userAgent, + String contentDisposition, + String mimetype, + int contentLength, + ) {}, + ) as void Function( + String, + String, + String, + String, + int, + )); @override - _i2.DownloadListener copy() => - (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeDownloadListener_0()) as _i2.DownloadListener); + _i2.DownloadListener copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeDownloadListener_0( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.DownloadListener); } /// A class which mocks [JavaScriptChannel]. @@ -89,17 +198,29 @@ } @override - String get channelName => - (super.noSuchMethod(Invocation.getter(#channelName), returnValue: '') - as String); + String get channelName => (super.noSuchMethod( + Invocation.getter(#channelName), + returnValue: '', + ) as String); @override - void Function(String) get postMessage => - (super.noSuchMethod(Invocation.getter(#postMessage), - returnValue: (String message) {}) as void Function(String)); + void Function(String) get postMessage => (super.noSuchMethod( + Invocation.getter(#postMessage), + returnValue: (String message) {}, + ) as void Function(String)); @override - _i2.JavaScriptChannel copy() => - (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeJavaScriptChannel_1()) as _i2.JavaScriptChannel); + _i2.JavaScriptChannel copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeJavaScriptChannel_1( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.JavaScriptChannel); } /// A class which mocks [TestDownloadListenerHostApi]. @@ -112,9 +233,13 @@ } @override - void create(int? instanceId) => - super.noSuchMethod(Invocation.method(#create, [instanceId]), - returnValueForMissingStub: null); + void create(int? instanceId) => super.noSuchMethod( + Invocation.method( + #create, + [instanceId], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestJavaObjectHostApi]. @@ -127,9 +252,13 @@ } @override - void dispose(int? identifier) => - super.noSuchMethod(Invocation.method(#dispose, [identifier]), - returnValueForMissingStub: null); + void dispose(int? identifier) => super.noSuchMethod( + Invocation.method( + #dispose, + [identifier], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestJavaScriptChannelHostApi]. @@ -142,9 +271,20 @@ } @override - void create(int? instanceId, String? channelName) => - super.noSuchMethod(Invocation.method(#create, [instanceId, channelName]), - returnValueForMissingStub: null); + void create( + int? instanceId, + String? channelName, + ) => + super.noSuchMethod( + Invocation.method( + #create, + [ + instanceId, + channelName, + ], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestWebChromeClientHostApi]. @@ -157,9 +297,13 @@ } @override - void create(int? instanceId) => - super.noSuchMethod(Invocation.method(#create, [instanceId]), - returnValueForMissingStub: null); + void create(int? instanceId) => super.noSuchMethod( + Invocation.method( + #create, + [instanceId], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestWebSettingsHostApi]. @@ -172,66 +316,200 @@ } @override - void create(int? instanceId, int? webViewInstanceId) => super.noSuchMethod( - Invocation.method(#create, [instanceId, webViewInstanceId]), - returnValueForMissingStub: null); - @override - void setDomStorageEnabled(int? instanceId, bool? flag) => super.noSuchMethod( - Invocation.method(#setDomStorageEnabled, [instanceId, flag]), - returnValueForMissingStub: null); - @override - void setJavaScriptCanOpenWindowsAutomatically(int? instanceId, bool? flag) => + void create( + int? instanceId, + int? webViewInstanceId, + ) => super.noSuchMethod( - Invocation.method( - #setJavaScriptCanOpenWindowsAutomatically, [instanceId, flag]), - returnValueForMissingStub: null); + Invocation.method( + #create, + [ + instanceId, + webViewInstanceId, + ], + ), + returnValueForMissingStub: null, + ); @override - void setSupportMultipleWindows(int? instanceId, bool? support) => + void setDomStorageEnabled( + int? instanceId, + bool? flag, + ) => super.noSuchMethod( - Invocation.method(#setSupportMultipleWindows, [instanceId, support]), - returnValueForMissingStub: null); + Invocation.method( + #setDomStorageEnabled, + [ + instanceId, + flag, + ], + ), + returnValueForMissingStub: null, + ); @override - void setJavaScriptEnabled(int? instanceId, bool? flag) => super.noSuchMethod( - Invocation.method(#setJavaScriptEnabled, [instanceId, flag]), - returnValueForMissingStub: null); - @override - void setUserAgentString(int? instanceId, String? userAgentString) => + void setJavaScriptCanOpenWindowsAutomatically( + int? instanceId, + bool? flag, + ) => super.noSuchMethod( - Invocation.method(#setUserAgentString, [instanceId, userAgentString]), - returnValueForMissingStub: null); + Invocation.method( + #setJavaScriptCanOpenWindowsAutomatically, + [ + instanceId, + flag, + ], + ), + returnValueForMissingStub: null, + ); @override - void setMediaPlaybackRequiresUserGesture(int? instanceId, bool? require) => + void setSupportMultipleWindows( + int? instanceId, + bool? support, + ) => super.noSuchMethod( - Invocation.method( - #setMediaPlaybackRequiresUserGesture, [instanceId, require]), - returnValueForMissingStub: null); + Invocation.method( + #setSupportMultipleWindows, + [ + instanceId, + support, + ], + ), + returnValueForMissingStub: null, + ); @override - void setSupportZoom(int? instanceId, bool? support) => super.noSuchMethod( - Invocation.method(#setSupportZoom, [instanceId, support]), - returnValueForMissingStub: null); - @override - void setLoadWithOverviewMode(int? instanceId, bool? overview) => + void setJavaScriptEnabled( + int? instanceId, + bool? flag, + ) => super.noSuchMethod( - Invocation.method(#setLoadWithOverviewMode, [instanceId, overview]), - returnValueForMissingStub: null); + Invocation.method( + #setJavaScriptEnabled, + [ + instanceId, + flag, + ], + ), + returnValueForMissingStub: null, + ); @override - void setUseWideViewPort(int? instanceId, bool? use) => super.noSuchMethod( - Invocation.method(#setUseWideViewPort, [instanceId, use]), - returnValueForMissingStub: null); - @override - void setDisplayZoomControls(int? instanceId, bool? enabled) => + void setUserAgentString( + int? instanceId, + String? userAgentString, + ) => super.noSuchMethod( - Invocation.method(#setDisplayZoomControls, [instanceId, enabled]), - returnValueForMissingStub: null); + Invocation.method( + #setUserAgentString, + [ + instanceId, + userAgentString, + ], + ), + returnValueForMissingStub: null, + ); @override - void setBuiltInZoomControls(int? instanceId, bool? enabled) => + void setMediaPlaybackRequiresUserGesture( + int? instanceId, + bool? require, + ) => super.noSuchMethod( - Invocation.method(#setBuiltInZoomControls, [instanceId, enabled]), - returnValueForMissingStub: null); + Invocation.method( + #setMediaPlaybackRequiresUserGesture, + [ + instanceId, + require, + ], + ), + returnValueForMissingStub: null, + ); @override - void setAllowFileAccess(int? instanceId, bool? enabled) => super.noSuchMethod( - Invocation.method(#setAllowFileAccess, [instanceId, enabled]), - returnValueForMissingStub: null); + void setSupportZoom( + int? instanceId, + bool? support, + ) => + super.noSuchMethod( + Invocation.method( + #setSupportZoom, + [ + instanceId, + support, + ], + ), + returnValueForMissingStub: null, + ); + @override + void setLoadWithOverviewMode( + int? instanceId, + bool? overview, + ) => + super.noSuchMethod( + Invocation.method( + #setLoadWithOverviewMode, + [ + instanceId, + overview, + ], + ), + returnValueForMissingStub: null, + ); + @override + void setUseWideViewPort( + int? instanceId, + bool? use, + ) => + super.noSuchMethod( + Invocation.method( + #setUseWideViewPort, + [ + instanceId, + use, + ], + ), + returnValueForMissingStub: null, + ); + @override + void setDisplayZoomControls( + int? instanceId, + bool? enabled, + ) => + super.noSuchMethod( + Invocation.method( + #setDisplayZoomControls, + [ + instanceId, + enabled, + ], + ), + returnValueForMissingStub: null, + ); + @override + void setBuiltInZoomControls( + int? instanceId, + bool? enabled, + ) => + super.noSuchMethod( + Invocation.method( + #setBuiltInZoomControls, + [ + instanceId, + enabled, + ], + ), + returnValueForMissingStub: null, + ); + @override + void setAllowFileAccess( + int? instanceId, + bool? enabled, + ) => + super.noSuchMethod( + Invocation.method( + #setAllowFileAccess, + [ + instanceId, + enabled, + ], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestWebStorageHostApi]. @@ -244,13 +522,21 @@ } @override - void create(int? instanceId) => - super.noSuchMethod(Invocation.method(#create, [instanceId]), - returnValueForMissingStub: null); + void create(int? instanceId) => super.noSuchMethod( + Invocation.method( + #create, + [instanceId], + ), + returnValueForMissingStub: null, + ); @override - void deleteAllData(int? instanceId) => - super.noSuchMethod(Invocation.method(#deleteAllData, [instanceId]), - returnValueForMissingStub: null); + void deleteAllData(int? instanceId) => super.noSuchMethod( + Invocation.method( + #deleteAllData, + [instanceId], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestWebViewClientHostApi]. @@ -263,10 +549,20 @@ } @override - void create(int? instanceId, bool? shouldOverrideUrlLoading) => + void create( + int? instanceId, + bool? shouldOverrideUrlLoading, + ) => super.noSuchMethod( - Invocation.method(#create, [instanceId, shouldOverrideUrlLoading]), - returnValueForMissingStub: null); + Invocation.method( + #create, + [ + instanceId, + shouldOverrideUrlLoading, + ], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestWebViewHostApi]. @@ -279,131 +575,338 @@ } @override - void create(int? instanceId, bool? useHybridComposition) => + void create( + int? instanceId, + bool? useHybridComposition, + ) => super.noSuchMethod( - Invocation.method(#create, [instanceId, useHybridComposition]), - returnValueForMissingStub: null); + Invocation.method( + #create, + [ + instanceId, + useHybridComposition, + ], + ), + returnValueForMissingStub: null, + ); @override void loadData( - int? instanceId, String? data, String? mimeType, String? encoding) => + int? instanceId, + String? data, + String? mimeType, + String? encoding, + ) => super.noSuchMethod( - Invocation.method(#loadData, [instanceId, data, mimeType, encoding]), - returnValueForMissingStub: null); + Invocation.method( + #loadData, + [ + instanceId, + data, + mimeType, + encoding, + ], + ), + returnValueForMissingStub: null, + ); @override - void loadDataWithBaseUrl(int? instanceId, String? baseUrl, String? data, - String? mimeType, String? encoding, String? historyUrl) => + void loadDataWithBaseUrl( + int? instanceId, + String? baseUrl, + String? data, + String? mimeType, + String? encoding, + String? historyUrl, + ) => super.noSuchMethod( - Invocation.method(#loadDataWithBaseUrl, - [instanceId, baseUrl, data, mimeType, encoding, historyUrl]), - returnValueForMissingStub: null); + Invocation.method( + #loadDataWithBaseUrl, + [ + instanceId, + baseUrl, + data, + mimeType, + encoding, + historyUrl, + ], + ), + returnValueForMissingStub: null, + ); @override - void loadUrl(int? instanceId, String? url, Map<String?, String?>? headers) => + void loadUrl( + int? instanceId, + String? url, + Map<String?, String?>? headers, + ) => super.noSuchMethod( - Invocation.method(#loadUrl, [instanceId, url, headers]), - returnValueForMissingStub: null); + Invocation.method( + #loadUrl, + [ + instanceId, + url, + headers, + ], + ), + returnValueForMissingStub: null, + ); @override - void postUrl(int? instanceId, String? url, _i7.Uint8List? data) => - super.noSuchMethod(Invocation.method(#postUrl, [instanceId, url, data]), - returnValueForMissingStub: null); - @override - String? getUrl(int? instanceId) => - (super.noSuchMethod(Invocation.method(#getUrl, [instanceId])) as String?); - @override - bool canGoBack(int? instanceId) => - (super.noSuchMethod(Invocation.method(#canGoBack, [instanceId]), - returnValue: false) as bool); - @override - bool canGoForward(int? instanceId) => - (super.noSuchMethod(Invocation.method(#canGoForward, [instanceId]), - returnValue: false) as bool); - @override - void goBack(int? instanceId) => - super.noSuchMethod(Invocation.method(#goBack, [instanceId]), - returnValueForMissingStub: null); - @override - void goForward(int? instanceId) => - super.noSuchMethod(Invocation.method(#goForward, [instanceId]), - returnValueForMissingStub: null); - @override - void reload(int? instanceId) => - super.noSuchMethod(Invocation.method(#reload, [instanceId]), - returnValueForMissingStub: null); - @override - void clearCache(int? instanceId, bool? includeDiskFiles) => + void postUrl( + int? instanceId, + String? url, + _i7.Uint8List? data, + ) => super.noSuchMethod( - Invocation.method(#clearCache, [instanceId, includeDiskFiles]), - returnValueForMissingStub: null); + Invocation.method( + #postUrl, + [ + instanceId, + url, + data, + ], + ), + returnValueForMissingStub: null, + ); + @override + String? getUrl(int? instanceId) => (super.noSuchMethod(Invocation.method( + #getUrl, + [instanceId], + )) as String?); + @override + bool canGoBack(int? instanceId) => (super.noSuchMethod( + Invocation.method( + #canGoBack, + [instanceId], + ), + returnValue: false, + ) as bool); + @override + bool canGoForward(int? instanceId) => (super.noSuchMethod( + Invocation.method( + #canGoForward, + [instanceId], + ), + returnValue: false, + ) as bool); + @override + void goBack(int? instanceId) => super.noSuchMethod( + Invocation.method( + #goBack, + [instanceId], + ), + returnValueForMissingStub: null, + ); + @override + void goForward(int? instanceId) => super.noSuchMethod( + Invocation.method( + #goForward, + [instanceId], + ), + returnValueForMissingStub: null, + ); + @override + void reload(int? instanceId) => super.noSuchMethod( + Invocation.method( + #reload, + [instanceId], + ), + returnValueForMissingStub: null, + ); + @override + void clearCache( + int? instanceId, + bool? includeDiskFiles, + ) => + super.noSuchMethod( + Invocation.method( + #clearCache, + [ + instanceId, + includeDiskFiles, + ], + ), + returnValueForMissingStub: null, + ); @override _i5.Future<String?> evaluateJavascript( - int? instanceId, String? javascriptString) => + int? instanceId, + String? javascriptString, + ) => (super.noSuchMethod( + Invocation.method( + #evaluateJavascript, + [ + instanceId, + javascriptString, + ], + ), + returnValue: _i5.Future<String?>.value(), + ) as _i5.Future<String?>); + @override + String? getTitle(int? instanceId) => (super.noSuchMethod(Invocation.method( + #getTitle, + [instanceId], + )) as String?); + @override + void scrollTo( + int? instanceId, + int? x, + int? y, + ) => + super.noSuchMethod( + Invocation.method( + #scrollTo, + [ + instanceId, + x, + y, + ], + ), + returnValueForMissingStub: null, + ); + @override + void scrollBy( + int? instanceId, + int? x, + int? y, + ) => + super.noSuchMethod( + Invocation.method( + #scrollBy, + [ + instanceId, + x, + y, + ], + ), + returnValueForMissingStub: null, + ); + @override + int getScrollX(int? instanceId) => (super.noSuchMethod( + Invocation.method( + #getScrollX, + [instanceId], + ), + returnValue: 0, + ) as int); + @override + int getScrollY(int? instanceId) => (super.noSuchMethod( + Invocation.method( + #getScrollY, + [instanceId], + ), + returnValue: 0, + ) as int); + @override + _i3.WebViewPoint getScrollPosition(int? instanceId) => (super.noSuchMethod( + Invocation.method( + #getScrollPosition, + [instanceId], + ), + returnValue: _FakeWebViewPoint_2( + this, Invocation.method( - #evaluateJavascript, [instanceId, javascriptString]), - returnValue: Future<String?>.value()) as _i5.Future<String?>); - @override - String? getTitle(int? instanceId) => - (super.noSuchMethod(Invocation.method(#getTitle, [instanceId])) - as String?); - @override - void scrollTo(int? instanceId, int? x, int? y) => - super.noSuchMethod(Invocation.method(#scrollTo, [instanceId, x, y]), - returnValueForMissingStub: null); - @override - void scrollBy(int? instanceId, int? x, int? y) => - super.noSuchMethod(Invocation.method(#scrollBy, [instanceId, x, y]), - returnValueForMissingStub: null); - @override - int getScrollX(int? instanceId) => - (super.noSuchMethod(Invocation.method(#getScrollX, [instanceId]), - returnValue: 0) as int); - @override - int getScrollY(int? instanceId) => - (super.noSuchMethod(Invocation.method(#getScrollY, [instanceId]), - returnValue: 0) as int); - @override - _i3.WebViewPoint getScrollPosition(int? instanceId) => - (super.noSuchMethod(Invocation.method(#getScrollPosition, [instanceId]), - returnValue: _FakeWebViewPoint_2()) as _i3.WebViewPoint); + #getScrollPosition, + [instanceId], + ), + ), + ) as _i3.WebViewPoint); @override void setWebContentsDebuggingEnabled(bool? enabled) => super.noSuchMethod( - Invocation.method(#setWebContentsDebuggingEnabled, [enabled]), - returnValueForMissingStub: null); + Invocation.method( + #setWebContentsDebuggingEnabled, + [enabled], + ), + returnValueForMissingStub: null, + ); @override - void setWebViewClient(int? instanceId, int? webViewClientInstanceId) => + void setWebViewClient( + int? instanceId, + int? webViewClientInstanceId, + ) => super.noSuchMethod( - Invocation.method( - #setWebViewClient, [instanceId, webViewClientInstanceId]), - returnValueForMissingStub: null); + Invocation.method( + #setWebViewClient, + [ + instanceId, + webViewClientInstanceId, + ], + ), + returnValueForMissingStub: null, + ); @override void addJavaScriptChannel( - int? instanceId, int? javaScriptChannelInstanceId) => + int? instanceId, + int? javaScriptChannelInstanceId, + ) => super.noSuchMethod( - Invocation.method( - #addJavaScriptChannel, [instanceId, javaScriptChannelInstanceId]), - returnValueForMissingStub: null); + Invocation.method( + #addJavaScriptChannel, + [ + instanceId, + javaScriptChannelInstanceId, + ], + ), + returnValueForMissingStub: null, + ); @override void removeJavaScriptChannel( - int? instanceId, int? javaScriptChannelInstanceId) => + int? instanceId, + int? javaScriptChannelInstanceId, + ) => super.noSuchMethod( - Invocation.method(#removeJavaScriptChannel, - [instanceId, javaScriptChannelInstanceId]), - returnValueForMissingStub: null); + Invocation.method( + #removeJavaScriptChannel, + [ + instanceId, + javaScriptChannelInstanceId, + ], + ), + returnValueForMissingStub: null, + ); @override - void setDownloadListener(int? instanceId, int? listenerInstanceId) => + void setDownloadListener( + int? instanceId, + int? listenerInstanceId, + ) => super.noSuchMethod( - Invocation.method( - #setDownloadListener, [instanceId, listenerInstanceId]), - returnValueForMissingStub: null); + Invocation.method( + #setDownloadListener, + [ + instanceId, + listenerInstanceId, + ], + ), + returnValueForMissingStub: null, + ); @override - void setWebChromeClient(int? instanceId, int? clientInstanceId) => + void setWebChromeClient( + int? instanceId, + int? clientInstanceId, + ) => super.noSuchMethod( - Invocation.method( - #setWebChromeClient, [instanceId, clientInstanceId]), - returnValueForMissingStub: null); + Invocation.method( + #setWebChromeClient, + [ + instanceId, + clientInstanceId, + ], + ), + returnValueForMissingStub: null, + ); @override - void setBackgroundColor(int? instanceId, int? color) => super.noSuchMethod( - Invocation.method(#setBackgroundColor, [instanceId, color]), - returnValueForMissingStub: null); + void setBackgroundColor( + int? instanceId, + int? color, + ) => + super.noSuchMethod( + Invocation.method( + #setBackgroundColor, + [ + instanceId, + color, + ], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestAssetManagerHostApi]. @@ -416,13 +919,21 @@ } @override - List<String?> list(String? path) => - (super.noSuchMethod(Invocation.method(#list, [path]), - returnValue: <String?>[]) as List<String?>); + List<String?> list(String? path) => (super.noSuchMethod( + Invocation.method( + #list, + [path], + ), + returnValue: <String?>[], + ) as List<String?>); @override - String getAssetFilePathByName(String? name) => - (super.noSuchMethod(Invocation.method(#getAssetFilePathByName, [name]), - returnValue: '') as String); + String getAssetFilePathByName(String? name) => (super.noSuchMethod( + Invocation.method( + #getAssetFilePathByName, + [name], + ), + returnValue: '', + ) as String); } /// A class which mocks [WebChromeClient]. @@ -434,9 +945,19 @@ } @override - _i2.WebChromeClient copy() => - (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeWebChromeClient_3()) as _i2.WebChromeClient); + _i2.WebChromeClient copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeWebChromeClient_3( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.WebChromeClient); } /// A class which mocks [WebView]. @@ -448,148 +969,306 @@ } @override - bool get useHybridComposition => - (super.noSuchMethod(Invocation.getter(#useHybridComposition), - returnValue: false) as bool); + bool get useHybridComposition => (super.noSuchMethod( + Invocation.getter(#useHybridComposition), + returnValue: false, + ) as bool); @override - _i2.WebSettings get settings => - (super.noSuchMethod(Invocation.getter(#settings), - returnValue: _FakeWebSettings_4()) as _i2.WebSettings); + _i2.WebSettings get settings => (super.noSuchMethod( + Invocation.getter(#settings), + returnValue: _FakeWebSettings_4( + this, + Invocation.getter(#settings), + ), + ) as _i2.WebSettings); @override - _i5.Future<void> loadData( - {String? data, String? mimeType, String? encoding}) => + _i5.Future<void> loadData({ + required String? data, + String? mimeType, + String? encoding, + }) => (super.noSuchMethod( - Invocation.method(#loadData, [], - {#data: data, #mimeType: mimeType, #encoding: encoding}), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + Invocation.method( + #loadData, + [], + { + #data: data, + #mimeType: mimeType, + #encoding: encoding, + }, + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> loadDataWithBaseUrl( - {String? baseUrl, - String? data, - String? mimeType, - String? encoding, - String? historyUrl}) => + _i5.Future<void> loadDataWithBaseUrl({ + String? baseUrl, + required String? data, + String? mimeType, + String? encoding, + String? historyUrl, + }) => (super.noSuchMethod( - Invocation.method(#loadDataWithBaseUrl, [], { + Invocation.method( + #loadDataWithBaseUrl, + [], + { #baseUrl: baseUrl, #data: data, #mimeType: mimeType, #encoding: encoding, - #historyUrl: historyUrl - }), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + #historyUrl: historyUrl, + }, + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> loadUrl(String? url, Map<String, String>? headers) => - (super.noSuchMethod(Invocation.method(#loadUrl, [url, headers]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> loadUrl( + String? url, + Map<String, String>? headers, + ) => + (super.noSuchMethod( + Invocation.method( + #loadUrl, + [ + url, + headers, + ], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> postUrl(String? url, _i7.Uint8List? data) => - (super.noSuchMethod(Invocation.method(#postUrl, [url, data]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> postUrl( + String? url, + _i7.Uint8List? data, + ) => + (super.noSuchMethod( + Invocation.method( + #postUrl, + [ + url, + data, + ], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<String?> getUrl() => - (super.noSuchMethod(Invocation.method(#getUrl, []), - returnValue: Future<String?>.value()) as _i5.Future<String?>); + _i5.Future<String?> getUrl() => (super.noSuchMethod( + Invocation.method( + #getUrl, + [], + ), + returnValue: _i5.Future<String?>.value(), + ) as _i5.Future<String?>); @override - _i5.Future<bool> canGoBack() => - (super.noSuchMethod(Invocation.method(#canGoBack, []), - returnValue: Future<bool>.value(false)) as _i5.Future<bool>); + _i5.Future<bool> canGoBack() => (super.noSuchMethod( + Invocation.method( + #canGoBack, + [], + ), + returnValue: _i5.Future<bool>.value(false), + ) as _i5.Future<bool>); @override - _i5.Future<bool> canGoForward() => - (super.noSuchMethod(Invocation.method(#canGoForward, []), - returnValue: Future<bool>.value(false)) as _i5.Future<bool>); + _i5.Future<bool> canGoForward() => (super.noSuchMethod( + Invocation.method( + #canGoForward, + [], + ), + returnValue: _i5.Future<bool>.value(false), + ) as _i5.Future<bool>); @override - _i5.Future<void> goBack() => - (super.noSuchMethod(Invocation.method(#goBack, []), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> goBack() => (super.noSuchMethod( + Invocation.method( + #goBack, + [], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> goForward() => - (super.noSuchMethod(Invocation.method(#goForward, []), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> goForward() => (super.noSuchMethod( + Invocation.method( + #goForward, + [], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> reload() => - (super.noSuchMethod(Invocation.method(#reload, []), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> reload() => (super.noSuchMethod( + Invocation.method( + #reload, + [], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> clearCache(bool? includeDiskFiles) => - (super.noSuchMethod(Invocation.method(#clearCache, [includeDiskFiles]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> clearCache(bool? includeDiskFiles) => (super.noSuchMethod( + Invocation.method( + #clearCache, + [includeDiskFiles], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<String?> evaluateJavascript(String? javascriptString) => (super - .noSuchMethod(Invocation.method(#evaluateJavascript, [javascriptString]), - returnValue: Future<String?>.value()) as _i5.Future<String?>); + _i5.Future<String?> evaluateJavascript(String? javascriptString) => + (super.noSuchMethod( + Invocation.method( + #evaluateJavascript, + [javascriptString], + ), + returnValue: _i5.Future<String?>.value(), + ) as _i5.Future<String?>); @override - _i5.Future<String?> getTitle() => - (super.noSuchMethod(Invocation.method(#getTitle, []), - returnValue: Future<String?>.value()) as _i5.Future<String?>); + _i5.Future<String?> getTitle() => (super.noSuchMethod( + Invocation.method( + #getTitle, + [], + ), + returnValue: _i5.Future<String?>.value(), + ) as _i5.Future<String?>); @override - _i5.Future<void> scrollTo(int? x, int? y) => - (super.noSuchMethod(Invocation.method(#scrollTo, [x, y]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> scrollTo( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollTo, + [ + x, + y, + ], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> scrollBy(int? x, int? y) => - (super.noSuchMethod(Invocation.method(#scrollBy, [x, y]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> scrollBy( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollBy, + [ + x, + y, + ], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<int> getScrollX() => - (super.noSuchMethod(Invocation.method(#getScrollX, []), - returnValue: Future<int>.value(0)) as _i5.Future<int>); + _i5.Future<int> getScrollX() => (super.noSuchMethod( + Invocation.method( + #getScrollX, + [], + ), + returnValue: _i5.Future<int>.value(0), + ) as _i5.Future<int>); @override - _i5.Future<int> getScrollY() => - (super.noSuchMethod(Invocation.method(#getScrollY, []), - returnValue: Future<int>.value(0)) as _i5.Future<int>); + _i5.Future<int> getScrollY() => (super.noSuchMethod( + Invocation.method( + #getScrollY, + [], + ), + returnValue: _i5.Future<int>.value(0), + ) as _i5.Future<int>); @override - _i5.Future<_i4.Offset> getScrollPosition() => - (super.noSuchMethod(Invocation.method(#getScrollPosition, []), - returnValue: Future<_i4.Offset>.value(_FakeOffset_5())) - as _i5.Future<_i4.Offset>); + _i5.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( + Invocation.method( + #getScrollPosition, + [], + ), + returnValue: _i5.Future<_i4.Offset>.value(_FakeOffset_5( + this, + Invocation.method( + #getScrollPosition, + [], + ), + )), + ) as _i5.Future<_i4.Offset>); @override _i5.Future<void> setWebViewClient(_i2.WebViewClient? webViewClient) => - (super.noSuchMethod(Invocation.method(#setWebViewClient, [webViewClient]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + (super.noSuchMethod( + Invocation.method( + #setWebViewClient, + [webViewClient], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> addJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => (super.noSuchMethod( - Invocation.method(#addJavaScriptChannel, [javaScriptChannel]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + Invocation.method( + #addJavaScriptChannel, + [javaScriptChannel], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> removeJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => (super.noSuchMethod( - Invocation.method(#removeJavaScriptChannel, [javaScriptChannel]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + Invocation.method( + #removeJavaScriptChannel, + [javaScriptChannel], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> setDownloadListener(_i2.DownloadListener? listener) => - (super.noSuchMethod(Invocation.method(#setDownloadListener, [listener]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + (super.noSuchMethod( + Invocation.method( + #setDownloadListener, + [listener], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> setWebChromeClient(_i2.WebChromeClient? client) => - (super.noSuchMethod(Invocation.method(#setWebChromeClient, [client]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + (super.noSuchMethod( + Invocation.method( + #setWebChromeClient, + [client], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setBackgroundColor(_i4.Color? color) => - (super.noSuchMethod(Invocation.method(#setBackgroundColor, [color]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( + Invocation.method( + #setBackgroundColor, + [color], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i2.WebView copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeWebView_6()) as _i2.WebView); + _i2.WebView copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeWebView_6( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.WebView); } /// A class which mocks [WebViewClient]. @@ -601,10 +1280,22 @@ } @override - bool get shouldOverrideUrlLoading => - (super.noSuchMethod(Invocation.getter(#shouldOverrideUrlLoading), - returnValue: false) as bool); + bool get shouldOverrideUrlLoading => (super.noSuchMethod( + Invocation.getter(#shouldOverrideUrlLoading), + returnValue: false, + ) as bool); @override - _i2.WebViewClient copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeWebViewClient_7()) as _i2.WebViewClient); + _i2.WebViewClient copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeWebViewClient_7( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.WebViewClient); }
diff --git a/packages/webview_flutter/webview_flutter_android/test/v4/android_webview_cookie_manager_test.dart b/packages/webview_flutter/webview_flutter_android/test/v4/android_webview_cookie_manager_test.dart new file mode 100644 index 0000000..b314c75 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/test/v4/android_webview_cookie_manager_test.dart
@@ -0,0 +1,82 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:webview_flutter_android/src/android_webview.dart' + as android_webview; +import 'package:webview_flutter_android/src/v4/src/android_webview_cookie_manager.dart'; +import 'package:webview_flutter_platform_interface/v4/src/webview_platform.dart'; + +import 'android_webview_cookie_manager_test.mocks.dart'; + +@GenerateMocks(<Type>[android_webview.CookieManager]) +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + test('clearCookies should call android_webview.clearCookies', () async { + final android_webview.CookieManager mockCookieManager = MockCookieManager(); + + when(mockCookieManager.clearCookies()) + .thenAnswer((_) => Future<bool>.value(true)); + + final AndroidWebViewCookieManagerCreationParams params = + AndroidWebViewCookieManagerCreationParams + .fromPlatformWebViewCookieManagerCreationParams( + const PlatformWebViewCookieManagerCreationParams()); + + final bool hasClearedCookies = + await AndroidWebViewCookieManager.fromNativeApi(params, + cookieManager: mockCookieManager) + .clearCookies(); + + expect(hasClearedCookies, true); + verify(mockCookieManager.clearCookies()); + }); + + test('setCookie should throw ArgumentError for cookie with invalid path', () { + final AndroidWebViewCookieManagerCreationParams params = + AndroidWebViewCookieManagerCreationParams + .fromPlatformWebViewCookieManagerCreationParams( + const PlatformWebViewCookieManagerCreationParams()); + + final AndroidWebViewCookieManager androidCookieManager = + AndroidWebViewCookieManager.fromNativeApi(params, + cookieManager: MockCookieManager()); + + expect( + () => androidCookieManager.setCookie(const WebViewCookie( + name: 'foo', + value: 'bar', + domain: 'flutter.dev', + path: 'invalid;path', + )), + throwsA(const TypeMatcher<ArgumentError>()), + ); + }); + + test( + 'setCookie should call android_webview.csetCookie with properly formatted cookie value', + () { + final android_webview.CookieManager mockCookieManager = MockCookieManager(); + final AndroidWebViewCookieManagerCreationParams params = + AndroidWebViewCookieManagerCreationParams + .fromPlatformWebViewCookieManagerCreationParams( + const PlatformWebViewCookieManagerCreationParams()); + + AndroidWebViewCookieManager.fromNativeApi(params, + cookieManager: mockCookieManager) + .setCookie(const WebViewCookie( + name: 'foo&', + value: 'bar@', + domain: 'flutter.dev', + )); + + verify(mockCookieManager.setCookie( + 'flutter.dev', + 'foo%26=bar%40; path=/', + )); + }); +}
diff --git a/packages/webview_flutter/webview_flutter_android/test/v4/android_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/v4/android_webview_cookie_manager_test.mocks.dart new file mode 100644 index 0000000..a7279d5 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/test/v4/android_webview_cookie_manager_test.mocks.dart
@@ -0,0 +1,54 @@ +// Mocks generated by Mockito 5.3.1 from annotations +// in webview_flutter_android/test/v4/android_webview_cookie_manager_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i3; + +import 'package:mockito/mockito.dart' as _i1; +import 'package:webview_flutter_android/src/android_webview.dart' as _i2; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +/// A class which mocks [CookieManager]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCookieManager extends _i1.Mock implements _i2.CookieManager { + MockCookieManager() { + _i1.throwOnMissingStub(this); + } + + @override + _i3.Future<void> setCookie( + String? url, + String? value, + ) => + (super.noSuchMethod( + Invocation.method( + #setCookie, + [ + url, + value, + ], + ), + returnValue: _i3.Future<void>.value(), + returnValueForMissingStub: _i3.Future<void>.value(), + ) as _i3.Future<void>); + @override + _i3.Future<bool> clearCookies() => (super.noSuchMethod( + Invocation.method( + #clearCookies, + [], + ), + returnValue: _i3.Future<bool>.value(false), + ) as _i3.Future<bool>); +}
diff --git a/packages/webview_flutter/webview_flutter_android/test/webview_android_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/webview_android_cookie_manager_test.mocks.dart index 308aba4..dea6d80 100644 --- a/packages/webview_flutter/webview_flutter_android/test/webview_android_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/webview_android_cookie_manager_test.mocks.dart
@@ -1,7 +1,8 @@ -// Mocks generated by Mockito 5.2.0 from annotations +// Mocks generated by Mockito 5.3.1 from annotations // in webview_flutter_android/test/webview_android_cookie_manager_test.dart. // Do not manually edit this file. +// ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; import 'package:mockito/mockito.dart' as _i1; @@ -16,6 +17,7 @@ // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class /// A class which mocks [CookieManager]. /// @@ -26,12 +28,27 @@ } @override - _i3.Future<void> setCookie(String? url, String? value) => - (super.noSuchMethod(Invocation.method(#setCookie, [url, value]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i3.Future<void>); + _i3.Future<void> setCookie( + String? url, + String? value, + ) => + (super.noSuchMethod( + Invocation.method( + #setCookie, + [ + url, + value, + ], + ), + returnValue: _i3.Future<void>.value(), + returnValueForMissingStub: _i3.Future<void>.value(), + ) as _i3.Future<void>); @override - _i3.Future<bool> clearCookies() => - (super.noSuchMethod(Invocation.method(#clearCookies, []), - returnValue: Future<bool>.value(false)) as _i3.Future<bool>); + _i3.Future<bool> clearCookies() => (super.noSuchMethod( + Invocation.method( + #clearCookies, + [], + ), + returnValue: _i3.Future<bool>.value(false), + ) as _i3.Future<bool>); }
diff --git a/packages/webview_flutter/webview_flutter_android/test/webview_android_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/webview_android_widget_test.mocks.dart index 860562e..390e2ab 100644 --- a/packages/webview_flutter/webview_flutter_android/test/webview_android_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/webview_android_widget_test.mocks.dart
@@ -1,7 +1,8 @@ -// Mocks generated by Mockito 5.2.0 from annotations +// Mocks generated by Mockito 5.3.1 from annotations // in webview_flutter_android/test/webview_android_widget_test.dart. // Do not manually edit this file. +// ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; import 'dart:typed_data' as _i6; import 'dart:ui' as _i3; @@ -21,27 +22,101 @@ // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class -class _FakeWebSettings_0 extends _i1.Fake implements _i2.WebSettings {} +class _FakeWebSettings_0 extends _i1.SmartFake implements _i2.WebSettings { + _FakeWebSettings_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeWebStorage_1 extends _i1.Fake implements _i2.WebStorage {} +class _FakeWebStorage_1 extends _i1.SmartFake implements _i2.WebStorage { + _FakeWebStorage_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeOffset_2 extends _i1.Fake implements _i3.Offset {} +class _FakeOffset_2 extends _i1.SmartFake implements _i3.Offset { + _FakeOffset_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeWebView_3 extends _i1.Fake implements _i2.WebView {} +class _FakeWebView_3 extends _i1.SmartFake implements _i2.WebView { + _FakeWebView_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeDownloadListener_4 extends _i1.Fake - implements _i2.DownloadListener {} +class _FakeDownloadListener_4 extends _i1.SmartFake + implements _i2.DownloadListener { + _FakeDownloadListener_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeJavascriptChannelRegistry_5 extends _i1.Fake - implements _i4.JavascriptChannelRegistry {} +class _FakeJavascriptChannelRegistry_5 extends _i1.SmartFake + implements _i4.JavascriptChannelRegistry { + _FakeJavascriptChannelRegistry_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeJavaScriptChannel_6 extends _i1.Fake - implements _i2.JavaScriptChannel {} +class _FakeJavaScriptChannel_6 extends _i1.SmartFake + implements _i2.JavaScriptChannel { + _FakeJavaScriptChannel_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeWebChromeClient_7 extends _i1.Fake implements _i2.WebChromeClient {} +class _FakeWebChromeClient_7 extends _i1.SmartFake + implements _i2.WebChromeClient { + _FakeWebChromeClient_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} -class _FakeWebViewClient_8 extends _i1.Fake implements _i2.WebViewClient {} +class _FakeWebViewClient_8 extends _i1.SmartFake implements _i2.WebViewClient { + _FakeWebViewClient_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} /// A class which mocks [FlutterAssetManager]. /// @@ -53,14 +128,22 @@ } @override - _i5.Future<List<String?>> list(String? path) => - (super.noSuchMethod(Invocation.method(#list, [path]), - returnValue: Future<List<String?>>.value(<String?>[])) - as _i5.Future<List<String?>>); + _i5.Future<List<String?>> list(String? path) => (super.noSuchMethod( + Invocation.method( + #list, + [path], + ), + returnValue: _i5.Future<List<String?>>.value(<String?>[]), + ) as _i5.Future<List<String?>>); @override _i5.Future<String> getAssetFilePathByName(String? name) => - (super.noSuchMethod(Invocation.method(#getAssetFilePathByName, [name]), - returnValue: Future<String>.value('')) as _i5.Future<String>); + (super.noSuchMethod( + Invocation.method( + #getAssetFilePathByName, + [name], + ), + returnValue: _i5.Future<String>.value(''), + ) as _i5.Future<String>); } /// A class which mocks [WebSettings]. @@ -72,70 +155,132 @@ } @override - _i5.Future<void> setDomStorageEnabled(bool? flag) => - (super.noSuchMethod(Invocation.method(#setDomStorageEnabled, [flag]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setDomStorageEnabled(bool? flag) => (super.noSuchMethod( + Invocation.method( + #setDomStorageEnabled, + [flag], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> setJavaScriptCanOpenWindowsAutomatically(bool? flag) => (super.noSuchMethod( - Invocation.method(#setJavaScriptCanOpenWindowsAutomatically, [flag]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + Invocation.method( + #setJavaScriptCanOpenWindowsAutomatically, + [flag], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setSupportMultipleWindows(bool? support) => (super - .noSuchMethod(Invocation.method(#setSupportMultipleWindows, [support]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setSupportMultipleWindows(bool? support) => + (super.noSuchMethod( + Invocation.method( + #setSupportMultipleWindows, + [support], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setJavaScriptEnabled(bool? flag) => - (super.noSuchMethod(Invocation.method(#setJavaScriptEnabled, [flag]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setJavaScriptEnabled(bool? flag) => (super.noSuchMethod( + Invocation.method( + #setJavaScriptEnabled, + [flag], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setUserAgentString(String? userAgentString) => (super - .noSuchMethod(Invocation.method(#setUserAgentString, [userAgentString]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setUserAgentString(String? userAgentString) => + (super.noSuchMethod( + Invocation.method( + #setUserAgentString, + [userAgentString], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( - Invocation.method(#setMediaPlaybackRequiresUserGesture, [require]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + Invocation.method( + #setMediaPlaybackRequiresUserGesture, + [require], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setSupportZoom(bool? support) => - (super.noSuchMethod(Invocation.method(#setSupportZoom, [support]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setSupportZoom(bool? support) => (super.noSuchMethod( + Invocation.method( + #setSupportZoom, + [support], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setLoadWithOverviewMode(bool? overview) => (super - .noSuchMethod(Invocation.method(#setLoadWithOverviewMode, [overview]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setLoadWithOverviewMode(bool? overview) => + (super.noSuchMethod( + Invocation.method( + #setLoadWithOverviewMode, + [overview], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setUseWideViewPort(bool? use) => - (super.noSuchMethod(Invocation.method(#setUseWideViewPort, [use]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setUseWideViewPort(bool? use) => (super.noSuchMethod( + Invocation.method( + #setUseWideViewPort, + [use], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setDisplayZoomControls(bool? enabled) => - (super.noSuchMethod(Invocation.method(#setDisplayZoomControls, [enabled]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setDisplayZoomControls(bool? enabled) => (super.noSuchMethod( + Invocation.method( + #setDisplayZoomControls, + [enabled], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setBuiltInZoomControls(bool? enabled) => - (super.noSuchMethod(Invocation.method(#setBuiltInZoomControls, [enabled]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setBuiltInZoomControls(bool? enabled) => (super.noSuchMethod( + Invocation.method( + #setBuiltInZoomControls, + [enabled], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setAllowFileAccess(bool? enabled) => - (super.noSuchMethod(Invocation.method(#setAllowFileAccess, [enabled]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setAllowFileAccess(bool? enabled) => (super.noSuchMethod( + Invocation.method( + #setAllowFileAccess, + [enabled], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i2.WebSettings copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeWebSettings_0()) as _i2.WebSettings); + _i2.WebSettings copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeWebSettings_0( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.WebSettings); } /// A class which mocks [WebStorage]. @@ -147,13 +292,28 @@ } @override - _i5.Future<void> deleteAllData() => - (super.noSuchMethod(Invocation.method(#deleteAllData, []), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> deleteAllData() => (super.noSuchMethod( + Invocation.method( + #deleteAllData, + [], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i2.WebStorage copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeWebStorage_1()) as _i2.WebStorage); + _i2.WebStorage copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeWebStorage_1( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.WebStorage); } /// A class which mocks [WebView]. @@ -165,148 +325,306 @@ } @override - bool get useHybridComposition => - (super.noSuchMethod(Invocation.getter(#useHybridComposition), - returnValue: false) as bool); + bool get useHybridComposition => (super.noSuchMethod( + Invocation.getter(#useHybridComposition), + returnValue: false, + ) as bool); @override - _i2.WebSettings get settings => - (super.noSuchMethod(Invocation.getter(#settings), - returnValue: _FakeWebSettings_0()) as _i2.WebSettings); + _i2.WebSettings get settings => (super.noSuchMethod( + Invocation.getter(#settings), + returnValue: _FakeWebSettings_0( + this, + Invocation.getter(#settings), + ), + ) as _i2.WebSettings); @override - _i5.Future<void> loadData( - {String? data, String? mimeType, String? encoding}) => + _i5.Future<void> loadData({ + required String? data, + String? mimeType, + String? encoding, + }) => (super.noSuchMethod( - Invocation.method(#loadData, [], - {#data: data, #mimeType: mimeType, #encoding: encoding}), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + Invocation.method( + #loadData, + [], + { + #data: data, + #mimeType: mimeType, + #encoding: encoding, + }, + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> loadDataWithBaseUrl( - {String? baseUrl, - String? data, - String? mimeType, - String? encoding, - String? historyUrl}) => + _i5.Future<void> loadDataWithBaseUrl({ + String? baseUrl, + required String? data, + String? mimeType, + String? encoding, + String? historyUrl, + }) => (super.noSuchMethod( - Invocation.method(#loadDataWithBaseUrl, [], { + Invocation.method( + #loadDataWithBaseUrl, + [], + { #baseUrl: baseUrl, #data: data, #mimeType: mimeType, #encoding: encoding, - #historyUrl: historyUrl - }), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + #historyUrl: historyUrl, + }, + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> loadUrl(String? url, Map<String, String>? headers) => - (super.noSuchMethod(Invocation.method(#loadUrl, [url, headers]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> loadUrl( + String? url, + Map<String, String>? headers, + ) => + (super.noSuchMethod( + Invocation.method( + #loadUrl, + [ + url, + headers, + ], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> postUrl(String? url, _i6.Uint8List? data) => - (super.noSuchMethod(Invocation.method(#postUrl, [url, data]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> postUrl( + String? url, + _i6.Uint8List? data, + ) => + (super.noSuchMethod( + Invocation.method( + #postUrl, + [ + url, + data, + ], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<String?> getUrl() => - (super.noSuchMethod(Invocation.method(#getUrl, []), - returnValue: Future<String?>.value()) as _i5.Future<String?>); + _i5.Future<String?> getUrl() => (super.noSuchMethod( + Invocation.method( + #getUrl, + [], + ), + returnValue: _i5.Future<String?>.value(), + ) as _i5.Future<String?>); @override - _i5.Future<bool> canGoBack() => - (super.noSuchMethod(Invocation.method(#canGoBack, []), - returnValue: Future<bool>.value(false)) as _i5.Future<bool>); + _i5.Future<bool> canGoBack() => (super.noSuchMethod( + Invocation.method( + #canGoBack, + [], + ), + returnValue: _i5.Future<bool>.value(false), + ) as _i5.Future<bool>); @override - _i5.Future<bool> canGoForward() => - (super.noSuchMethod(Invocation.method(#canGoForward, []), - returnValue: Future<bool>.value(false)) as _i5.Future<bool>); + _i5.Future<bool> canGoForward() => (super.noSuchMethod( + Invocation.method( + #canGoForward, + [], + ), + returnValue: _i5.Future<bool>.value(false), + ) as _i5.Future<bool>); @override - _i5.Future<void> goBack() => - (super.noSuchMethod(Invocation.method(#goBack, []), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> goBack() => (super.noSuchMethod( + Invocation.method( + #goBack, + [], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> goForward() => - (super.noSuchMethod(Invocation.method(#goForward, []), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> goForward() => (super.noSuchMethod( + Invocation.method( + #goForward, + [], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> reload() => - (super.noSuchMethod(Invocation.method(#reload, []), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> reload() => (super.noSuchMethod( + Invocation.method( + #reload, + [], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> clearCache(bool? includeDiskFiles) => - (super.noSuchMethod(Invocation.method(#clearCache, [includeDiskFiles]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> clearCache(bool? includeDiskFiles) => (super.noSuchMethod( + Invocation.method( + #clearCache, + [includeDiskFiles], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<String?> evaluateJavascript(String? javascriptString) => (super - .noSuchMethod(Invocation.method(#evaluateJavascript, [javascriptString]), - returnValue: Future<String?>.value()) as _i5.Future<String?>); + _i5.Future<String?> evaluateJavascript(String? javascriptString) => + (super.noSuchMethod( + Invocation.method( + #evaluateJavascript, + [javascriptString], + ), + returnValue: _i5.Future<String?>.value(), + ) as _i5.Future<String?>); @override - _i5.Future<String?> getTitle() => - (super.noSuchMethod(Invocation.method(#getTitle, []), - returnValue: Future<String?>.value()) as _i5.Future<String?>); + _i5.Future<String?> getTitle() => (super.noSuchMethod( + Invocation.method( + #getTitle, + [], + ), + returnValue: _i5.Future<String?>.value(), + ) as _i5.Future<String?>); @override - _i5.Future<void> scrollTo(int? x, int? y) => - (super.noSuchMethod(Invocation.method(#scrollTo, [x, y]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> scrollTo( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollTo, + [ + x, + y, + ], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> scrollBy(int? x, int? y) => - (super.noSuchMethod(Invocation.method(#scrollBy, [x, y]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> scrollBy( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollBy, + [ + x, + y, + ], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<int> getScrollX() => - (super.noSuchMethod(Invocation.method(#getScrollX, []), - returnValue: Future<int>.value(0)) as _i5.Future<int>); + _i5.Future<int> getScrollX() => (super.noSuchMethod( + Invocation.method( + #getScrollX, + [], + ), + returnValue: _i5.Future<int>.value(0), + ) as _i5.Future<int>); @override - _i5.Future<int> getScrollY() => - (super.noSuchMethod(Invocation.method(#getScrollY, []), - returnValue: Future<int>.value(0)) as _i5.Future<int>); + _i5.Future<int> getScrollY() => (super.noSuchMethod( + Invocation.method( + #getScrollY, + [], + ), + returnValue: _i5.Future<int>.value(0), + ) as _i5.Future<int>); @override - _i5.Future<_i3.Offset> getScrollPosition() => - (super.noSuchMethod(Invocation.method(#getScrollPosition, []), - returnValue: Future<_i3.Offset>.value(_FakeOffset_2())) - as _i5.Future<_i3.Offset>); + _i5.Future<_i3.Offset> getScrollPosition() => (super.noSuchMethod( + Invocation.method( + #getScrollPosition, + [], + ), + returnValue: _i5.Future<_i3.Offset>.value(_FakeOffset_2( + this, + Invocation.method( + #getScrollPosition, + [], + ), + )), + ) as _i5.Future<_i3.Offset>); @override _i5.Future<void> setWebViewClient(_i2.WebViewClient? webViewClient) => - (super.noSuchMethod(Invocation.method(#setWebViewClient, [webViewClient]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + (super.noSuchMethod( + Invocation.method( + #setWebViewClient, + [webViewClient], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> addJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => (super.noSuchMethod( - Invocation.method(#addJavaScriptChannel, [javaScriptChannel]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + Invocation.method( + #addJavaScriptChannel, + [javaScriptChannel], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> removeJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => (super.noSuchMethod( - Invocation.method(#removeJavaScriptChannel, [javaScriptChannel]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + Invocation.method( + #removeJavaScriptChannel, + [javaScriptChannel], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> setDownloadListener(_i2.DownloadListener? listener) => - (super.noSuchMethod(Invocation.method(#setDownloadListener, [listener]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + (super.noSuchMethod( + Invocation.method( + #setDownloadListener, + [listener], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override _i5.Future<void> setWebChromeClient(_i2.WebChromeClient? client) => - (super.noSuchMethod(Invocation.method(#setWebChromeClient, [client]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + (super.noSuchMethod( + Invocation.method( + #setWebChromeClient, + [client], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i5.Future<void> setBackgroundColor(_i3.Color? color) => - (super.noSuchMethod(Invocation.method(#setBackgroundColor, [color]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + _i5.Future<void> setBackgroundColor(_i3.Color? color) => (super.noSuchMethod( + Invocation.method( + #setBackgroundColor, + [color], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); @override - _i2.WebView copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeWebView_3()) as _i2.WebView); + _i2.WebView copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeWebView_3( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.WebView); } /// A class which mocks [WebResourceRequest]. @@ -319,24 +637,30 @@ } @override - String get url => - (super.noSuchMethod(Invocation.getter(#url), returnValue: '') as String); + String get url => (super.noSuchMethod( + Invocation.getter(#url), + returnValue: '', + ) as String); @override - bool get isForMainFrame => (super - .noSuchMethod(Invocation.getter(#isForMainFrame), returnValue: false) - as bool); + bool get isForMainFrame => (super.noSuchMethod( + Invocation.getter(#isForMainFrame), + returnValue: false, + ) as bool); @override - bool get hasGesture => - (super.noSuchMethod(Invocation.getter(#hasGesture), returnValue: false) - as bool); + bool get hasGesture => (super.noSuchMethod( + Invocation.getter(#hasGesture), + returnValue: false, + ) as bool); @override - String get method => - (super.noSuchMethod(Invocation.getter(#method), returnValue: '') - as String); + String get method => (super.noSuchMethod( + Invocation.getter(#method), + returnValue: '', + ) as String); @override - Map<String, String> get requestHeaders => - (super.noSuchMethod(Invocation.getter(#requestHeaders), - returnValue: <String, String>{}) as Map<String, String>); + Map<String, String> get requestHeaders => (super.noSuchMethod( + Invocation.getter(#requestHeaders), + returnValue: <String, String>{}, + ) as Map<String, String>); } /// A class which mocks [DownloadListener]. @@ -348,15 +672,42 @@ } @override - void Function(String, String, String, String, int) get onDownloadStart => - (super.noSuchMethod(Invocation.getter(#onDownloadStart), - returnValue: (String url, String userAgent, String contentDisposition, - String mimetype, int contentLength) {}) as void Function( - String, String, String, String, int)); + void Function( + String, + String, + String, + String, + int, + ) get onDownloadStart => (super.noSuchMethod( + Invocation.getter(#onDownloadStart), + returnValue: ( + String url, + String userAgent, + String contentDisposition, + String mimetype, + int contentLength, + ) {}, + ) as void Function( + String, + String, + String, + String, + int, + )); @override - _i2.DownloadListener copy() => - (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeDownloadListener_4()) as _i2.DownloadListener); + _i2.DownloadListener copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeDownloadListener_4( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.DownloadListener); } /// A class which mocks [WebViewAndroidJavaScriptChannel]. @@ -370,21 +721,37 @@ @override _i4.JavascriptChannelRegistry get javascriptChannelRegistry => - (super.noSuchMethod(Invocation.getter(#javascriptChannelRegistry), - returnValue: _FakeJavascriptChannelRegistry_5()) - as _i4.JavascriptChannelRegistry); + (super.noSuchMethod( + Invocation.getter(#javascriptChannelRegistry), + returnValue: _FakeJavascriptChannelRegistry_5( + this, + Invocation.getter(#javascriptChannelRegistry), + ), + ) as _i4.JavascriptChannelRegistry); @override - String get channelName => - (super.noSuchMethod(Invocation.getter(#channelName), returnValue: '') - as String); + String get channelName => (super.noSuchMethod( + Invocation.getter(#channelName), + returnValue: '', + ) as String); @override - void Function(String) get postMessage => - (super.noSuchMethod(Invocation.getter(#postMessage), - returnValue: (String message) {}) as void Function(String)); + void Function(String) get postMessage => (super.noSuchMethod( + Invocation.getter(#postMessage), + returnValue: (String message) {}, + ) as void Function(String)); @override - _i2.JavaScriptChannel copy() => - (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeJavaScriptChannel_6()) as _i2.JavaScriptChannel); + _i2.JavaScriptChannel copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeJavaScriptChannel_6( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.JavaScriptChannel); } /// A class which mocks [WebChromeClient]. @@ -396,9 +763,19 @@ } @override - _i2.WebChromeClient copy() => - (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeWebChromeClient_7()) as _i2.WebChromeClient); + _i2.WebChromeClient copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeWebChromeClient_7( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.WebChromeClient); } /// A class which mocks [WebViewClient]. @@ -410,12 +787,24 @@ } @override - bool get shouldOverrideUrlLoading => - (super.noSuchMethod(Invocation.getter(#shouldOverrideUrlLoading), - returnValue: false) as bool); + bool get shouldOverrideUrlLoading => (super.noSuchMethod( + Invocation.getter(#shouldOverrideUrlLoading), + returnValue: false, + ) as bool); @override - _i2.WebViewClient copy() => (super.noSuchMethod(Invocation.method(#copy, []), - returnValue: _FakeWebViewClient_8()) as _i2.WebViewClient); + _i2.WebViewClient copy() => (super.noSuchMethod( + Invocation.method( + #copy, + [], + ), + returnValue: _FakeWebViewClient_8( + this, + Invocation.method( + #copy, + [], + ), + ), + ) as _i2.WebViewClient); } /// A class which mocks [JavascriptChannelRegistry]. @@ -428,20 +817,34 @@ } @override - Map<String, _i4.JavascriptChannel> get channels => - (super.noSuchMethod(Invocation.getter(#channels), - returnValue: <String, _i4.JavascriptChannel>{}) - as Map<String, _i4.JavascriptChannel>); + Map<String, _i4.JavascriptChannel> get channels => (super.noSuchMethod( + Invocation.getter(#channels), + returnValue: <String, _i4.JavascriptChannel>{}, + ) as Map<String, _i4.JavascriptChannel>); @override - void onJavascriptChannelMessage(String? channel, String? message) => + void onJavascriptChannelMessage( + String? channel, + String? message, + ) => super.noSuchMethod( - Invocation.method(#onJavascriptChannelMessage, [channel, message]), - returnValueForMissingStub: null); + Invocation.method( + #onJavascriptChannelMessage, + [ + channel, + message, + ], + ), + returnValueForMissingStub: null, + ); @override void updateJavascriptChannelsFromSet(Set<_i4.JavascriptChannel>? channels) => super.noSuchMethod( - Invocation.method(#updateJavascriptChannelsFromSet, [channels]), - returnValueForMissingStub: null); + Invocation.method( + #updateJavascriptChannelsFromSet, + [channels], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [WebViewPlatformCallbacksHandler]. @@ -454,27 +857,53 @@ } @override - _i5.FutureOr<bool> onNavigationRequest({String? url, bool? isForMainFrame}) => + _i5.FutureOr<bool> onNavigationRequest({ + required String? url, + required bool? isForMainFrame, + }) => (super.noSuchMethod( - Invocation.method(#onNavigationRequest, [], - {#url: url, #isForMainFrame: isForMainFrame}), - returnValue: Future<bool>.value(false)) as _i5.FutureOr<bool>); + Invocation.method( + #onNavigationRequest, + [], + { + #url: url, + #isForMainFrame: isForMainFrame, + }, + ), + returnValue: _i5.Future<bool>.value(false), + ) as _i5.FutureOr<bool>); @override - void onPageStarted(String? url) => - super.noSuchMethod(Invocation.method(#onPageStarted, [url]), - returnValueForMissingStub: null); + void onPageStarted(String? url) => super.noSuchMethod( + Invocation.method( + #onPageStarted, + [url], + ), + returnValueForMissingStub: null, + ); @override - void onPageFinished(String? url) => - super.noSuchMethod(Invocation.method(#onPageFinished, [url]), - returnValueForMissingStub: null); + void onPageFinished(String? url) => super.noSuchMethod( + Invocation.method( + #onPageFinished, + [url], + ), + returnValueForMissingStub: null, + ); @override - void onProgress(int? progress) => - super.noSuchMethod(Invocation.method(#onProgress, [progress]), - returnValueForMissingStub: null); + void onProgress(int? progress) => super.noSuchMethod( + Invocation.method( + #onProgress, + [progress], + ), + returnValueForMissingStub: null, + ); @override - void onWebResourceError(_i4.WebResourceError? error) => - super.noSuchMethod(Invocation.method(#onWebResourceError, [error]), - returnValueForMissingStub: null); + void onWebResourceError(_i4.WebResourceError? error) => super.noSuchMethod( + Invocation.method( + #onWebResourceError, + [error], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [WebViewProxy]. @@ -486,15 +915,30 @@ } @override - _i2.WebView createWebView({bool? useHybridComposition}) => + _i2.WebView createWebView({required bool? useHybridComposition}) => (super.noSuchMethod( - Invocation.method(#createWebView, [], - {#useHybridComposition: useHybridComposition}), - returnValue: _FakeWebView_3()) as _i2.WebView); + Invocation.method( + #createWebView, + [], + {#useHybridComposition: useHybridComposition}, + ), + returnValue: _FakeWebView_3( + this, + Invocation.method( + #createWebView, + [], + {#useHybridComposition: useHybridComposition}, + ), + ), + ) as _i2.WebView); @override _i5.Future<void> setWebContentsDebuggingEnabled(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setWebContentsDebuggingEnabled, [enabled]), - returnValue: Future<void>.value(), - returnValueForMissingStub: Future<void>.value()) as _i5.Future<void>); + Invocation.method( + #setWebContentsDebuggingEnabled, + [enabled], + ), + returnValue: _i5.Future<void>.value(), + returnValueForMissingStub: _i5.Future<void>.value(), + ) as _i5.Future<void>); }