diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index fc1b391494d..5767150a0bb 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 3.13.0 +* Adds support for `PlatformNavigationDelegate.setOnHttpAuthRequest`. * Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. ## 3.12.1 diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index 8e8a12cbd30..703c81a31da 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -2523,6 +2523,29 @@ public void doUpdateVisitedHistory( Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> callback.reply(null)); } + + public void onReceivedHttpAuthRequest( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long httpAuthHandlerInstanceIdArg, + @NonNull String hostArg, + @NonNull String realmArg, + @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest", + getCodec()); + channel.send( + new ArrayList( + Arrays.asList( + instanceIdArg, + webViewInstanceIdArg, + httpAuthHandlerInstanceIdArg, + hostArg, + realmArg)), + channelReply -> callback.reply(null)); + } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface DownloadListenerHostApi { @@ -3415,4 +3438,156 @@ public void create(@NonNull Long instanceIdArg, @NonNull Reply callback) { channelReply -> callback.reply(null)); } } + /** + * Host API for `HttpAuthHandler`. + * + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. + * + *

See https://developer.android.com/reference/android/webkit/HttpAuthHandler. + * + *

Generated interface from Pigeon that represents a handler of messages from Flutter. + */ + public interface HttpAuthHandlerHostApi { + /** Handles Dart method `HttpAuthHandler.useHttpAuthUsernamePassword`. */ + @NonNull + Boolean useHttpAuthUsernamePassword(@NonNull Long instanceId); + /** Handles Dart method `HttpAuthHandler.cancel`. */ + void cancel(@NonNull Long instanceId); + /** Handles Dart method `HttpAuthHandler.proceed`. */ + void proceed(@NonNull Long instanceId, @NonNull String username, @NonNull String password); + + /** The codec used by HttpAuthHandlerHostApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `HttpAuthHandlerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable HttpAuthHandlerHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number instanceIdArg = (Number) args.get(0); + try { + Boolean output = + api.useHttpAuthUsernamePassword( + (instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, output); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number instanceIdArg = (Number) args.get(0); + try { + api.cancel((instanceIdArg == null) ? null : instanceIdArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number instanceIdArg = (Number) args.get(0); + String usernameArg = (String) args.get(1); + String passwordArg = (String) args.get(2); + try { + api.proceed( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + usernameArg, + passwordArg); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } + /** + * Flutter API for `HttpAuthHandler`. + * + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. + * + *

See https://developer.android.com/reference/android/webkit/HttpAuthHandler. + * + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + */ + public static class HttpAuthHandlerFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public HttpAuthHandlerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by HttpAuthHandlerFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** Create a new Dart instance and add it to the `InstanceManager`. */ + public void create(@NonNull Long instanceIdArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerFlutterApi.create", + getCodec()); + channel.send( + new ArrayList(Collections.singletonList(instanceIdArg)), + channelReply -> callback.reply(null)); + } + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerFlutterApiImpl.java new file mode 100644 index 00000000000..1d5a170ff3b --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerFlutterApiImpl.java @@ -0,0 +1,51 @@ +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.HttpAuthHandler; +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.HttpAuthHandlerFlutterApi; + +/** + * Flutter API implementation for {@link HttpAuthHandler}. + * + *

This class may handle adding native instances that are attached to a Dart instance or passing + * arguments of callbacks methods to a Dart instance. + */ +public class HttpAuthHandlerFlutterApiImpl { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + + private final HttpAuthHandlerFlutterApi api; + + /** + * Constructs a {@link HttpAuthHandlerFlutterApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public HttpAuthHandlerFlutterApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + api = new HttpAuthHandlerFlutterApi(binaryMessenger); + } + + /** + * Stores the `HttpAuthHandler` instance and notifies Dart to create and store a new + * `HttpAuthHandler` instance that is attached to this one. If `instance` has already been added, + * this method does nothing. + */ + public void create( + @NonNull HttpAuthHandler instance, @NonNull HttpAuthHandlerFlutterApi.Reply callback) { + if (!instanceManager.containsInstance(instance)) { + api.create(instanceManager.addHostCreatedInstance(instance), callback); + } + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerHostApiImpl.java new file mode 100644 index 00000000000..591571d2a6c --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerHostApiImpl.java @@ -0,0 +1,57 @@ +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.HttpAuthHandler; +import androidx.annotation.NonNull; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.HttpAuthHandlerHostApi; +import java.util.Objects; + +/** + * Host api implementation for {@link HttpAuthHandler}. + * + *

Handles creating {@link HttpAuthHandler}s that intercommunicate with a paired Dart object. + */ +public class HttpAuthHandlerHostApiImpl implements HttpAuthHandlerHostApi { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + + /** + * Constructs a {@link HttpAuthHandlerHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public HttpAuthHandlerHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + } + + @NonNull + @Override + public Boolean useHttpAuthUsernamePassword(@NonNull Long instanceId) { + return getHttpAuthHandlerInstance(instanceId).useHttpAuthUsernamePassword(); + } + + @Override + public void cancel(@NonNull Long instanceId) { + getHttpAuthHandlerInstance(instanceId).cancel(); + } + + @Override + public void proceed( + @NonNull Long instanceId, @NonNull String username, @NonNull String password) { + getHttpAuthHandlerInstance(instanceId).proceed(username, password); + } + + private HttpAuthHandler getHttpAuthHandlerInstance(@NonNull Long instanceId) { + return Objects.requireNonNull(instanceManager.getInstance(instanceId)); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java index 4dee9c0ad3f..7a5a057cf11 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java @@ -6,6 +6,7 @@ import android.annotation.SuppressLint; import android.os.Build; +import android.webkit.HttpAuthHandler; import android.webkit.WebResourceError; import android.webkit.WebResourceRequest; import android.webkit.WebView; @@ -230,6 +231,26 @@ public void doUpdateVisitedHistory( getIdentifierForClient(webViewClient), webViewIdentifier, url, isReload, callback); } + /** Passes arguments from {@link WebViewClient#onReceivedHttpAuthRequest} to Dart. */ + public void onReceivedHttpAuthRequest( + @NonNull WebViewClient webViewClient, + @NonNull WebView webview, + @NonNull HttpAuthHandler httpAuthHandler, + @NonNull String host, + @NonNull String realm, + @NonNull Reply callback) { + new HttpAuthHandlerFlutterApiImpl(binaryMessenger, instanceManager) + .create(httpAuthHandler, reply -> {}); + + onReceivedHttpAuthRequest( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(webViewClient)), + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(webview)), + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(httpAuthHandler)), + host, + realm, + callback); + } + private long getIdentifierForClient(WebViewClient webViewClient) { final Long identifier = instanceManager.getIdentifierForStrongReference(webViewClient); if (identifier == null) { diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java index 35ae02a7625..1ace7bfe072 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java @@ -9,6 +9,7 @@ import android.graphics.Bitmap; import android.os.Build; import android.view.KeyEvent; +import android.webkit.HttpAuthHandler; import android.webkit.WebResourceError; import android.webkit.WebResourceRequest; import android.webkit.WebView; @@ -38,7 +39,7 @@ public static class WebViewClientImpl extends WebViewClient { /** * Creates a {@link WebViewClient} that passes arguments of callbacks methods to Dart. * - * @param flutterApi handles sending messages to Dart + * @param flutterApi handles sending messages to Dart. */ public WebViewClientImpl(@NonNull WebViewClientFlutterApiImpl flutterApi) { this.flutterApi = flutterApi; @@ -95,6 +96,15 @@ public void doUpdateVisitedHistory( flutterApi.doUpdateVisitedHistory(this, view, url, isReload, reply -> {}); } + @Override + public void onReceivedHttpAuthRequest( + @NonNull WebView view, + @NonNull HttpAuthHandler handler, + @NonNull String host, + @NonNull String realm) { + flutterApi.onReceivedHttpAuthRequest(this, view, handler, host, realm, reply -> {}); + } + @Override public void onUnhandledKeyEvent(@NonNull WebView view, @NonNull KeyEvent event) { // Deliberately empty. Occasionally the webview will mark events as having failed to be @@ -176,6 +186,16 @@ public void doUpdateVisitedHistory( flutterApi.doUpdateVisitedHistory(this, view, url, isReload, reply -> {}); } + // Handles an HTTP authentication request. + // + // This callback is invoked when the WebView encounters a website requiring HTTP authentication. + // [host] and [realm] are provided for matching against stored credentials, if any. + @Override + public void onReceivedHttpAuthRequest( + @NonNull WebView view, HttpAuthHandler handler, String host, String realm) { + flutterApi.onReceivedHttpAuthRequest(this, view, handler, host, realm, reply -> {}); + } + @Override public void onUnhandledKeyEvent(@NonNull WebView view, @NonNull KeyEvent event) { // Deliberately empty. Occasionally the webview will mark events as having failed to be diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java index e763c919e02..7f026119f47 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java @@ -19,6 +19,7 @@ import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.DownloadListenerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.FlutterAssetManagerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.GeolocationPermissionsCallbackHostApi; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.HttpAuthHandlerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.InstanceManagerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.JavaObjectHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.JavaScriptChannelHostApi; @@ -144,6 +145,8 @@ private void setUp( new GeolocationPermissionsCallbackHostApiImpl(binaryMessenger, instanceManager)); CustomViewCallbackHostApi.setup( binaryMessenger, new CustomViewCallbackHostApiImpl(binaryMessenger, instanceManager)); + HttpAuthHandlerHostApi.setup( + binaryMessenger, new HttpAuthHandlerHostApiImpl(binaryMessenger, instanceManager)); } @Override diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerTest.java new file mode 100644 index 00000000000..a66f41bd292 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/HttpAuthHandlerTest.java @@ -0,0 +1,76 @@ +// 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. + +package io.flutter.plugins.webviewflutter; + +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; + +import android.webkit.HttpAuthHandler; +import io.flutter.plugin.common.BinaryMessenger; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +public class HttpAuthHandlerTest { + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + + @Mock HttpAuthHandler mockAuthHandler; + + @Mock BinaryMessenger mockBinaryMessenger; + + InstanceManager instanceManager; + + @Before + public void setUp() { + instanceManager = InstanceManager.create(identifier -> {}); + } + + @After + public void tearDown() { + instanceManager.stopFinalizationListener(); + } + + @Test + public void proceed() { + final HttpAuthHandlerHostApiImpl hostApi = + new HttpAuthHandlerHostApiImpl(mockBinaryMessenger, instanceManager); + final long instanceIdentifier = 65L; + final String username = "username"; + final String password = "password"; + instanceManager.addDartCreatedInstance(mockAuthHandler, instanceIdentifier); + + hostApi.proceed(instanceIdentifier, username, password); + + verify(mockAuthHandler).proceed(eq(username), eq(password)); + } + + @Test + public void cancel() { + final HttpAuthHandlerHostApiImpl hostApi = + new HttpAuthHandlerHostApiImpl(mockBinaryMessenger, instanceManager); + final long instanceIdentifier = 65L; + instanceManager.addDartCreatedInstance(mockAuthHandler, instanceIdentifier); + + hostApi.cancel(instanceIdentifier); + + verify(mockAuthHandler).cancel(); + } + + @Test + public void useHttpAuthUsernamePassword() { + final HttpAuthHandlerHostApiImpl hostApi = + new HttpAuthHandlerHostApiImpl(mockBinaryMessenger, instanceManager); + final long instanceIdentifier = 65L; + instanceManager.addDartCreatedInstance(mockAuthHandler, instanceIdentifier); + + hostApi.useHttpAuthUsernamePassword(instanceIdentifier); + + verify(mockAuthHandler).useHttpAuthUsernamePassword(); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 19fd1a44758..9ed263e8dc6 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -35,6 +35,15 @@ Future main() async { request.response.writeln('${request.headers}'); } else if (request.uri.path == '/favicon.ico') { request.response.statusCode = HttpStatus.notFound; + } else if (request.uri.path == '/http-basic-authentication') { + final bool isAuthenticating = request.headers['Authorization'] != null; + if (isAuthenticating) { + request.response.writeln('Authorized'); + } else { + request.response.headers + .add('WWW-Authenticate', 'Basic realm="Test realm"'); + request.response.statusCode = HttpStatus.unauthorized; + } } else { fail('unexpected request: ${request.method} ${request.uri}'); } @@ -44,6 +53,7 @@ Future main() async { final String primaryUrl = '$prefixUrl/hello.txt'; final String secondaryUrl = '$prefixUrl/secondary.txt'; final String headersUrl = '$prefixUrl/headers'; + final String basicAuthUrl = '$prefixUrl/http-basic-authentication'; testWidgets('loadRequest', (WidgetTester tester) async { final Completer pageFinished = Completer(); @@ -1119,6 +1129,82 @@ Future main() async { }); }); + testWidgets('can receive HTTP basic auth requests', + (WidgetTester tester) async { + final Completer authRequested = Completer(); + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + ); + await navigationDelegate.setOnHttpAuthRequest( + (HttpAuthRequest request) => authRequested.complete()); + await controller.setPlatformNavigationDelegate(navigationDelegate); + + // Clear cache so that the auth request is always received and we don't get + // a cached response. + await controller.clearCache(); + + await tester.pumpWidget( + Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + AndroidWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + ), + ); + + await controller.loadRequest( + LoadRequestParams(uri: Uri.parse(basicAuthUrl)), + ); + + await expectLater(authRequested.future, completes); + }); + + testWidgets('can reply to HTTP basic auth requests', + (WidgetTester tester) async { + final Completer pageFinished = Completer(); + final PlatformWebViewController controller = PlatformWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + + final PlatformNavigationDelegate navigationDelegate = + PlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + ); + await navigationDelegate.setOnPageFinished((_) => pageFinished.complete()); + await navigationDelegate.setOnHttpAuthRequest( + (HttpAuthRequest request) => request.onProceed( + const WebViewCredential(user: 'user', password: 'password'), + ), + ); + await controller.setPlatformNavigationDelegate(navigationDelegate); + + // Clear cache so that the auth request is always received and we do not get + // a cached response. + await controller.clearCache(); + + await tester.pumpWidget( + Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + AndroidWebViewWidgetCreationParams(controller: controller), + ).build(context); + }, + ), + ); + + await controller.loadRequest( + LoadRequestParams(uri: Uri.parse(basicAuthUrl)), + ); + + await expectLater(pageFinished.future, completes); + }); + testWidgets('target _blank opens in same window', (WidgetTester tester) async { final Completer pageLoaded = Completer(); diff --git a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart index 68794e4157e..387fdb1bb66 100644 --- a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart @@ -161,6 +161,9 @@ Page resource error: }) ..setOnUrlChange((UrlChange change) { debugPrint('url change to ${change.url}'); + }) + ..setOnHttpAuthRequest((HttpAuthRequest request) { + openDialog(request); }), ) ..addJavaScriptChannel(JavaScriptChannelParams( @@ -179,9 +182,11 @@ Page resource error: request.grant(); }, ) - ..loadRequest(LoadRequestParams( - uri: Uri.parse('https://flutter.dev'), - )); + ..loadRequest( + LoadRequestParams( + uri: Uri.parse('https://flutter.dev'), + ), + ); } @override @@ -219,6 +224,50 @@ Page resource error: child: const Icon(Icons.favorite), ); } + + Future openDialog(HttpAuthRequest httpRequest) async { + final TextEditingController usernameTextController = + TextEditingController(); + final TextEditingController passwordTextController = + TextEditingController(); + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('${httpRequest.host}: ${httpRequest.realm ?? '-'}'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + decoration: const InputDecoration(labelText: 'Username'), + autofocus: true, + controller: usernameTextController, + ), + TextField( + decoration: const InputDecoration(labelText: 'Password'), + controller: passwordTextController, + ), + ], + ), + actions: [ + TextButton( + onPressed: () { + httpRequest.onProceed( + WebViewCredential( + user: usernameTextController.text, + password: passwordTextController.text, + ), + ); + Navigator.of(context).pop(); + }, + child: const Text('Authenticate'), + ), + ], + ); + }, + ); + } } enum MenuOptions { @@ -237,6 +286,7 @@ enum MenuOptions { setCookie, videoExample, logExample, + basicAuthentication, } class SampleMenu extends StatelessWidget { @@ -303,6 +353,9 @@ class SampleMenu extends StatelessWidget { case MenuOptions.logExample: _onLogExample(); break; + case MenuOptions.basicAuthentication: + _promptForUrl(context); + break; } }, itemBuilder: (BuildContext context) => >[ @@ -367,6 +420,10 @@ class SampleMenu extends StatelessWidget { value: MenuOptions.videoExample, child: Text('Video example'), ), + const PopupMenuItem( + value: MenuOptions.basicAuthentication, + child: Text('Basic Authentication Example'), + ), ], ); } @@ -546,9 +603,42 @@ class SampleMenu extends StatelessWidget { debugPrint( '== JS == ${consoleMessage.level.name}: ${consoleMessage.message}'); }); - return webViewController.loadHtmlString(kLogExamplePage); } + + Future _promptForUrl(BuildContext context) { + final TextEditingController urlTextController = TextEditingController(); + + return showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Input URL to visit'), + content: TextField( + decoration: const InputDecoration(labelText: 'URL'), + autofocus: true, + controller: urlTextController, + ), + actions: [ + TextButton( + onPressed: () { + if (urlTextController.text.isNotEmpty) { + final Uri? uri = Uri.tryParse(urlTextController.text); + if (uri != null && uri.scheme.isNotEmpty) { + webViewController.loadRequest( + LoadRequestParams(uri: uri), + ); + Navigator.pop(context); + } + } + }, + child: const Text('Visit'), + ), + ], + ); + }, + ); + } } class NavigationControls extends StatelessWidget { diff --git a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml index e88143ab6a1..337a70d06a3 100644 --- a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - webview_flutter_platform_interface: ^2.6.0 + webview_flutter_platform_interface: ^2.7.0 dev_dependencies: espresso: ^0.2.0 diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart index f3d00ebd88e..339ce9fed2b 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart @@ -78,6 +78,12 @@ class AndroidWebViewProxy { void Function(android_webview.WebView webView, String url)? urlLoading, void Function(android_webview.WebView webView, String url, bool isReload)? doUpdateVisitedHistory, + void Function( + android_webview.WebView webView, + android_webview.HttpAuthHandler handler, + String host, + String realm, + )? onReceivedHttpAuthRequest, }) createAndroidWebViewClient; /// Constructs a [android_webview.FlutterAssetManager]. diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart index c0778ed0722..f18c66b02e3 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart @@ -769,6 +769,7 @@ class WebViewClient extends JavaObject { this.requestLoading, this.urlLoading, this.doUpdateVisitedHistory, + this.onReceivedHttpAuthRequest, @visibleForTesting super.binaryMessenger, @visibleForTesting super.instanceManager, }) : super.detached() { @@ -789,6 +790,7 @@ class WebViewClient extends JavaObject { this.requestLoading, this.urlLoading, this.doUpdateVisitedHistory, + this.onReceivedHttpAuthRequest, super.binaryMessenger, super.instanceManager, }) : super.detached(); @@ -937,6 +939,14 @@ class WebViewClient extends JavaObject { final void Function(WebView webView, String url, bool isReload)? doUpdateVisitedHistory; + /// This callback is only called for requests that require HTTP authentication. + final void Function( + WebView webView, + HttpAuthHandler handler, + String host, + String realm, + )? onReceivedHttpAuthRequest; + /// Sets the required synchronous return value for the Java method, /// `WebViewClient.shouldOverrideUrlLoading(...)`. /// @@ -965,6 +975,7 @@ class WebViewClient extends JavaObject { requestLoading: requestLoading, urlLoading: urlLoading, doUpdateVisitedHistory: doUpdateVisitedHistory, + onReceivedHttpAuthRequest: onReceivedHttpAuthRequest, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); @@ -1496,3 +1507,41 @@ class CustomViewCallback extends JavaObject { ); } } + +/// Represents a request for HTTP authentication. +/// +/// Instances of this class are created by the [WebView] and passed to +/// [WebViewClient.onReceivedHttpAuthRequest]. The host application must call +/// either [HttpAuthHandler.proceed] or [HttpAuthHandler.cancel] to set the +/// WebView's response to the request. +class HttpAuthHandler extends JavaObject { + /// Constructs a [HttpAuthHandler]. + HttpAuthHandler({ + super.binaryMessenger, + super.instanceManager, + }) : super.detached(); + + /// Pigeon Host Api implementation for [HttpAuthHandler]. + @visibleForTesting + static HttpAuthHandlerHostApiImpl api = HttpAuthHandlerHostApiImpl(); + + /// Instructs the WebView to cancel the authentication request. + Future cancel() { + return api.cancelFromInstance(this); + } + + /// Instructs the WebView to proceed with the authentication with the provided + /// credentials. + Future proceed(String username, String password) { + return api.proceedFromInstance(this, username, password); + } + + /// Gets whether the credentials stored for the current host are suitable for + /// use. + /// + /// Credentials are not suitable if they have previously been rejected by the + /// server for the current request. + Future useHttpAuthUsernamePassword() { + return api.useHttpAuthUsernamePasswordFromInstance(this); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index 8435f7302fa..6911ed651da 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -1703,6 +1703,9 @@ abstract class WebViewClientFlutterApi { void doUpdateVisitedHistory( int instanceId, int webViewInstanceId, String url, bool isReload); + void onReceivedHttpAuthRequest(int instanceId, int webViewInstanceId, + int httpAuthHandlerInstanceId, String host, String realm); + static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1906,6 +1909,39 @@ abstract class WebViewClientFlutterApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null int.'); + final int? arg_webViewInstanceId = (args[1] as int?); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null int.'); + final int? arg_httpAuthHandlerInstanceId = (args[2] as int?); + assert(arg_httpAuthHandlerInstanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null int.'); + final String? arg_host = (args[3] as String?); + assert(arg_host != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null String.'); + final String? arg_realm = (args[4] as String?); + assert(arg_realm != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.WebViewClientFlutterApi.onReceivedHttpAuthRequest was null, expected non-null String.'); + api.onReceivedHttpAuthRequest(arg_instanceId!, arg_webViewInstanceId!, + arg_httpAuthHandlerInstanceId!, arg_host!, arg_realm!); + return; + }); + } + } } } @@ -2799,3 +2835,138 @@ abstract class GeolocationPermissionsCallbackFlutterApi { } } } + +/// Host API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +class HttpAuthHandlerHostApi { + /// Constructor for [HttpAuthHandlerHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + HttpAuthHandlerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `HttpAuthHandler.useHttpAuthUsernamePassword`. + Future useHttpAuthUsernamePassword(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_instanceId]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (replyList[0] as bool?)!; + } + } + + /// Handles Dart method `HttpAuthHandler.cancel`. + Future cancel(int arg_instanceId) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_instanceId]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } + + /// Handles Dart method `HttpAuthHandler.proceed`. + Future proceed( + int arg_instanceId, String arg_username, String arg_password) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_instanceId, arg_username, arg_password]) + as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Flutter API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +abstract class HttpAuthHandlerFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int instanceId); + + static void setup(HttpAuthHandlerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerFlutterApi.create', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerFlutterApi.create was null, expected non-null int.'); + api.create(arg_instanceId!); + return; + }); + } + } + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart index 4ecb06b0579..e0e4c9a3b7a 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart @@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:typed_data'; import 'dart:ui'; -import 'package:flutter/services.dart' show BinaryMessenger; +import 'package:flutter/services.dart' show BinaryMessenger, Uint8List; import 'android_webview.dart'; import 'android_webview.g.dart'; @@ -50,6 +49,7 @@ class AndroidWebViewFlutterApis { PermissionRequestFlutterApiImpl? permissionRequestFlutterApi, CustomViewCallbackFlutterApiImpl? customViewCallbackFlutterApi, ViewFlutterApiImpl? viewFlutterApi, + HttpAuthHandlerFlutterApiImpl? httpAuthHandlerFlutterApi, }) { this.javaObjectFlutterApi = javaObjectFlutterApi ?? JavaObjectFlutterApiImpl(); @@ -72,6 +72,8 @@ class AndroidWebViewFlutterApis { this.customViewCallbackFlutterApi = customViewCallbackFlutterApi ?? CustomViewCallbackFlutterApiImpl(); this.viewFlutterApi = viewFlutterApi ?? ViewFlutterApiImpl(); + this.httpAuthHandlerFlutterApi = + httpAuthHandlerFlutterApi ?? HttpAuthHandlerFlutterApiImpl(); } static bool _haveBeenSetUp = false; @@ -115,6 +117,9 @@ class AndroidWebViewFlutterApis { /// Flutter Api for [View]. late final ViewFlutterApiImpl viewFlutterApi; + /// Flutter Api for [HttpAuthHandler]. + late final HttpAuthHandlerFlutterApiImpl httpAuthHandlerFlutterApi; + /// Ensures all the Flutter APIs have been setup to receive calls from native code. void ensureSetUp() { if (!_haveBeenSetUp) { @@ -130,6 +135,7 @@ class AndroidWebViewFlutterApis { PermissionRequestFlutterApi.setup(permissionRequestFlutterApi); CustomViewCallbackFlutterApi.setup(customViewCallbackFlutterApi); ViewFlutterApi.setup(viewFlutterApi); + HttpAuthHandlerFlutterApi.setup(httpAuthHandlerFlutterApi); _haveBeenSetUp = true; } } @@ -803,16 +809,49 @@ class WebViewClientFlutterApiImpl extends WebViewClientFlutterApi { .getInstanceWithWeakReference(webViewInstanceId) as WebView?; assert( instance != null, - 'InstanceManager does not contain an WebViewClient with instanceId: $instanceId', + 'InstanceManager does not contain a WebViewClient with instanceId: $instanceId', ); assert( webViewInstance != null, - 'InstanceManager does not contain an WebView with instanceId: $webViewInstanceId', + 'InstanceManager does not contain a WebView with instanceId: $webViewInstanceId', ); if (instance!.doUpdateVisitedHistory != null) { instance.doUpdateVisitedHistory!(webViewInstance!, url, isReload); } } + + @override + void onReceivedHttpAuthRequest( + int instanceId, + int webViewInstanceId, + int httpAuthHandlerInstanceId, + String host, + String realm, + ) { + final WebViewClient? instance = instanceManager + .getInstanceWithWeakReference(instanceId) as WebViewClient?; + final WebView? webViewInstance = instanceManager + .getInstanceWithWeakReference(webViewInstanceId) as WebView?; + final HttpAuthHandler? httpAuthHandlerInstance = + instanceManager.getInstanceWithWeakReference(httpAuthHandlerInstanceId) + as HttpAuthHandler?; + assert( + instance != null, + 'InstanceManager does not contain a WebViewClient with instanceId: $instanceId', + ); + assert( + webViewInstance != null, + 'InstanceManager does not contain a WebView with instanceId: $webViewInstanceId', + ); + assert( + httpAuthHandlerInstance != null, + 'InstanceManager does not contain a HttpAuthHandler with instanceId: $httpAuthHandlerInstanceId', + ); + if (instance!.onReceivedHttpAuthRequest != null) { + return instance.onReceivedHttpAuthRequest!( + webViewInstance!, httpAuthHandlerInstance!, host, realm); + } + } } /// Host api implementation for [DownloadListener]. @@ -1390,3 +1429,68 @@ class CookieManagerHostApiImpl extends CookieManagerHostApi { ); } } + +/// Host api implementation for [HttpAuthHandler]. +class HttpAuthHandlerHostApiImpl extends HttpAuthHandlerHostApi { + /// Constructs a [HttpAuthHandlerHostApiImpl]. + HttpAuthHandlerHostApiImpl({ + super.binaryMessenger, + InstanceManager? instanceManager, + }) : _instanceManager = instanceManager ?? JavaObject.globalInstanceManager; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager _instanceManager; + + /// Helper method to convert instance ids to objects. + Future cancelFromInstance(HttpAuthHandler instance) { + return cancel(_instanceManager.getIdentifier(instance)!); + } + + /// Helper method to convert instance ids to objects. + Future proceedFromInstance( + HttpAuthHandler instance, + String username, + String password, + ) { + return proceed( + _instanceManager.getIdentifier(instance)!, + username, + password, + ); + } + + /// Helper method to convert instance ids to objects. + Future useHttpAuthUsernamePasswordFromInstance( + HttpAuthHandler instance, + ) { + return useHttpAuthUsernamePassword( + _instanceManager.getIdentifier(instance)!, + ); + } +} + +/// Flutter API implementation for [HttpAuthHandler]. +class HttpAuthHandlerFlutterApiImpl extends HttpAuthHandlerFlutterApi { + /// Constructs a [HttpAuthHandlerFlutterApiImpl]. + HttpAuthHandlerFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int instanceId) { + instanceManager.addHostCreatedInstance( + HttpAuthHandler(), + instanceId, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index ccfe14391e8..bb90f393cdd 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -77,7 +77,7 @@ class AndroidWebViewPermissionResourceType /// Implementation of the [PlatformWebViewController] with the Android WebView API. class AndroidWebViewController extends PlatformWebViewController { - /// Creates a new [AndroidWebViewCookieManager]. + /// Creates a new [AndroidWebViewController]. AndroidWebViewController(PlatformWebViewControllerCreationParams params) : super.implementation(params is AndroidWebViewControllerCreationParams ? params @@ -1268,6 +1268,31 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { callback(AndroidUrlChange(url: url, isReload: isReload)); } }, + onReceivedHttpAuthRequest: ( + android_webview.WebView webView, + android_webview.HttpAuthHandler httpAuthHandler, + String host, + String realm, + ) { + final void Function(HttpAuthRequest)? callback = + weakThis.target?._onHttpAuthRequest; + if (callback != null) { + callback( + HttpAuthRequest( + onProceed: (WebViewCredential credential) { + httpAuthHandler.proceed(credential.user, credential.password); + }, + onCancel: () { + httpAuthHandler.cancel(); + }, + host: host, + realm: realm, + ), + ); + } else { + httpAuthHandler.cancel(); + } + }, ); _downloadListener = (this.params as AndroidNavigationDelegateCreationParams) @@ -1324,6 +1349,7 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { NavigationRequestCallback? _onNavigationRequest; LoadRequestCallback? _onLoadRequest; UrlChangeCallback? _onUrlChange; + HttpAuthRequestCallback? _onHttpAuthRequest; void _handleNavigation( String url, { @@ -1410,4 +1436,11 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { Future setOnUrlChange(UrlChangeCallback onUrlChange) async { _onUrlChange = onUrlChange; } + + @override + Future setOnHttpAuthRequest( + HttpAuthRequestCallback onHttpAuthRequest, + ) async { + _onHttpAuthRequest = onHttpAuthRequest; + } } diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart index 6cce34382a1..34e8f21bde1 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart @@ -358,6 +358,14 @@ abstract class WebViewClientFlutterApi { String url, bool isReload, ); + + void onReceivedHttpAuthRequest( + int instanceId, + int webViewInstanceId, + int httpAuthHandlerInstanceId, + String host, + String realm, + ); } @HostApi(dartHostTestHandler: 'TestDownloadListenerHostApi') @@ -551,3 +559,35 @@ abstract class GeolocationPermissionsCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId); } + +/// Host API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +@HostApi(dartHostTestHandler: 'TestHttpAuthHandlerHostApi') +abstract class HttpAuthHandlerHostApi { + /// Handles Dart method `HttpAuthHandler.useHttpAuthUsernamePassword`. + bool useHttpAuthUsernamePassword(int instanceId); + + /// Handles Dart method `HttpAuthHandler.cancel`. + void cancel(int instanceId); + + /// Handles Dart method `HttpAuthHandler.proceed`. + void proceed(int instanceId, String username, String password); +} + +/// Flutter API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +@FlutterApi() +abstract class HttpAuthHandlerFlutterApi { + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int instanceId); +} diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 92aa739c30f..a026b2f2bd3 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_android description: A Flutter plugin that provides a WebView widget on Android. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.12.1 +version: 3.13.0 environment: sdk: ">=3.0.0 <4.0.0" @@ -20,7 +20,7 @@ flutter: dependencies: flutter: sdk: flutter - webview_flutter_platform_interface: ^2.6.0 + webview_flutter_platform_interface: ^2.7.0 dev_dependencies: build_runner: ^2.1.4 diff --git a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart index 269123e081d..3b407a8d65f 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart @@ -446,27 +446,52 @@ void main() { expect(callbackNavigationRequest.url, 'https://www.google.com'); expect(completer.isCompleted, true); }); - }); - test('onUrlChange', () { - final AndroidNavigationDelegate androidNavigationDelegate = - AndroidNavigationDelegate(_buildCreationParams()); - - late final AndroidUrlChange urlChange; - androidNavigationDelegate.setOnUrlChange( - (UrlChange change) { - urlChange = change as AndroidUrlChange; - }, - ); - - CapturingWebViewClient.lastCreatedDelegate.doUpdateVisitedHistory!( - android_webview.WebView.detached(), - 'https://www.google.com', - false, - ); - - expect(urlChange.url, 'https://www.google.com'); - expect(urlChange.isReload, isFalse); + test('onUrlChange', () { + final AndroidNavigationDelegate androidNavigationDelegate = + AndroidNavigationDelegate(_buildCreationParams()); + + late final AndroidUrlChange urlChange; + androidNavigationDelegate.setOnUrlChange( + (UrlChange change) { + urlChange = change as AndroidUrlChange; + }, + ); + + CapturingWebViewClient.lastCreatedDelegate.doUpdateVisitedHistory!( + android_webview.WebView.detached(), + 'https://www.google.com', + false, + ); + + expect(urlChange.url, 'https://www.google.com'); + expect(urlChange.isReload, isFalse); + }); + + test('onReceivedHttpAuthRequest emits host and realm', () { + final AndroidNavigationDelegate androidNavigationDelegate = + AndroidNavigationDelegate(_buildCreationParams()); + + String? callbackHost; + String? callbackRealm; + androidNavigationDelegate.setOnHttpAuthRequest((HttpAuthRequest request) { + callbackHost = request.host; + callbackRealm = request.realm; + }); + + const String expectedHost = 'expectedHost'; + const String expectedRealm = 'expectedRealm'; + + CapturingWebViewClient.lastCreatedDelegate.onReceivedHttpAuthRequest!( + android_webview.WebView.detached(), + android_webview.HttpAuthHandler(), + expectedHost, + expectedRealm, + ); + + expect(callbackHost, expectedHost); + expect(callbackRealm, expectedRealm); + }); }); } @@ -489,6 +514,7 @@ class CapturingWebViewClient extends android_webview.WebViewClient { super.onPageFinished, super.onPageStarted, super.onReceivedError, + super.onReceivedHttpAuthRequest, super.onReceivedRequestError, super.requestLoading, super.urlLoading, diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index 6a7bf30e614..ee1e27a2a69 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -132,6 +132,12 @@ void main() { String description, String failingUrl, )? onReceivedError, + void Function( + android_webview.WebView webView, + android_webview.HttpAuthHandler hander, + String host, + String realm, + )? onReceivedHttpAuthRequest, void Function( android_webview.WebView webView, android_webview.WebResourceRequest request, diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart index e567de98125..c50a1b065f6 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart @@ -256,7 +256,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock Invocation.getter(#androidWebChromeClient), ), ) as _i2.WebChromeClient); - @override _i2.WebViewClient get androidWebViewClient => (super.noSuchMethod( Invocation.getter(#androidWebViewClient), @@ -269,7 +268,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock Invocation.getter(#androidWebViewClient), ), ) as _i2.WebViewClient); - @override _i2.DownloadListener get androidDownloadListener => (super.noSuchMethod( Invocation.getter(#androidDownloadListener), @@ -282,7 +280,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock Invocation.getter(#androidDownloadListener), ), ) as _i2.DownloadListener); - @override _i3.PlatformNavigationDelegateCreationParams get params => (super.noSuchMethod( @@ -297,7 +294,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock Invocation.getter(#params), ), ) as _i3.PlatformNavigationDelegateCreationParams); - @override _i9.Future setOnLoadRequest(_i8.LoadRequestCallback? onLoadRequest) => (super.noSuchMethod( @@ -308,7 +304,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setOnNavigationRequest( _i3.NavigationRequestCallback? onNavigationRequest) => @@ -320,7 +315,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setOnPageStarted(_i3.PageEventCallback? onPageStarted) => (super.noSuchMethod( @@ -331,7 +325,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setOnPageFinished(_i3.PageEventCallback? onPageFinished) => (super.noSuchMethod( @@ -342,7 +335,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setOnProgress(_i3.ProgressCallback? onProgress) => (super.noSuchMethod( @@ -353,7 +345,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setOnWebResourceError( _i3.WebResourceErrorCallback? onWebResourceError) => @@ -365,7 +356,6 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setOnUrlChange(_i3.UrlChangeCallback? onUrlChange) => (super.noSuchMethod( @@ -376,7 +366,17 @@ class MockAndroidNavigationDelegate extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - + @override + _i9.Future setOnHttpAuthRequest( + _i3.HttpAuthRequestCallback? onHttpAuthRequest) => + (super.noSuchMethod( + Invocation.method( + #setOnHttpAuthRequest, + [onHttpAuthRequest], + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); @override _i9.Future setOnHttpError(_i3.HttpResponseErrorCallback? onHttpError) => (super.noSuchMethod( @@ -400,7 +400,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: 0, returnValueForMissingStub: 0, ) as int); - @override _i3.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod( Invocation.getter(#params), @@ -414,7 +413,6 @@ class MockAndroidWebViewController extends _i1.Mock Invocation.getter(#params), ), ) as _i3.PlatformWebViewControllerCreationParams); - @override _i9.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( Invocation.method( @@ -424,7 +422,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( @@ -434,7 +431,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future loadHtmlString( String? html, { @@ -449,7 +445,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future loadRequest(_i3.LoadRequestParams? params) => (super.noSuchMethod( @@ -460,7 +455,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future currentUrl() => (super.noSuchMethod( Invocation.method( @@ -470,7 +464,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -480,7 +473,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(false), returnValueForMissingStub: _i9.Future.value(false), ) as _i9.Future); - @override _i9.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -490,7 +482,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(false), returnValueForMissingStub: _i9.Future.value(false), ) as _i9.Future); - @override _i9.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -500,7 +491,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -510,7 +500,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future reload() => (super.noSuchMethod( Invocation.method( @@ -520,7 +509,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future clearCache() => (super.noSuchMethod( Invocation.method( @@ -530,7 +518,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future clearLocalStorage() => (super.noSuchMethod( Invocation.method( @@ -540,7 +527,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setPlatformNavigationDelegate( _i3.PlatformNavigationDelegate? handler) => @@ -552,7 +538,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future runJavaScript(String? javaScript) => (super.noSuchMethod( Invocation.method( @@ -562,7 +547,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( @@ -585,7 +569,6 @@ class MockAndroidWebViewController extends _i1.Mock ), )), ) as _i9.Future); - @override _i9.Future addJavaScriptChannel( _i3.JavaScriptChannelParams? javaScriptChannelParams) => @@ -597,7 +580,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( @@ -608,7 +590,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -618,7 +599,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future scrollTo( int? x, @@ -635,7 +615,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future scrollBy( int? x, @@ -652,7 +631,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -674,7 +652,6 @@ class MockAndroidWebViewController extends _i1.Mock ), )), ) as _i9.Future<_i4.Offset>); - @override _i9.Future enableZoom(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -684,7 +661,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( @@ -694,7 +670,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setJavaScriptMode(_i3.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( @@ -705,7 +680,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( @@ -715,7 +689,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( @@ -726,7 +699,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setTextZoom(int? textZoom) => (super.noSuchMethod( Invocation.method( @@ -736,7 +708,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setOnShowFileSelector( _i9.Future> Function(_i8.FileSelectorParams)? @@ -749,7 +720,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setOnPlatformPermissionRequest( void Function(_i3.PlatformWebViewPermissionRequest)? @@ -762,7 +732,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setGeolocationPermissionsPromptCallbacks({ _i8.OnGeolocationPermissionsShowPrompt? onShowPrompt, @@ -780,7 +749,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setCustomWidgetCallbacks({ required _i8.OnShowCustomWidgetCallback? onShowCustomWidget, @@ -798,7 +766,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setOnConsoleMessage( void Function(_i3.JavaScriptConsoleMessage)? onConsoleMessage) => @@ -810,7 +777,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future getUserAgent() => (super.noSuchMethod( Invocation.method( @@ -839,7 +805,6 @@ class MockAndroidWebViewProxy extends _i1.Mock Invocation.getter(#createAndroidWebView), ), ) as _i2.WebView Function()); - @override _i2.WebChromeClient Function({ void Function( @@ -968,7 +933,6 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.FileChooserParams, )? onShowFileChooser, })); - @override _i2.WebViewClient Function({ void Function( @@ -990,6 +954,12 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onReceivedError, + void Function( + _i2.WebView, + _i2.HttpAuthHandler, + String, + String, + )? onReceivedHttpAuthRequest, void Function( _i2.WebView, _i2.WebResourceRequest, @@ -1025,6 +995,12 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onReceivedError, + void Function( + _i2.WebView, + _i2.HttpAuthHandler, + String, + String, + )? onReceivedHttpAuthRequest, void Function( _i2.WebView, _i2.WebResourceRequest, @@ -1063,6 +1039,12 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onReceivedError, + void Function( + _i2.WebView, + _i2.HttpAuthHandler, + String, + String, + )? onReceivedHttpAuthRequest, void Function( _i2.WebView, _i2.WebResourceRequest, @@ -1101,6 +1083,12 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onReceivedError, + void Function( + _i2.WebView, + _i2.HttpAuthHandler, + String, + String, + )? onReceivedHttpAuthRequest, void Function( _i2.WebView, _i2.WebResourceRequest, @@ -1115,7 +1103,6 @@ class MockAndroidWebViewProxy extends _i1.Mock String, )? urlLoading, })); - @override _i2.FlutterAssetManager Function() get createFlutterAssetManager => (super.noSuchMethod( @@ -1129,7 +1116,6 @@ class MockAndroidWebViewProxy extends _i1.Mock Invocation.getter(#createFlutterAssetManager), ), ) as _i2.FlutterAssetManager Function()); - @override _i2.JavaScriptChannel Function( String, { @@ -1156,7 +1142,6 @@ class MockAndroidWebViewProxy extends _i1.Mock String, { required void Function(String) postMessage, })); - @override _i2.DownloadListener Function( {required void Function( @@ -1199,7 +1184,6 @@ class MockAndroidWebViewProxy extends _i1.Mock String, int, ) onDownloadStart})); - @override _i9.Future setWebContentsDebuggingEnabled(bool? enabled) => (super.noSuchMethod( @@ -1230,7 +1214,6 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock Invocation.getter(#instanceManager), ), ) as _i5.InstanceManager); - @override _i6.PlatformViewsServiceProxy get platformViewsServiceProxy => (super.noSuchMethod( @@ -1244,14 +1227,12 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock Invocation.getter(#platformViewsServiceProxy), ), ) as _i6.PlatformViewsServiceProxy); - @override bool get displayWithHybridComposition => (super.noSuchMethod( Invocation.getter(#displayWithHybridComposition), returnValue: false, returnValueForMissingStub: false, ) as bool); - @override _i3.PlatformWebViewController get controller => (super.noSuchMethod( Invocation.getter(#controller), @@ -1264,14 +1245,12 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock Invocation.getter(#controller), ), ) as _i3.PlatformWebViewController); - @override _i4.TextDirection get layoutDirection => (super.noSuchMethod( Invocation.getter(#layoutDirection), returnValue: _i4.TextDirection.rtl, returnValueForMissingStub: _i4.TextDirection.rtl, ) as _i4.TextDirection); - @override Set<_i11.Factory<_i12.OneSequenceGestureRecognizer>> get gestureRecognizers => (super.noSuchMethod( @@ -1293,21 +1272,18 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: false, returnValueForMissingStub: false, ) as bool); - @override int get viewId => (super.noSuchMethod( Invocation.getter(#viewId), returnValue: 0, returnValueForMissingStub: 0, ) as int); - @override bool get awaitingCreation => (super.noSuchMethod( Invocation.getter(#awaitingCreation), returnValue: false, returnValueForMissingStub: false, ) as bool); - @override _i7.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), @@ -1320,7 +1296,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock Invocation.getter(#pointTransformer), ), ) as _i7.PointTransformer); - @override set pointTransformer(_i7.PointTransformer? transformer) => super.noSuchMethod( Invocation.setter( @@ -1329,14 +1304,12 @@ class MockExpensiveAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); - @override bool get isCreated => (super.noSuchMethod( Invocation.getter(#isCreated), returnValue: false, returnValueForMissingStub: false, ) as bool); - @override List<_i7.PlatformViewCreatedCallback> get createdCallbacks => (super.noSuchMethod( @@ -1344,7 +1317,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: <_i7.PlatformViewCreatedCallback>[], returnValueForMissingStub: <_i7.PlatformViewCreatedCallback>[], ) as List<_i7.PlatformViewCreatedCallback>); - @override _i9.Future setOffset(_i4.Offset? off) => (super.noSuchMethod( Invocation.method( @@ -1354,7 +1326,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future create({ _i4.Size? size, @@ -1372,7 +1343,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future<_i4.Size> setSize(_i4.Size? size) => (super.noSuchMethod( Invocation.method( @@ -1394,7 +1364,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock ), )), ) as _i9.Future<_i4.Size>); - @override _i9.Future sendMotionEvent(_i7.AndroidMotionEvent? event) => (super.noSuchMethod( @@ -1405,7 +1374,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override void addOnPlatformViewCreatedListener( _i7.PlatformViewCreatedCallback? listener) => @@ -1416,7 +1384,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void removeOnPlatformViewCreatedListener( _i7.PlatformViewCreatedCallback? listener) => @@ -1427,7 +1394,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); - @override _i9.Future setLayoutDirection(_i4.TextDirection? layoutDirection) => (super.noSuchMethod( @@ -1438,7 +1404,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future dispatchPointerEvent(_i12.PointerEvent? event) => (super.noSuchMethod( @@ -1449,7 +1414,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future clearFocus() => (super.noSuchMethod( Invocation.method( @@ -1459,7 +1423,6 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future dispose() => (super.noSuchMethod( Invocation.method( @@ -1485,7 +1448,6 @@ class MockFlutterAssetManager extends _i1.Mock returnValue: _i9.Future>.value([]), returnValueForMissingStub: _i9.Future>.value([]), ) as _i9.Future>); - @override _i9.Future getAssetFilePathByName(String? name) => (super.noSuchMethod( @@ -1527,14 +1489,12 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { Invocation.getter(#channelName), ), ) as String); - @override void Function(String) get postMessage => (super.noSuchMethod( Invocation.getter(#postMessage), returnValue: (String message) {}, returnValueForMissingStub: (String message) {}, ) as void Function(String)); - @override _i2.JavaScriptChannel copy() => (super.noSuchMethod( Invocation.method( @@ -1568,7 +1528,6 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { returnValue: [], returnValueForMissingStub: [], ) as List); - @override _i9.Future grant(List? resources) => (super.noSuchMethod( Invocation.method( @@ -1578,7 +1537,6 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future deny() => (super.noSuchMethod( Invocation.method( @@ -1588,7 +1546,6 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i2.PermissionRequest copy() => (super.noSuchMethod( Invocation.method( @@ -1671,7 +1628,6 @@ class MockPlatformViewsServiceProxy extends _i1.Mock ), ), ) as _i7.ExpensiveAndroidViewController); - @override _i7.SurfaceAndroidViewController initSurfaceAndroidView({ required int? id, @@ -1738,21 +1694,18 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: false, returnValueForMissingStub: false, ) as bool); - @override int get viewId => (super.noSuchMethod( Invocation.getter(#viewId), returnValue: 0, returnValueForMissingStub: 0, ) as int); - @override bool get awaitingCreation => (super.noSuchMethod( Invocation.getter(#awaitingCreation), returnValue: false, returnValueForMissingStub: false, ) as bool); - @override _i7.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), @@ -1765,7 +1718,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock Invocation.getter(#pointTransformer), ), ) as _i7.PointTransformer); - @override set pointTransformer(_i7.PointTransformer? transformer) => super.noSuchMethod( Invocation.setter( @@ -1774,14 +1726,12 @@ class MockSurfaceAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); - @override bool get isCreated => (super.noSuchMethod( Invocation.getter(#isCreated), returnValue: false, returnValueForMissingStub: false, ) as bool); - @override List<_i7.PlatformViewCreatedCallback> get createdCallbacks => (super.noSuchMethod( @@ -1789,7 +1739,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: <_i7.PlatformViewCreatedCallback>[], returnValueForMissingStub: <_i7.PlatformViewCreatedCallback>[], ) as List<_i7.PlatformViewCreatedCallback>); - @override _i9.Future setOffset(_i4.Offset? off) => (super.noSuchMethod( Invocation.method( @@ -1799,7 +1748,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future create({ _i4.Size? size, @@ -1817,7 +1765,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future<_i4.Size> setSize(_i4.Size? size) => (super.noSuchMethod( Invocation.method( @@ -1839,7 +1786,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock ), )), ) as _i9.Future<_i4.Size>); - @override _i9.Future sendMotionEvent(_i7.AndroidMotionEvent? event) => (super.noSuchMethod( @@ -1850,7 +1796,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override void addOnPlatformViewCreatedListener( _i7.PlatformViewCreatedCallback? listener) => @@ -1861,7 +1806,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void removeOnPlatformViewCreatedListener( _i7.PlatformViewCreatedCallback? listener) => @@ -1872,7 +1816,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock ), returnValueForMissingStub: null, ); - @override _i9.Future setLayoutDirection(_i4.TextDirection? layoutDirection) => (super.noSuchMethod( @@ -1883,7 +1826,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future dispatchPointerEvent(_i12.PointerEvent? event) => (super.noSuchMethod( @@ -1894,7 +1836,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future clearFocus() => (super.noSuchMethod( Invocation.method( @@ -1904,7 +1845,6 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future dispose() => (super.noSuchMethod( Invocation.method( @@ -1930,7 +1870,6 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setSynchronousReturnValueForOnConsoleMessage(bool? value) => (super.noSuchMethod( @@ -1941,7 +1880,6 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i2.WebChromeClient copy() => (super.noSuchMethod( Invocation.method( @@ -1978,7 +1916,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setJavaScriptCanOpenWindowsAutomatically(bool? flag) => (super.noSuchMethod( @@ -1989,7 +1926,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setSupportMultipleWindows(bool? support) => (super.noSuchMethod( @@ -2000,7 +1936,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setJavaScriptEnabled(bool? flag) => (super.noSuchMethod( Invocation.method( @@ -2010,7 +1945,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setUserAgentString(String? userAgentString) => (super.noSuchMethod( @@ -2021,7 +1955,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( @@ -2032,7 +1965,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setSupportZoom(bool? support) => (super.noSuchMethod( Invocation.method( @@ -2042,7 +1974,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setLoadWithOverviewMode(bool? overview) => (super.noSuchMethod( @@ -2053,7 +1984,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setUseWideViewPort(bool? use) => (super.noSuchMethod( Invocation.method( @@ -2063,7 +1993,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setDisplayZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -2073,7 +2002,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setBuiltInZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -2083,7 +2011,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setAllowFileAccess(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -2093,7 +2020,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setTextZoom(int? textZoom) => (super.noSuchMethod( Invocation.method( @@ -2103,7 +2029,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future getUserAgentString() => (super.noSuchMethod( Invocation.method( @@ -2126,7 +2051,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { ), )), ) as _i9.Future); - @override _i2.WebSettings copy() => (super.noSuchMethod( Invocation.method( @@ -2166,7 +2090,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { Invocation.getter(#settings), ), ) as _i2.WebSettings); - @override _i9.Future loadData({ required String? data, @@ -2186,7 +2109,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future loadDataWithBaseUrl({ String? baseUrl, @@ -2210,7 +2132,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future loadUrl( String? url, @@ -2227,7 +2148,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future postUrl( String? url, @@ -2244,7 +2164,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future getUrl() => (super.noSuchMethod( Invocation.method( @@ -2254,7 +2173,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -2264,7 +2182,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(false), returnValueForMissingStub: _i9.Future.value(false), ) as _i9.Future); - @override _i9.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -2274,7 +2191,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(false), returnValueForMissingStub: _i9.Future.value(false), ) as _i9.Future); - @override _i9.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -2284,7 +2200,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -2294,7 +2209,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future reload() => (super.noSuchMethod( Invocation.method( @@ -2304,7 +2218,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future clearCache(bool? includeDiskFiles) => (super.noSuchMethod( Invocation.method( @@ -2314,7 +2227,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future evaluateJavascript(String? javascriptString) => (super.noSuchMethod( @@ -2325,7 +2237,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -2335,7 +2246,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future scrollTo( int? x, @@ -2352,7 +2262,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future scrollBy( int? x, @@ -2369,7 +2278,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future getScrollX() => (super.noSuchMethod( Invocation.method( @@ -2379,7 +2287,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(0), returnValueForMissingStub: _i9.Future.value(0), ) as _i9.Future); - @override _i9.Future getScrollY() => (super.noSuchMethod( Invocation.method( @@ -2389,7 +2296,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(0), returnValueForMissingStub: _i9.Future.value(0), ) as _i9.Future); - @override _i9.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -2411,7 +2317,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), )), ) as _i9.Future<_i4.Offset>); - @override _i9.Future setWebViewClient(_i2.WebViewClient? webViewClient) => (super.noSuchMethod( @@ -2422,7 +2327,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future addJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -2434,7 +2338,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future removeJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -2446,7 +2349,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setDownloadListener(_i2.DownloadListener? listener) => (super.noSuchMethod( @@ -2457,7 +2359,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setWebChromeClient(_i2.WebChromeClient? client) => (super.noSuchMethod( @@ -2468,7 +2369,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i9.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( @@ -2478,7 +2378,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i2.WebView copy() => (super.noSuchMethod( Invocation.method( @@ -2517,7 +2416,6 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i2.WebViewClient copy() => (super.noSuchMethod( Invocation.method( @@ -2554,7 +2452,6 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); - @override _i2.WebStorage copy() => (super.noSuchMethod( Invocation.method( @@ -2588,7 +2485,6 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { returnValue: (int __p0) {}, returnValueForMissingStub: (int __p0) {}, ) as void Function(int)); - @override set onWeakReferenceRemoved(void Function(int)? _onWeakReferenceRemoved) => super.noSuchMethod( @@ -2598,7 +2494,6 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ); - @override int addDartCreatedInstance(_i5.Copyable? instance) => (super.noSuchMethod( Invocation.method( @@ -2608,7 +2503,6 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { returnValue: 0, returnValueForMissingStub: 0, ) as int); - @override int? removeWeakReference(_i5.Copyable? instance) => (super.noSuchMethod( Invocation.method( @@ -2617,7 +2511,6 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ) as int?); - @override T? remove(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -2626,7 +2519,6 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ) as T?); - @override T? getInstanceWithWeakReference(int? identifier) => (super.noSuchMethod( @@ -2636,7 +2528,6 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ) as T?); - @override int? getIdentifier(_i5.Copyable? instance) => (super.noSuchMethod( Invocation.method( @@ -2645,7 +2536,6 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ) as int?); - @override void addHostCreatedInstance( _i5.Copyable? instance, @@ -2661,7 +2551,6 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { ), returnValueForMissingStub: null, ); - @override bool containsIdentifier(int? identifier) => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart index cb230b9cd54..8c96ec1ae75 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart @@ -93,7 +93,6 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future removeAllCookies() => (super.noSuchMethod( Invocation.method( @@ -102,7 +101,6 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { ), returnValue: _i5.Future.value(false), ) as _i5.Future); - @override _i5.Future setAcceptThirdPartyCookies( _i2.WebView? webView, @@ -119,7 +117,6 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i2.CookieManager copy() => (super.noSuchMethod( Invocation.method( @@ -150,7 +147,6 @@ class MockAndroidWebViewController extends _i1.Mock Invocation.getter(#webViewIdentifier), returnValue: 0, ) as int); - @override _i3.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod( Invocation.getter(#params), @@ -159,7 +155,6 @@ class MockAndroidWebViewController extends _i1.Mock Invocation.getter(#params), ), ) as _i3.PlatformWebViewControllerCreationParams); - @override _i5.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( Invocation.method( @@ -169,7 +164,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future loadFlutterAsset(String? key) => (super.noSuchMethod( Invocation.method( @@ -179,7 +173,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future loadHtmlString( String? html, { @@ -194,7 +187,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future loadRequest(_i3.LoadRequestParams? params) => (super.noSuchMethod( @@ -205,7 +197,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future currentUrl() => (super.noSuchMethod( Invocation.method( @@ -214,7 +205,6 @@ class MockAndroidWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -223,7 +213,6 @@ class MockAndroidWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); - @override _i5.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -232,7 +221,6 @@ class MockAndroidWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); - @override _i5.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -242,7 +230,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -252,7 +239,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future reload() => (super.noSuchMethod( Invocation.method( @@ -262,7 +248,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future clearCache() => (super.noSuchMethod( Invocation.method( @@ -272,7 +257,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future clearLocalStorage() => (super.noSuchMethod( Invocation.method( @@ -282,7 +266,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setPlatformNavigationDelegate( _i3.PlatformNavigationDelegate? handler) => @@ -294,7 +277,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future runJavaScript(String? javaScript) => (super.noSuchMethod( Invocation.method( @@ -304,7 +286,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( @@ -320,7 +301,6 @@ class MockAndroidWebViewController extends _i1.Mock ), )), ) as _i5.Future); - @override _i5.Future addJavaScriptChannel( _i3.JavaScriptChannelParams? javaScriptChannelParams) => @@ -332,7 +312,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( @@ -343,7 +322,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -352,7 +330,6 @@ class MockAndroidWebViewController extends _i1.Mock ), returnValue: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future scrollTo( int? x, @@ -369,7 +346,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future scrollBy( int? x, @@ -386,7 +362,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -401,7 +376,6 @@ class MockAndroidWebViewController extends _i1.Mock ), )), ) as _i5.Future<_i4.Offset>); - @override _i5.Future enableZoom(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -411,7 +385,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( @@ -421,7 +394,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setJavaScriptMode(_i3.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( @@ -432,7 +404,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setUserAgent(String? userAgent) => (super.noSuchMethod( Invocation.method( @@ -442,7 +413,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( @@ -453,7 +423,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setTextZoom(int? textZoom) => (super.noSuchMethod( Invocation.method( @@ -463,7 +432,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setOnShowFileSelector( _i5.Future> Function(_i6.FileSelectorParams)? @@ -476,7 +444,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setOnPlatformPermissionRequest( void Function(_i3.PlatformWebViewPermissionRequest)? @@ -489,7 +456,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setGeolocationPermissionsPromptCallbacks({ _i6.OnGeolocationPermissionsShowPrompt? onShowPrompt, @@ -507,7 +473,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setCustomWidgetCallbacks({ required _i6.OnShowCustomWidgetCallback? onShowCustomWidget, @@ -525,7 +490,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setOnConsoleMessage( void Function(_i3.JavaScriptConsoleMessage)? onConsoleMessage) => @@ -537,7 +501,6 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future getUserAgent() => (super.noSuchMethod( Invocation.method( 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 beb2b25b64a..be222bd7412 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 @@ -129,7 +129,6 @@ class MockCookieManagerHostApi extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setCookie( int? arg_identifier, @@ -148,7 +147,6 @@ class MockCookieManagerHostApi extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future removeAllCookies(int? arg_identifier) => (super.noSuchMethod( Invocation.method( @@ -157,7 +155,6 @@ class MockCookieManagerHostApi extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); - @override _i5.Future setAcceptThirdPartyCookies( int? arg_identifier, @@ -209,7 +206,6 @@ class MockDownloadListener extends _i1.Mock implements _i2.DownloadListener { String, int, )); - @override _i2.DownloadListener copy() => (super.noSuchMethod( Invocation.method( @@ -242,13 +238,11 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { Invocation.getter(#channelName), ), ) as String); - @override 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( @@ -282,7 +276,6 @@ class MockTestCookieManagerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setCookie( int? identifier, @@ -300,7 +293,6 @@ class MockTestCookieManagerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override _i5.Future removeAllCookies(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -309,7 +301,6 @@ class MockTestCookieManagerHostApi extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); - @override void setAcceptThirdPartyCookies( int? identifier, @@ -478,7 +469,6 @@ class MockTestWebChromeClientHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setSynchronousReturnValueForOnShowFileChooser( int? instanceId, @@ -494,7 +484,6 @@ class MockTestWebChromeClientHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setSynchronousReturnValueForOnConsoleMessage( int? instanceId, @@ -536,7 +525,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setDomStorageEnabled( int? instanceId, @@ -552,7 +540,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setJavaScriptCanOpenWindowsAutomatically( int? instanceId, @@ -568,7 +555,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setSupportMultipleWindows( int? instanceId, @@ -584,7 +570,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setJavaScriptEnabled( int? instanceId, @@ -600,7 +585,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setUserAgentString( int? instanceId, @@ -616,7 +600,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setMediaPlaybackRequiresUserGesture( int? instanceId, @@ -632,7 +615,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setSupportZoom( int? instanceId, @@ -648,7 +630,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setLoadWithOverviewMode( int? instanceId, @@ -664,7 +645,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setUseWideViewPort( int? instanceId, @@ -680,7 +660,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setDisplayZoomControls( int? instanceId, @@ -696,7 +675,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setBuiltInZoomControls( int? instanceId, @@ -712,7 +690,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setAllowFileAccess( int? instanceId, @@ -728,7 +705,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setTextZoom( int? instanceId, @@ -744,7 +720,6 @@ class MockTestWebSettingsHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override String getUserAgentString(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -778,7 +753,6 @@ class MockTestWebStorageHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void deleteAllData(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -806,7 +780,6 @@ class MockTestWebViewClientHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setSynchronousReturnValueForShouldOverrideUrlLoading( int? instanceId, @@ -841,7 +814,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void loadData( int? instanceId, @@ -861,7 +833,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void loadDataWithBaseUrl( int? instanceId, @@ -885,7 +856,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void loadUrl( int? instanceId, @@ -903,7 +873,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void postUrl( int? instanceId, @@ -921,13 +890,11 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override String? getUrl(int? instanceId) => (super.noSuchMethod(Invocation.method( #getUrl, [instanceId], )) as String?); - @override bool canGoBack(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -936,7 +903,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: false, ) as bool); - @override bool canGoForward(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -945,7 +911,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: false, ) as bool); - @override void goBack(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -954,7 +919,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void goForward(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -963,7 +927,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void reload(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -972,7 +935,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void clearCache( int? instanceId, @@ -988,7 +950,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override _i5.Future evaluateJavascript( int? instanceId, @@ -1004,13 +965,11 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: _i5.Future.value(), ) as _i5.Future); - @override String? getTitle(int? instanceId) => (super.noSuchMethod(Invocation.method( #getTitle, [instanceId], )) as String?); - @override void scrollTo( int? instanceId, @@ -1028,7 +987,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void scrollBy( int? instanceId, @@ -1046,7 +1004,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override int getScrollX(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -1055,7 +1012,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: 0, ) as int); - @override int getScrollY(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -1064,7 +1020,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValue: 0, ) as int); - @override _i3.WebViewPoint getScrollPosition(int? instanceId) => (super.noSuchMethod( Invocation.method( @@ -1079,7 +1034,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), ), ) as _i3.WebViewPoint); - @override void setWebContentsDebuggingEnabled(bool? enabled) => super.noSuchMethod( Invocation.method( @@ -1088,7 +1042,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setWebViewClient( int? instanceId, @@ -1104,7 +1057,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void addJavaScriptChannel( int? instanceId, @@ -1120,7 +1072,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void removeJavaScriptChannel( int? instanceId, @@ -1136,7 +1087,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setDownloadListener( int? instanceId, @@ -1152,7 +1102,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setWebChromeClient( int? instanceId, @@ -1168,7 +1117,6 @@ class MockTestWebViewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void setBackgroundColor( int? instanceId, @@ -1203,7 +1151,6 @@ class MockTestAssetManagerHostApi extends _i1.Mock ), returnValue: [], ) as List); - @override String getAssetFilePathByName(String? name) => (super.noSuchMethod( Invocation.method( @@ -1244,7 +1191,6 @@ class MockTestPermissionRequestHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void deny(int? instanceId) => super.noSuchMethod( Invocation.method( @@ -1273,7 +1219,6 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setSynchronousReturnValueForOnConsoleMessage(bool? value) => (super.noSuchMethod( @@ -1284,7 +1229,6 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i2.WebChromeClient copy() => (super.noSuchMethod( Invocation.method( @@ -1317,7 +1261,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { Invocation.getter(#settings), ), ) as _i2.WebSettings); - @override _i5.Future loadData({ required String? data, @@ -1337,7 +1280,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future loadDataWithBaseUrl({ String? baseUrl, @@ -1361,7 +1303,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future loadUrl( String? url, @@ -1378,7 +1319,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future postUrl( String? url, @@ -1395,7 +1335,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future getUrl() => (super.noSuchMethod( Invocation.method( @@ -1404,7 +1343,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -1413,7 +1351,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); - @override _i5.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -1422,7 +1359,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); - @override _i5.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -1432,7 +1368,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -1442,7 +1377,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future reload() => (super.noSuchMethod( Invocation.method( @@ -1452,7 +1386,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future clearCache(bool? includeDiskFiles) => (super.noSuchMethod( Invocation.method( @@ -1462,7 +1395,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future evaluateJavascript(String? javascriptString) => (super.noSuchMethod( @@ -1472,7 +1404,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -1481,7 +1412,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future scrollTo( int? x, @@ -1498,7 +1428,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future scrollBy( int? x, @@ -1515,7 +1444,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future getScrollX() => (super.noSuchMethod( Invocation.method( @@ -1524,7 +1452,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(0), ) as _i5.Future); - @override _i5.Future getScrollY() => (super.noSuchMethod( Invocation.method( @@ -1533,7 +1460,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(0), ) as _i5.Future); - @override _i5.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -1548,7 +1474,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), )), ) as _i5.Future<_i4.Offset>); - @override _i5.Future setWebViewClient(_i2.WebViewClient? webViewClient) => (super.noSuchMethod( @@ -1559,7 +1484,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future addJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -1571,7 +1495,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future removeJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -1583,7 +1506,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setDownloadListener(_i2.DownloadListener? listener) => (super.noSuchMethod( @@ -1594,7 +1516,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setWebChromeClient(_i2.WebChromeClient? client) => (super.noSuchMethod( @@ -1605,7 +1526,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( Invocation.method( @@ -1615,7 +1535,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i2.WebView copy() => (super.noSuchMethod( Invocation.method( @@ -1651,7 +1570,6 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i2.WebViewClient copy() => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart index d7b48967aa0..a10f530f2e3 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart @@ -55,7 +55,6 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); - @override _i3.Future removeAllCookies() => (super.noSuchMethod( Invocation.method( @@ -64,7 +63,6 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { ), returnValue: _i3.Future.value(false), ) as _i3.Future); - @override _i3.Future setAcceptThirdPartyCookies( _i2.WebView? webView, @@ -81,7 +79,6 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); - @override _i2.CookieManager copy() => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart index 87d871ee8c2..9cdf0fbcc92 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart @@ -139,7 +139,6 @@ class MockFlutterAssetManager extends _i1.Mock ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); - @override _i5.Future getAssetFilePathByName(String? name) => (super.noSuchMethod( @@ -174,7 +173,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setJavaScriptCanOpenWindowsAutomatically(bool? flag) => (super.noSuchMethod( @@ -185,7 +183,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setSupportMultipleWindows(bool? support) => (super.noSuchMethod( @@ -196,7 +193,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setJavaScriptEnabled(bool? flag) => (super.noSuchMethod( Invocation.method( @@ -206,7 +202,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setUserAgentString(String? userAgentString) => (super.noSuchMethod( @@ -217,7 +212,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( @@ -228,7 +222,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setSupportZoom(bool? support) => (super.noSuchMethod( Invocation.method( @@ -238,7 +231,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setLoadWithOverviewMode(bool? overview) => (super.noSuchMethod( @@ -249,7 +241,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setUseWideViewPort(bool? use) => (super.noSuchMethod( Invocation.method( @@ -259,7 +250,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setDisplayZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -269,7 +259,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setBuiltInZoomControls(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -279,7 +268,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setAllowFileAccess(bool? enabled) => (super.noSuchMethod( Invocation.method( @@ -289,7 +277,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setTextZoom(int? textZoom) => (super.noSuchMethod( Invocation.method( @@ -299,7 +286,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future getUserAgentString() => (super.noSuchMethod( Invocation.method( @@ -314,7 +300,6 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { ), )), ) as _i5.Future); - @override _i2.WebSettings copy() => (super.noSuchMethod( Invocation.method( @@ -348,7 +333,6 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i2.WebStorage copy() => (super.noSuchMethod( Invocation.method( @@ -381,7 +365,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { Invocation.getter(#settings), ), ) as _i2.WebSettings); - @override _i5.Future loadData({ required String? data, @@ -401,7 +384,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future loadDataWithBaseUrl({ String? baseUrl, @@ -425,7 +407,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future loadUrl( String? url, @@ -442,7 +423,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future postUrl( String? url, @@ -459,7 +439,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future getUrl() => (super.noSuchMethod( Invocation.method( @@ -468,7 +447,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future canGoBack() => (super.noSuchMethod( Invocation.method( @@ -477,7 +455,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); - @override _i5.Future canGoForward() => (super.noSuchMethod( Invocation.method( @@ -486,7 +463,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(false), ) as _i5.Future); - @override _i5.Future goBack() => (super.noSuchMethod( Invocation.method( @@ -496,7 +472,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future goForward() => (super.noSuchMethod( Invocation.method( @@ -506,7 +481,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future reload() => (super.noSuchMethod( Invocation.method( @@ -516,7 +490,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future clearCache(bool? includeDiskFiles) => (super.noSuchMethod( Invocation.method( @@ -526,7 +499,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future evaluateJavascript(String? javascriptString) => (super.noSuchMethod( @@ -536,7 +508,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future getTitle() => (super.noSuchMethod( Invocation.method( @@ -545,7 +516,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future scrollTo( int? x, @@ -562,7 +532,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future scrollBy( int? x, @@ -579,7 +548,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future getScrollX() => (super.noSuchMethod( Invocation.method( @@ -588,7 +556,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(0), ) as _i5.Future); - @override _i5.Future getScrollY() => (super.noSuchMethod( Invocation.method( @@ -597,7 +564,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), returnValue: _i5.Future.value(0), ) as _i5.Future); - @override _i5.Future<_i3.Offset> getScrollPosition() => (super.noSuchMethod( Invocation.method( @@ -612,7 +578,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), )), ) as _i5.Future<_i3.Offset>); - @override _i5.Future setWebViewClient(_i2.WebViewClient? webViewClient) => (super.noSuchMethod( @@ -623,7 +588,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future addJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -635,7 +599,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future removeJavaScriptChannel( _i2.JavaScriptChannel? javaScriptChannel) => @@ -647,7 +610,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setDownloadListener(_i2.DownloadListener? listener) => (super.noSuchMethod( @@ -658,7 +620,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setWebChromeClient(_i2.WebChromeClient? client) => (super.noSuchMethod( @@ -669,7 +630,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setBackgroundColor(_i3.Color? color) => (super.noSuchMethod( Invocation.method( @@ -679,7 +639,6 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i2.WebView copy() => (super.noSuchMethod( Invocation.method( @@ -713,19 +672,16 @@ class MockWebResourceRequest extends _i1.Mock Invocation.getter(#url), ), ) as String); - @override 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); - @override String get method => (super.noSuchMethod( Invocation.getter(#method), @@ -734,7 +690,6 @@ class MockWebResourceRequest extends _i1.Mock Invocation.getter(#method), ), ) as String); - @override Map get requestHeaders => (super.noSuchMethod( Invocation.getter(#requestHeaders), @@ -773,7 +728,6 @@ class MockDownloadListener extends _i1.Mock implements _i2.DownloadListener { String, int, )); - @override _i2.DownloadListener copy() => (super.noSuchMethod( Invocation.method( @@ -808,7 +762,6 @@ class MockWebViewAndroidJavaScriptChannel extends _i1.Mock Invocation.getter(#javascriptChannelRegistry), ), ) as _i4.JavascriptChannelRegistry); - @override String get channelName => (super.noSuchMethod( Invocation.getter(#channelName), @@ -817,13 +770,11 @@ class MockWebViewAndroidJavaScriptChannel extends _i1.Mock Invocation.getter(#channelName), ), ) as String); - @override 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( @@ -858,7 +809,6 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i5.Future setSynchronousReturnValueForOnConsoleMessage(bool? value) => (super.noSuchMethod( @@ -869,7 +819,6 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i2.WebChromeClient copy() => (super.noSuchMethod( Invocation.method( @@ -905,7 +854,6 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); - @override _i2.WebViewClient copy() => (super.noSuchMethod( Invocation.method( @@ -936,7 +884,6 @@ class MockJavascriptChannelRegistry extends _i1.Mock Invocation.getter(#channels), returnValue: {}, ) as Map); - @override void onJavascriptChannelMessage( String? channel, @@ -952,7 +899,6 @@ class MockJavascriptChannelRegistry extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void updateJavascriptChannelsFromSet(Set<_i4.JavascriptChannel>? channels) => super.noSuchMethod( @@ -989,7 +935,6 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.FutureOr); - @override void onPageStarted(String? url) => super.noSuchMethod( Invocation.method( @@ -998,7 +943,6 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void onPageFinished(String? url) => super.noSuchMethod( Invocation.method( @@ -1007,7 +951,6 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void onProgress(int? progress) => super.noSuchMethod( Invocation.method( @@ -1016,7 +959,6 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock ), returnValueForMissingStub: null, ); - @override void onWebResourceError(_i4.WebResourceError? error) => super.noSuchMethod( Invocation.method( @@ -1049,7 +991,6 @@ class MockWebViewProxy extends _i1.Mock implements _i8.WebViewProxy { ), ), ) as _i2.WebView); - @override _i2.WebViewClient createWebViewClient({ void Function( @@ -1109,7 +1050,6 @@ class MockWebViewProxy extends _i1.Mock implements _i8.WebViewProxy { ), ), ) as _i2.WebViewClient); - @override _i5.Future setWebContentsDebuggingEnabled(bool? enabled) => (super.noSuchMethod( diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index 9644887711d..da34fcffa9c 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -1912,3 +1912,104 @@ abstract class TestGeolocationPermissionsCallbackHostApi { } } } + +/// Host API for `HttpAuthHandler`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/HttpAuthHandler. +abstract class TestHttpAuthHandlerHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `HttpAuthHandler.useHttpAuthUsernamePassword`. + bool useHttpAuthUsernamePassword(int instanceId); + + /// Handles Dart method `HttpAuthHandler.cancel`. + void cancel(int instanceId); + + /// Handles Dart method `HttpAuthHandler.proceed`. + void proceed(int instanceId, String username, String password); + + static void setup(TestHttpAuthHandlerHostApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.useHttpAuthUsernamePassword was null, expected non-null int.'); + final bool output = api.useHttpAuthUsernamePassword(arg_instanceId!); + return [output]; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.cancel was null, expected non-null int.'); + api.cancel(arg_instanceId!); + return []; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed', + codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed was null, expected non-null int.'); + final String? arg_username = (args[1] as String?); + assert(arg_username != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed was null, expected non-null String.'); + final String? arg_password = (args[2] as String?); + assert(arg_password != null, + 'Argument for dev.flutter.pigeon.webview_flutter_android.HttpAuthHandlerHostApi.proceed was null, expected non-null String.'); + api.proceed(arg_instanceId!, arg_username!, arg_password!); + return []; + }); + } + } + } +}