Title: [287278] trunk/Tools
Revision
287278
Author
[email protected]
Date
2021-12-20 14:11:53 -0800 (Mon, 20 Dec 2021)

Log Message

[WebAuthn] Add option to change requestWebAuthenticationNoGesture delegate for api tests.
https://bugs.webkit.org/show_bug.cgi?id=234444
rdar://86644642

Reviewed by Brent Fulgham.

These test a lack of user gesture in local authenticator. Recently we made a change to
change user gesture behavior, causing these tests to call out to an agent that cannot be called
from TWAPI. To restore test behavior, we add an option to change the return value of the
requestWebAuthenticationNoGesture delegate in tests.

* TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
(-[TestWebAuthenticationPanelUIDelegate _webView:requestWebAuthenticationNoGestureForOrigin:completionHandler:]):
(TestWebKitAPI::WebCore::reset):
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (287277 => 287278)


--- trunk/Tools/ChangeLog	2021-12-20 22:09:35 UTC (rev 287277)
+++ trunk/Tools/ChangeLog	2021-12-20 22:11:53 UTC (rev 287278)
@@ -1,5 +1,23 @@
 2021-12-20  J Pascoe  <[email protected]>
 
+        [WebAuthn] Add option to change requestWebAuthenticationNoGesture delegate for api tests.
+        https://bugs.webkit.org/show_bug.cgi?id=234444
+        rdar://86644642
+
+        Reviewed by Brent Fulgham.
+
+        These test a lack of user gesture in local authenticator. Recently we made a change to
+        change user gesture behavior, causing these tests to call out to an agent that cannot be called
+        from TWAPI. To restore test behavior, we add an option to change the return value of the
+        requestWebAuthenticationNoGesture delegate in tests.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm:
+        (-[TestWebAuthenticationPanelUIDelegate _webView:requestWebAuthenticationNoGestureForOrigin:completionHandler:]):
+        (TestWebKitAPI::WebCore::reset):
+        (TestWebKitAPI::TEST):
+
+2021-12-20  J Pascoe  <[email protected]>
+
         [WebAuthn] Only run WebAuthn test process on platform it is used
         https://bugs.webkit.org/show_bug.cgi?id=234445
         rdar://86646638

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm (287277 => 287278)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2021-12-20 22:09:35 UTC (rev 287277)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/_WKWebAuthenticationPanel.mm	2021-12-20 22:11:53 UTC (rev 287278)
@@ -72,6 +72,7 @@
 static bool webAuthenticationPanelUpdateLAExcludeCredentialsMatched = false;
 static bool webAuthenticationPanelUpdateLANoCredential = false;
 static bool webAuthenticationPanelCancelImmediately = false;
+static bool webAuthenticationPanelRequestNoGesture = true;
 static _WKLocalAuthenticatorPolicy localAuthenticatorPolicy = _WKLocalAuthenticatorPolicyDisallow;
 static String webAuthenticationPanelPin;
 static BOOL webAuthenticationPanelNullUserHandle = NO;
@@ -233,7 +234,7 @@
 
 - (void)_webView:(WKWebView *)webView requestWebAuthenticationNoGestureForOrigin:(WKSecurityOrigin *)orgin completionHandler:(void (^)(BOOL))completionHandler
 {
-    completionHandler(true);
+    completionHandler(webAuthenticationPanelRequestNoGesture);
 }
 
 - (void)_webView:(WKWebView *)webView runWebAuthenticationPanel:(_WKWebAuthenticationPanel *)panel initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(_WKWebAuthenticationPanelResult))completionHandler
@@ -342,6 +343,7 @@
     webAuthenticationPanelUpdateLAExcludeCredentialsMatched = false;
     webAuthenticationPanelUpdateLANoCredential = false;
     webAuthenticationPanelCancelImmediately = false;
+    webAuthenticationPanelRequestNoGesture = true;
     webAuthenticationPanelPin = emptyString();
     webAuthenticationPanelNullUserHandle = NO;
     localAuthenticatorPolicy = _WKLocalAuthenticatorPolicyDisallow;
@@ -1493,6 +1495,7 @@
 TEST(WebAuthenticationPanel, LAMakeCredentialNoMockNoUserGesture)
 {
     reset();
+    webAuthenticationPanelRequestNoGesture = false;
     RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"web-authentication-make-credential-la-no-mock" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
 
     auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
@@ -1562,6 +1565,7 @@
 TEST(WebAuthenticationPanel, LAGetAssertionNoMockNoUserGesture)
 {
     reset();
+    webAuthenticationPanelRequestNoGesture = false;
     RetainPtr<NSURL> testURL = [[NSBundle mainBundle] URLForResource:@"web-authentication-get-assertion-la-no-mock" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
 
     auto *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to