@@ -1980,6 +1980,95 @@ void main() {
19801980 );
19811981 });
19821982
1983+ test ('setInsetsForWebContentToIgnore' , () async {
1984+ final mockWebView = MockWebView ();
1985+ final mockSettings = MockWebSettings ();
1986+ final AndroidWebViewController controller = createControllerWithMocks (
1987+ mockWebView: mockWebView,
1988+ mockSettings: mockSettings,
1989+ setWebAuthenticationSupport:
1990+ (android_webview.WebSettings settings, int support) async {
1991+ capturedSettings = settings;
1992+ capturedSupport = support;
1993+ },
1994+ );
1995+
1996+ await controller.setWebAuthenticationSupport (
1997+ WebAuthenticationSupport .forApp,
1998+ );
1999+
2000+ expect (mockSettings, capturedSettings);
2001+ expect (WebAuthenticationSupport .forApp.value, capturedSupport);
2002+ });
2003+
2004+ test ('setWebAuthenticationSupport with forBrowser' , () async {
2005+ android_webview.WebSettings ? capturedSettings;
2006+ int ? capturedSupport;
2007+
2008+ final mockWebView = MockWebView ();
2009+ final mockSettings = MockWebSettings ();
2010+ final AndroidWebViewController controller = createControllerWithMocks (
2011+ mockWebView: mockWebView,
2012+ mockSettings: mockSettings,
2013+ setWebAuthenticationSupport:
2014+ (android_webview.WebSettings settings, int support) async {
2015+ capturedSettings = settings;
2016+ capturedSupport = support;
2017+ },
2018+ );
2019+
2020+ await controller.setWebAuthenticationSupport (
2021+ WebAuthenticationSupport .forBrowser,
2022+ );
2023+
2024+ expect (mockSettings, capturedSettings);
2025+ expect (WebAuthenticationSupport .forBrowser.value, capturedSupport);
2026+ });
2027+
2028+ test ('setWebAuthenticationSupport with none' , () async {
2029+ android_webview.WebSettings ? capturedSettings;
2030+ int ? capturedSupport;
2031+
2032+ final mockWebView = MockWebView ();
2033+ final mockSettings = MockWebSettings ();
2034+ final AndroidWebViewController controller = createControllerWithMocks (
2035+ mockWebView: mockWebView,
2036+ mockSettings: mockSettings,
2037+ setWebAuthenticationSupport:
2038+ (android_webview.WebSettings settings, int support) async {
2039+ capturedSettings = settings;
2040+ capturedSupport = support;
2041+ },
2042+ );
2043+
2044+ await controller.setWebAuthenticationSupport (WebAuthenticationSupport .none);
2045+
2046+ expect (mockSettings, capturedSettings);
2047+ expect (WebAuthenticationSupport .none.value, capturedSupport);
2048+ });
2049+
2050+ test ('setWebAuthenticationSupport propagates unsupported errors' , () async {
2051+ final expectedError = UnsupportedError (
2052+ 'WEB_AUTHENTICATION is not supported' ,
2053+ );
2054+
2055+ final mockWebView = MockWebView ();
2056+ final mockSettings = MockWebSettings ();
2057+ final AndroidWebViewController controller = createControllerWithMocks (
2058+ mockWebView: mockWebView,
2059+ mockSettings: mockSettings,
2060+ setWebAuthenticationSupport:
2061+ (android_webview.WebSettings settings, int support) async {
2062+ throw expectedError;
2063+ },
2064+ );
2065+
2066+ await expectLater (
2067+ controller.setWebAuthenticationSupport (WebAuthenticationSupport .forApp),
2068+ throwsA (same (expectedError)),
2069+ );
2070+ });
2071+
19832072 test ('setWebAuthenticationSupport with forApp' , () async {
19842073 android_webview.WebSettings ? capturedSettings;
19852074 int ? capturedSupport;
0 commit comments