Currently, tests of WebAuthN spread in three places: 1) LayoutTests/http/tests/webauthn/ 2) LayoutTests/http/tests/wpt/webauthn/ 3) TestWebKitAPI/Tests/ios/LocalAuthenticator.mm It will be great to have them all in LayoutTests/http/tests/wpt/webauthn/. This could be achieved by: 1) making tests under LayoutTests/http/tests/webauthn/ become wpt async tests. 2) mocking transport layer abstraction, says HIDService, and providing necessary test configuration functions in testRunner.idl such that layout tests could then directly manipulate the most underlying layer of WebAuthN to have test behaviors/results they expected.
<rdar://problem/44117828>
Created attachment 351016 [details] Patch
Created attachment 351019 [details] Patch
Comment on attachment 351019 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=351019&action=review r=me > Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp:582 > + MockWebAuthenticationConfiguration::Local local; Any reason we are using a local variable instead of assigning straight into configuration.local? > Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:77 > + if (!configuration.local.value().acceptAuthentication) { Cannot we use onfiguration.local->acceptAuthentication ? > Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:90 > + if (!configuration.local.value().acceptAuthentication) { ditto. > Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:105 > + if (!configuration.local.value().acceptAttestation) { ditto. > Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:118 > + (__bridge CFDataRef)adoptNS([[NSData alloc] initWithBase64EncodedString:configuration.local.value().privateKeyBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters]).get(), ditto. > Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp:45 > + if (!m_configuration.local) return !!m_configuration.local; ?
Comment on attachment 351019 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=351019&action=review Thanks Chris for r+ my patch. >> Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp:582 >> + MockWebAuthenticationConfiguration::Local local; > > Any reason we are using a local variable instead of assigning straight into configuration.local? configuration.local is a std::optional. How? >> Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:77 >> + if (!configuration.local.value().acceptAuthentication) { > > Cannot we use onfiguration.local->acceptAuthentication ? Sure. >> Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:90 >> + if (!configuration.local.value().acceptAuthentication) { > > ditto. Fixed. >> Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:105 >> + if (!configuration.local.value().acceptAttestation) { > > ditto. Fixed. >> Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:118 >> + (__bridge CFDataRef)adoptNS([[NSData alloc] initWithBase64EncodedString:configuration.local.value().privateKeyBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters]).get(), > > ditto. Fixed. >> Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp:45 >> + if (!m_configuration.local) > > return !!m_configuration.local; ? I don't think so.
Comment on attachment 351019 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=351019&action=review >>> Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp:582 >>> + MockWebAuthenticationConfiguration::Local local; >> >> Any reason we are using a local variable instead of assigning straight into configuration.local? > > configuration.local is a std::optional. How? Ah, I missed that it was an optional. Please disregard this comment. >>> Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp:45 >>> + if (!m_configuration.local) >> >> return !!m_configuration.local; ? > > I don't think so. Why not? :)
Created attachment 351134 [details] Patch for landing
Comment on attachment 351019 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=351019&action=review >>>> Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp:45 >>>> + if (!m_configuration.local) >>> >>> return !!m_configuration.local; ? >> >> I don't think so. > > Why not? :) I was thinking you suggested me to replace !m_configuration.local with !!m_configuration.local. lol. Yup. Why not.
Created attachment 351137 [details] Patch for landing
Comment on attachment 351137 [details] Patch for landing Clearing flags on attachment: 351137 Committed r236625: <https://trac.webkit.org/changeset/236625>