Skip to content

Commit 3bbe18f

Browse files
committed
Merge branch 'origin/webview_flutter_android_set-Web-Authentication-Support'
2 parents cec9e37 + ec16928 commit 3bbe18f

2 files changed

Lines changed: 119 additions & 0 deletions

File tree

packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7707,6 +7707,7 @@ class WebSettingsCompat extends PigeonInternalProxyApiBaseClass {
77077707
pigeonVar_replyList,
77087708
pigeonVar_channelName,
77097709
isNullValid: true,
7710+
<<<<<<< HEAD
77107711
);
77117712
}
77127713

@@ -7770,7 +7771,36 @@ class WebSettingsCompat extends PigeonInternalProxyApiBaseClass {
77707771
);
77717772
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
77727773
<Object?>[webSettings, support],
7774+
=======
7775+
>>>>>>> ec16928ee65093710a5fb4ef59ff9686f2eadd3a
77737776
);
7777+
}
7778+
7779+
static Future<void> setWebAuthenticationSupport(
7780+
WebSettings webSettings,
7781+
int support, {
7782+
BinaryMessenger? pigeon_binaryMessenger,
7783+
PigeonInstanceManager? pigeon_instanceManager,
7784+
}) async {
7785+
if (PigeonOverrides.webSettingsCompat_setWebAuthenticationSupport != null) {
7786+
return PigeonOverrides.webSettingsCompat_setWebAuthenticationSupport!(
7787+
webSettings,
7788+
support,
7789+
);
7790+
}
7791+
final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec =
7792+
_PigeonInternalProxyApiBaseCodec(
7793+
pigeon_instanceManager ?? PigeonInstanceManager.instance);
7794+
final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger;
7795+
const pigeonVar_channelName =
7796+
'dev.flutter.pigeon.webview_flutter_android.WebSettingsCompat.setWebAuthenticationSupport';
7797+
final pigeonVar_channel = BasicMessageChannel<Object?>(
7798+
pigeonVar_channelName,
7799+
pigeonChannelCodec,
7800+
binaryMessenger: pigeonVar_binaryMessenger,
7801+
);
7802+
final Future<Object?> pigeonVar_sendFuture =
7803+
pigeonVar_channel.send(<Object?>[webSettings, support]);
77747804
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
77757805

77767806
_extractReplyValueOrThrow(

packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)