[WebAuthn] Move the mock testing entrance to Internals
https://bugs.webkit.org/show_bug.cgi?id=202560
<rdar://problem/55973793>

Reviewed by Chris Dumez.

Source/WebCore:

This patch moves TestRunner.setWebAuthenticationMockConfiguration to
Internals.setMockWebAuthenticationConfiguration and removes the old
entrance. The purpose of this patch is to allow API tests to use
the same mock infrastructure that is used by layout tests.

No new tests, covered by updates on existing tests.

* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webauthn/PublicKeyCredentialCreationOptions.h:
* WebCore.xcodeproj/project.pbxproj:
* page/ChromeClient.h:
(WebCore::ChromeClient::setMockWebAuthenticationConfiguration):
* testing/Internals.cpp:
(WebCore::Internals::setMockWebAuthenticationConfiguration):
* testing/Internals.h:
* testing/Internals.idl:
* testing/MockWebAuthenticationConfiguration.h: Added.
(WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const):
(WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode):
(WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const):
(WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode):
(WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const):
(WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode):
(WebCore::MockWebAuthenticationConfiguration::encode const):
(WebCore::MockWebAuthenticationConfiguration::decode):
* testing/MockWebAuthenticationConfiguration.idl: Added.

Source/WebKit:

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted.
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
(WebKit::AuthenticatorTransportService::createMock):
* UIProcess/WebAuthentication/AuthenticatorTransportService.h:
* UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
(WebKit::MockAuthenticatorManager::MockAuthenticatorManager):
* UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::send):
(WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
(WebKit::MockHidConnection::parseRequest):
(WebKit::MockHidConnection::feedReports):
(WebKit::MockHidConnection::shouldContinueFeedReports):
* UIProcess/WebAuthentication/Mock/MockHidConnection.h:
* UIProcess/WebAuthentication/Mock/MockHidService.cpp:
(WebKit::MockHidService::MockHidService):
* UIProcess/WebAuthentication/Mock/MockHidService.h:
* UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
* UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
(WebKit::MockLocalConnection::MockLocalConnection):
* UIProcess/WebAuthentication/Mock/MockLocalService.h:
* UIProcess/WebAuthentication/Mock/MockLocalService.mm:
(WebKit::MockLocalService::MockLocalService):
* UIProcess/WebAuthentication/Mock/MockNfcService.h:
* UIProcess/WebAuthentication/Mock/MockNfcService.mm:
(WebKit::MockNfcService::MockNfcService):
(WebKit::MockNfcService::platformStartDiscovery):
(WebKit::MockNfcService::detectTags const):
* UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setMockWebAuthenticationConfiguration):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebsiteData/WebsiteDataStore.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::setMockWebAuthenticationConfiguration):
* WebProcess/WebCoreSupport/WebChromeClient.h:

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setWebAuthenticationMockConfiguration): Deleted.
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::setWebAuthenticationMockConfiguration): Deleted.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* http/wpt/webauthn/ctap-hid-failure.https.html:
* http/wpt/webauthn/ctap-hid-success.https.html:
* http/wpt/webauthn/ctap-nfc-failure.https.html:
* http/wpt/webauthn/idl.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-hid.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-local.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html:
* http/wpt/webauthn/public-key-credential-create-failure.https.html:
* http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
* http/wpt/webauthn/public-key-credential-create-success-local.https.html:
* http/wpt/webauthn/public-key-credential-create-success-nfc.https.html:
* http/wpt/webauthn/public-key-credential-create-success-u2f.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-hid.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-local.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html:
* http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html:
* http/wpt/webauthn/public-key-credential-get-failure.https.html:
* http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
* http/wpt/webauthn/public-key-credential-get-success-local.https.html:
* http/wpt/webauthn/public-key-credential-get-success-nfc.https.html:
* http/wpt/webauthn/public-key-credential-get-success-u2f.https.html:
* http/wpt/webauthn/resources/public-key-credential-ip-address.https.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@250940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 5274a53..d4fafe4 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,41 @@
+2019-10-09  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebAuthn] Move the mock testing entrance to Internals
+        https://bugs.webkit.org/show_bug.cgi?id=202560
+        <rdar://problem/55973793>
+
+        Reviewed by Chris Dumez.
+
+        * http/wpt/webauthn/ctap-hid-failure.https.html:
+        * http/wpt/webauthn/ctap-hid-success.https.html:
+        * http/wpt/webauthn/ctap-nfc-failure.https.html:
+        * http/wpt/webauthn/idl.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-hid.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-local.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success-local.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success-nfc.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success-u2f.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-hid.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-local.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure.https.html:
+        * http/wpt/webauthn/public-key-credential-get-success-hid.https.html:
+        * http/wpt/webauthn/public-key-credential-get-success-local.https.html:
+        * http/wpt/webauthn/public-key-credential-get-success-nfc.https.html:
+        * http/wpt/webauthn/public-key-credential-get-success-u2f.https.html:
+        * http/wpt/webauthn/resources/public-key-credential-ip-address.https.html:
+
 2019-10-09  Dean Jackson  <dino@apple.com>
 
         Layout test fast/events/touch/ios/passive-by-default-overridden-on-document-and-window.html is a flaky failure on Internal iOS testers
diff --git a/LayoutTests/http/wpt/credential-management/credentialscontainer-store-basics.https.html b/LayoutTests/http/wpt/credential-management/credentialscontainer-store-basics.https.html
index bc02119..1a1959e 100644
--- a/LayoutTests/http/wpt/credential-management/credentialscontainer-store-basics.https.html
+++ b/LayoutTests/http/wpt/credential-management/credentialscontainer-store-basics.https.html
@@ -42,8 +42,8 @@
             }
         };
         // A mock attestation object
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } });
         const credential = await navigator.credentials.create(options);
 
         return promise_rejects(t, "NotSupportedError", navigator.credentials.store(credential));
diff --git a/LayoutTests/http/wpt/webauthn/ctap-hid-failure.https.html b/LayoutTests/http/wpt/webauthn/ctap-hid-failure.https.html
index 4f0fd6a..9d53e1d 100644
--- a/LayoutTests/http/wpt/webauthn/ctap-hid-failure.https.html
+++ b/LayoutTests/http/wpt/webauthn/ctap-hid-failure.https.html
@@ -21,50 +21,50 @@
     };
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "data-not-sent" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "data-not-sent" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out.");
     }, "CTAP HID with init sub stage data not sent error in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "empty-report" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "empty-report" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out.");
     }, "CTAP HID with init sub stage empty report error in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-channel-id" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-channel-id" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out.");
     }, "CTAP HID with init sub stage wrong channel id error in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-nonce" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-nonce" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out.");
     }, "CTAP HID with init sub stage wrong nonce error in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "msg", error: "data-not-sent" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "msg", error: "data-not-sent" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out.");
     }, "CTAP HID with msg sub stage data not sent error in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "msg", error: "empty-report" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "msg", error: "empty-report" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out.");
     }, "CTAP HID with msg sub stage empty report error in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "msg", error: "wrong-channel-id" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "msg", error: "wrong-channel-id" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out.");
     }, "CTAP HID with msg sub stage wrong channel id error in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "wrong-channel-id", payloadBase64:[testDummyMessagePayloadBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "wrong-channel-id", payloadBase64:[testDummyMessagePayloadBase64] } });
         return promiseRejects(t, "UnknownError", navigator.credentials.create(defaultOptions), "Unknown internal error. Error code: 18");
     }, "CTAP HID with request::msg stage wrong channel id error in a mock hid authenticator.");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/ctap-hid-success.https.html b/LayoutTests/http/wpt/webauthn/ctap-hid-success.https.html
index 8e5d095..b6f91f8 100644
--- a/LayoutTests/http/wpt/webauthn/ctap-hid-success.https.html
+++ b/LayoutTests/http/wpt/webauthn/ctap-hid-success.https.html
@@ -20,8 +20,8 @@
     };
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64], keepAlive: true } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64], keepAlive: true } });
         return navigator.credentials.create(defaultOptions).then(credential => {
             assert_not_equals(credential, undefined);
             assert_not_equals(credential, null);
@@ -29,8 +29,8 @@
     }, "CTAP HID with keep alive message in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64], fastDataArrival: true } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64], fastDataArrival: true } });
         return navigator.credentials.create(defaultOptions).then(credential => {
             assert_not_equals(credential, undefined);
             assert_not_equals(credential, null);
@@ -38,8 +38,8 @@
     }, "CTAP HID with fast data arrival in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "empty-report", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "empty-report", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } });
         return navigator.credentials.create(defaultOptions).then(credential => {
             assert_not_equals(credential, undefined);
             assert_not_equals(credential, null);
@@ -47,8 +47,8 @@
     }, "CTAP HID with continue after empty report in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-channel-id", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-channel-id", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } });
         return navigator.credentials.create(defaultOptions).then(credential => {
             assert_not_equals(credential, undefined);
             assert_not_equals(credential, null);
@@ -56,8 +56,8 @@
     }, "CTAP HID with continue after wrong channel id in a mock hid authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-nonce", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "info", subStage: "init", error: "wrong-nonce", payloadBase64: [testCreationMessageBase64], continueAfterErrorData: true } });
         return navigator.credentials.create(defaultOptions).then(credential => {
             assert_not_equals(credential, undefined);
             assert_not_equals(credential, null);
diff --git a/LayoutTests/http/wpt/webauthn/ctap-nfc-failure.https.html b/LayoutTests/http/wpt/webauthn/ctap-nfc-failure.https.html
index 5c0b1b8..205060a 100644
--- a/LayoutTests/http/wpt/webauthn/ctap-nfc-failure.https.html
+++ b/LayoutTests/http/wpt/webauthn/ctap-nfc-failure.https.html
@@ -21,14 +21,14 @@
     };
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testNfcU2fVersionBase64, ""] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testNfcU2fVersionBase64, ""] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out.");
     }, "CTAP NFC with empty apdu response in a mock nfc authenticator.");
 
     promise_test(function(t) {
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testNfcU2fVersionBase64, testU2fApduWrongDataOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testNfcU2fVersionBase64, testU2fApduWrongDataOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(defaultOptions), "Operation timed out.");
     }, "CTAP NFC with wrong data error in a mock nfc authenticator.");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/idl.https.html b/LayoutTests/http/wpt/webauthn/idl.https.html
index dc12b72..09afcb0 100644
--- a/LayoutTests/http/wpt/webauthn/idl.https.html
+++ b/LayoutTests/http/wpt/webauthn/idl.https.html
@@ -52,8 +52,8 @@
         }
     };
     // A mock attestation object
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } });
     createdCredential = await navigator.credentials.create(creationOptions);
 
     const requestOptions = {
@@ -61,8 +61,8 @@
             challenge: Base64URL.parse("MTIzNDU2"),
         }
     };
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64] } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64] } });
     requestedCredential = await navigator.credentials.get(requestOptions);
 
     idlArray.add_objects({"PublicKeyCredential": ["createdCredential"], "AuthenticatorAttestationResponse": ["createdCredential.response"], "AuthenticatorAssertionResponse": ["requestedCredential.response"]});
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html
index 66b5da4..f35866a 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid-silent.https.html
@@ -21,8 +21,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with malicious payload in a mock hid authenticator.");
 
@@ -44,8 +44,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with unsupported options in a mock hid authenticator.");
 
@@ -67,8 +67,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with unsupported options in a mock hid authenticator. 2");
 
@@ -90,8 +90,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with mixed options in a mock hid authenticator.");
 
@@ -111,8 +111,8 @@
            }
        };
 
-       if (window.testRunner)
-           testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrCredentialExcludedOnlyResponseBase64] } });
+       if (window.internals)
+           internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrCredentialExcludedOnlyResponseBase64] } });
        return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator.");
    }, "PublicKeyCredential's [[create]] with InvalidStateError in a mock hid authenticator.");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid.https.html
index 2f837c6..10cfead 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-hid.https.html
@@ -5,8 +5,8 @@
 <script src="./resources/util.js"></script>
 <script>
     // Default mock configuration. Tests need to override it if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload" } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload" } });
 
     promise_test(function(t) {
         const options = {
@@ -45,8 +45,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });
         return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 255");
     }, "PublicKeyCredential's [[create]] with malicious payload in a mock hid authenticator.");
 
@@ -67,8 +67,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
         return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 43");
     }, "PublicKeyCredential's [[create]] with unsupported options in a mock hid authenticator.");
 
@@ -89,8 +89,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
         return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 43");
     }, "PublicKeyCredential's [[create]] with unsupported options in a mock hid authenticator. 2");
 
@@ -112,8 +112,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with mixed options in a mock hid authenticator.");
 
@@ -134,8 +134,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
         return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 43");
     }, "PublicKeyCredential's [[create]] with mixed options in a mock hid authenticator. 2");
 
@@ -155,8 +155,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrCredentialExcludedOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrCredentialExcludedOnlyResponseBase64] } });
         return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator.");
     }, "PublicKeyCredential's [[create]] with InvalidStateError in a mock hid authenticator.");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html
index 6a00bed..4dcf4a2 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local-silent.https.html
@@ -9,8 +9,8 @@
         const privateKeyBase64 = await generatePrivateKeyBase64();
         const credentialID = await calculateCredentialID(privateKeyBase64);
         // Default mock configuration. Tests need to override if they need different configuration.
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, local: { acceptAuthentication: false, acceptAttestation: false } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, local: { acceptAuthentication: false, acceptAttestation: false } });
 
         promise_test(t => {
             const options = {
@@ -121,8 +121,8 @@
                     timeout: 10
                 }
             };
-            if (window.testRunner)
-                testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, local: { acceptAuthentication: true, acceptAttestation: false } });
+            if (window.internals)
+                internals.setMockWebAuthenticationConfiguration({ silentFailure: true, local: { acceptAuthentication: true, acceptAttestation: false } });
             return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
         }, "PublicKeyCredential's [[create]] with silent failure in a mock local authenticator. 5");
 
@@ -142,8 +142,8 @@
                     timeout: 10
                 }
             };
-            if (window.testRunner) {
-                testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, local: { acceptAuthentication: true, acceptAttestation: false } });
+            if (window.internals) {
+                internals.setMockWebAuthenticationConfiguration({ silentFailure: true, local: { acceptAuthentication: true, acceptAttestation: false } });
                 testRunner.addTestKeyToKeychain(privateKeyBase64, testRpId, userhandleBase64);
             }
             return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.").then(() => {
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html
index c3c9372..39c7ec7 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html
@@ -9,8 +9,8 @@
         const privateKeyBase64 = await generatePrivateKeyBase64();
         const credentialID = await calculateCredentialID(privateKeyBase64);
         // Default mock configuration. Tests need to override if they need different configuration.
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false } });
 
         promise_test(t => {
             const options = {
@@ -116,8 +116,8 @@
                     pubKeyCredParams: [{ type: "public-key", alg: -7 }]
                 }
             };
-            if (window.testRunner)
-                testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } });
+            if (window.internals)
+                internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } });
             return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error.");
         }, "PublicKeyCredential's [[create]] without attestation in a mock local authenticator.");
 
@@ -136,8 +136,8 @@
                     pubKeyCredParams: [{ type: "public-key", alg: -7 }]
                 }
             };
-            if (window.testRunner) {
-                testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } });
+            if (window.internals) {
+                internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } });
                 testRunner.addTestKeyToKeychain(privateKeyBase64, testRpId, userhandleBase64);
             }
             return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error.").then(() => {
@@ -164,8 +164,8 @@
                 }
             };
 
-            if (window.testRunner)
-                testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false } });
+            if (window.internals)
+                internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false } });
             return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
         }, "PublicKeyCredential's [[create]] with timeout in a mock local authenticator.");
     })();
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html
index 4824857..25353f0 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html
@@ -5,8 +5,8 @@
 <script src="./resources/util.js"></script>
 <script>
     // Default mock configuration. Tests need to override it if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "no-tags" } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ nfc: { error: "no-tags" } });
 
     promise_test(function(t) {
         const options = {
@@ -66,8 +66,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "wrong-tag-type" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "wrong-tag-type" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with wrong tag type in a mock nfc authenticator.");
 
@@ -88,8 +88,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "no-connections" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "no-connections" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with no connections in a mock nfc authenticator.");
 
@@ -110,8 +110,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload", payloadBase64: [ ] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload", payloadBase64: [ ] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with null version in a mock nfc authenticator.");
 
@@ -132,8 +132,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testDummyMessagePayloadBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testDummyMessagePayloadBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with wrong version in a mock nfc authenticator.");
 
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html
index aed97c2..7e704f7 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html
@@ -21,8 +21,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: ["AQ=="] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: ["AQ=="] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with malformed APDU payload in a mock hid authenticator.");
 
@@ -43,8 +43,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with malformed U2F register response in a mock hid authenticator.");
 
@@ -65,8 +65,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduInsNotSupportedOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduInsNotSupportedOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with register command error in a mock hid authenticator.");
 
@@ -88,8 +88,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduInsNotSupportedOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduInsNotSupportedOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with bogus command error in a mock hid authenticator.");
 
@@ -110,8 +110,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator.");
     }, "PublicKeyCredential's [[create]] with first exclude credential matched in a mock hid authenticator.");
 
@@ -133,8 +133,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator.");
     }, "PublicKeyCredential's [[create]] with second exclude credential matched in a mock hid authenticator.");
 
@@ -156,8 +156,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with first exclude credential matched in a mock hid authenticator. Test of user presence.");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html
index 157d9e8..947dcff 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html
@@ -20,8 +20,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: ["AQ=="] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: ["AQ=="] } });
         return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Couldn't parse the APDU response.");
     }, "PublicKeyCredential's [[create]] with malformed APDU payload in a mock hid authenticator.");
 
@@ -41,8 +41,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Couldn't parse the U2F register response.");
     }, "PublicKeyCredential's [[create]] with malformed U2F register response in a mock hid authenticator.");
 
@@ -62,8 +62,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduInsNotSupportedOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduInsNotSupportedOnlyResponseBase64] } });
         return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 27904");
     }, "PublicKeyCredential's [[create]] with register command error in a mock hid authenticator.");
 
@@ -84,8 +84,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduInsNotSupportedOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduInsNotSupportedOnlyResponseBase64] } });
         return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error. Error code: 27904");
     }, "PublicKeyCredential's [[create]] with bogus command error in a mock hid authenticator.");
 
@@ -106,8 +106,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator.");
     }, "PublicKeyCredential's [[create]] with first exclude credential matched in a mock hid authenticator.");
 
@@ -129,8 +129,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator.");
     }, "PublicKeyCredential's [[create]] with second exclude credential matched in a mock hid authenticator.");
 
@@ -151,8 +151,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "InvalidStateError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the authenticator.");
     }, "PublicKeyCredential's [[create]] with first exclude credential matched in a mock hid authenticator. Test of user presence.");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html
index 4642a5b..5e8f5b8 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html
@@ -5,8 +5,8 @@
 <script src="./resources/util.js"></script>
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ });
 
     promise_test(function(t) {
         const options = {
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html
index 6a8c358..5446f55 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-hid.https.html
@@ -6,8 +6,8 @@
 <script src="./resources/cbor.js"></script>
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testCreationMessageBase64] } });
 
     promise_test(t => {
         const options = {
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https.html
index e51ba5f..088e863 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-local.https.html
@@ -10,8 +10,8 @@
         const privateKeyBase64 = await generatePrivateKeyBase64();
         const credentialID = await calculateCredentialID(privateKeyBase64);
         // Default mock configuration. Tests need to override if they need different configuration.
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({
                 local: {
                     acceptAuthentication: true,
                     acceptAttestation: true,
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https.html
index 8d22e54..82d0706 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https.html
@@ -6,8 +6,8 @@
 <script src="./resources/cbor.js"></script>
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64] } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64] } });
 
     promise_test(t => {
         const options = {
@@ -71,8 +71,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64], multipleTags: true } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64], multipleTags: true } });
         return navigator.credentials.create(options).then(credential => {
             checkCtapMakeCredentialResult(credential);
         });
@@ -95,8 +95,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcU2fVersionBase64, testU2fApduInsNotSupportedOnlyResponseBase64, testU2fRegisterResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcU2fVersionBase64, testU2fApduInsNotSupportedOnlyResponseBase64, testU2fRegisterResponse] } });
         return navigator.credentials.create(options).then(credential => {
             checkU2fMakeCredentialResult(credential);
         });
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html
index 47d8bd4..c2bc8f5 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success-u2f.https.html
@@ -21,8 +21,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });
         return navigator.credentials.create(options).then(credential => {
             checkU2fMakeCredentialResult(credential);
         });
@@ -45,8 +45,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } });
         return navigator.credentials.create(options).then(credential => {
             checkU2fMakeCredentialResult(credential);
         });
@@ -69,8 +69,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fRegisterResponse] } });
         return navigator.credentials.create(options).then(credential => {
             checkU2fMakeCredentialResult(credential);
         });
@@ -92,8 +92,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fRegisterResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fRegisterResponse] } });
         return navigator.credentials.create(options).then(credential => {
             checkU2fMakeCredentialResult(credential);
         });
@@ -116,8 +116,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });
         return navigator.credentials.create(options).then(credential => {
             checkU2fMakeCredentialResult(credential);
         });
@@ -140,8 +140,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });
         return navigator.credentials.create(options).then(credential => {
             checkU2fMakeCredentialResult(credential, false);
         });
@@ -164,8 +164,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fRegisterResponse] } });
         return navigator.credentials.create(options).then(credential => {
             checkU2fMakeCredentialResult(credential, false);
         });
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html
index e85c2c8..38f4074 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid-silent.https.html
@@ -12,8 +12,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out.");
     }, "PublicKeyCredential's [[get]] with malicious payload in a mock hid authenticator.");
 
@@ -26,8 +26,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out.");
     }, "PublicKeyCredential's [[get]] with unsupported options in a mock hid authenticator.");
 
@@ -39,8 +39,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out.");
     }, "PublicKeyCredential's [[get]] with invalid credential in a mock hid authenticator.");
 
@@ -52,8 +52,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out.");
     }, "PublicKeyCredential's [[get]] with authenticator downgrade in a mock hid authenticator.");
 
@@ -66,8 +66,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out.");
     }, "PublicKeyCredential's [[get]] with authenticator downgrade in a mock hid authenticator. 2");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid.https.html
index 5485f37..0022ea9 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-hid.https.html
@@ -5,8 +5,8 @@
 <script src="./resources/util.js"></script>
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload" } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload" } });
 
     promise_test(t => {
         const options = {
@@ -31,8 +31,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64] } });
         return promiseRejects(t, "UnknownError", navigator.credentials.get(options), "Unknown internal error. Error code: 255");
     }, "PublicKeyCredential's [[get]] with malicious payload in a mock hid authenticator.");
 
@@ -44,8 +44,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "unsupported-options" } });
         return promiseRejects(t, "UnknownError", navigator.credentials.get(options), "Unknown internal error. Error code: 43");
     }, "PublicKeyCredential's [[get]] with unsupported options in a mock hid authenticator.");
 
@@ -56,8 +56,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
         return promiseRejects(t, "UnknownError", navigator.credentials.get(options), "Unknown internal error. Error code: 34");
     }, "PublicKeyCredential's [[get]] with authenticator downgrade failed in a mock hid authenticator.");
 
@@ -69,8 +69,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64] } });
         return promiseRejects(t, "NotSupportedError", navigator.credentials.get(options), "Cannot convert the request to U2F command.");
     }, "PublicKeyCredential's [[get]] with authenticator downgrade succeeded and then U2F failed in a mock hid authenticator. 2");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html
index 843ba86..f02c255 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local-silent.https.html
@@ -9,8 +9,8 @@
         const privateKeyBase64 = await generatePrivateKeyBase64();
         const credentialID = await calculateCredentialID(privateKeyBase64);
         // Default mock configuration. Tests need to override if they need different configuration.
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, local: { acceptAuthentication: false, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, local: { acceptAuthentication: false, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } });
 
         promise_test(t => {
             const options = {
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html
index ea0e2a4..3e4f499 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html
@@ -9,8 +9,8 @@
         const privateKeyBase64 = await generatePrivateKeyBase64();
         const credentialID = await calculateCredentialID(privateKeyBase64);
         // Default mock configuration. Tests need to override if they need different configuration.
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: false, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } });
 
         promise_test(t => {
             const options = {
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html
index db64874..275ee66 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html
@@ -5,8 +5,8 @@
 <script src="./resources/util.js"></script>
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "malicious-payload" } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload" } });
 
     promise_test(t => {
         const options = {
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html
index 8a7cd8a..ae5bbdd 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html
@@ -13,8 +13,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out.");
     }, "PublicKeyCredential's [[get]] with malformed sign response in a mock hid authenticator.");
 
@@ -27,8 +27,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out.");
     }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator.");
 
@@ -41,8 +41,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out.");
     }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator. 2");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html
index 6491378..5d1d300 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html
@@ -12,8 +12,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduNoErrorOnlyResponseBase64] } });
         return promiseRejects(t, "UnknownError", navigator.credentials.get(options), "Couldn't parse the U2F sign response.");
     }, "PublicKeyCredential's [[get]] with malformed sign response in a mock hid authenticator.");
 
@@ -25,8 +25,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No credentials from the allowCredentials list is found in the authenticator.");
     }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator.");
 
@@ -38,8 +38,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No credentials from the allowCredentials list is found in the authenticator.");
     }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator. 2");
 
@@ -53,8 +53,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No credentials from the allowCredentials list is found in the authenticator.");
     }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator. (AppID)");
 
@@ -67,8 +67,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "malicious-payload", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64] } });
         return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No credentials from the allowCredentials list is found in the authenticator.");
     }, "PublicKeyCredential's [[get]] with no matched allow credentials in a mock hid authenticator. 2 (AppID)");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https.html
index e2f95d6..cf18ff7 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https.html
@@ -5,8 +5,8 @@
 <script src="./resources/util.js"></script>
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ });
 
     promise_test(t => {
         const options = {
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html
index d9b22b4..0cf03e7 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-hid.https.html
@@ -5,8 +5,8 @@
 <script src="./resources/util.js"></script>
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64] } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", payloadBase64: [testAssertionMessageBase64] } });
 
     promise_test(t => {
         const options = {
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https.html
index e182094..9360afb 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-local.https.html
@@ -9,8 +9,8 @@
         const privateKeyBase64 = await generatePrivateKeyBase64();
         const credentialID = await calculateCredentialID(privateKeyBase64);
         // Default mock configuration. Tests need to override if they need different configuration.
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false, preferredUserhandleBase64: userhandleBase64 } });
 
         function checkResult(credential)
         {
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-nfc.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-nfc.https.html
index fc7c6aa..cc050da 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-nfc.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-nfc.https.html
@@ -5,8 +5,8 @@
 <script src="./resources/util.js"></script>
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testAssertionMessageApduBase64] } });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testAssertionMessageApduBase64] } });
 
     promise_test(t => {
         const options = {
@@ -30,8 +30,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ nfc: { error: "success", payloadBase64: [testNfcU2fVersionBase64, testU2fApduInsNotSupportedOnlyResponseBase64, testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "success", payloadBase64: [testNfcU2fVersionBase64, testU2fApduInsNotSupportedOnlyResponseBase64, testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential);
         });
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html
index 95b2d1b..0f0008a 100644
--- a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html
+++ b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success-u2f.https.html
@@ -13,8 +13,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential);
         });
@@ -29,8 +29,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential);
         });
@@ -45,8 +45,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fApduConditionsNotSatisfiedOnlyResponseBase64, testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential);
         });
@@ -63,8 +63,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential);
         });
@@ -80,8 +80,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential);
         });
@@ -97,8 +97,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential, true);
         });
@@ -115,8 +115,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential, true, "7eabc5cc3251bdc59115ef87b5f7ee74cb03747e39ba8341748565cc129c0719");
         });
@@ -132,8 +132,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential);
         });
@@ -149,8 +149,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", isU2f: true, payloadBase64: [testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential, true);
         });
@@ -166,8 +166,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64, testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64, testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential);
         });
@@ -183,8 +183,8 @@
             }
         };
 
-        if (window.testRunner)
-            testRunner.setWebAuthenticationMockConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ hid: { stage: "request", subStage: "msg", error: "success", canDowngrade: true, payloadBase64: [testCtapErrInvalidCredentialResponseBase64, testU2fApduWrongDataOnlyResponseBase64, testU2fSignResponse] } });
         return navigator.credentials.get(options).then(credential => {
             return checkU2fGetAssertionResult(credential, true, "7eabc5cc3251bdc59115ef87b5f7ee74cb03747e39ba8341748565cc129c0719");
         });
diff --git a/LayoutTests/http/wpt/webauthn/resources/public-key-credential-ip-address.https.html b/LayoutTests/http/wpt/webauthn/resources/public-key-credential-ip-address.https.html
index 6de3a94..81183c0 100644
--- a/LayoutTests/http/wpt/webauthn/resources/public-key-credential-ip-address.https.html
+++ b/LayoutTests/http/wpt/webauthn/resources/public-key-credential-ip-address.https.html
@@ -5,8 +5,8 @@
 <script src="util.js"></script>
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
-    if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ });
+    if (window.internals)
+        internals.setMockWebAuthenticationConfiguration({ });
 
     promise_test(function(t) {
         const options = {
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 8a9fe6d..a7e3f3e 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,40 @@
+2019-10-09  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebAuthn] Move the mock testing entrance to Internals
+        https://bugs.webkit.org/show_bug.cgi?id=202560
+        <rdar://problem/55973793>
+
+        Reviewed by Chris Dumez.
+
+        This patch moves TestRunner.setWebAuthenticationMockConfiguration to
+        Internals.setMockWebAuthenticationConfiguration and removes the old
+        entrance. The purpose of this patch is to allow API tests to use
+        the same mock infrastructure that is used by layout tests.
+
+        No new tests, covered by updates on existing tests.
+
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::setMockWebAuthenticationConfiguration):
+        * testing/Internals.cpp:
+        (WebCore::Internals::setMockWebAuthenticationConfiguration):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+        * testing/MockWebAuthenticationConfiguration.h: Added.
+        (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::encode const):
+        (WebCore::MockWebAuthenticationConfiguration::LocalConfiguration::decode):
+        (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const):
+        (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode):
+        (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::encode const):
+        (WebCore::MockWebAuthenticationConfiguration::NfcConfiguration::decode):
+        (WebCore::MockWebAuthenticationConfiguration::encode const):
+        (WebCore::MockWebAuthenticationConfiguration::decode):
+        * testing/MockWebAuthenticationConfiguration.idl: Added.
+
 2019-10-09  Sihui Liu  <sihui_liu@apple.com>
 
         IndexedDB: update size to actual disk usage only when estimated increase is bigger than space available
diff --git a/Source/WebCore/DerivedSources-input.xcfilelist b/Source/WebCore/DerivedSources-input.xcfilelist
index ef4340a..f320855 100644
--- a/Source/WebCore/DerivedSources-input.xcfilelist
+++ b/Source/WebCore/DerivedSources-input.xcfilelist
@@ -1089,6 +1089,7 @@
 $(PROJECT_DIR)/testing/MockPaymentContactFields.idl
 $(PROJECT_DIR)/testing/MockPaymentCoordinator.idl
 $(PROJECT_DIR)/testing/MockPaymentError.idl
+$(PROJECT_DIR)/testing/MockWebAuthenticationConfiguration.idl
 $(PROJECT_DIR)/testing/ServiceWorkerInternals.idl
 $(PROJECT_DIR)/testing/TypeConversions.idl
 $(PROJECT_DIR)/workers/AbstractWorker.idl
diff --git a/Source/WebCore/DerivedSources-output.xcfilelist b/Source/WebCore/DerivedSources-output.xcfilelist
index 0909d7b..162d44d 100644
--- a/Source/WebCore/DerivedSources-output.xcfilelist
+++ b/Source/WebCore/DerivedSources-output.xcfilelist
@@ -1059,6 +1059,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMockPaymentCoordinator.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMockPaymentError.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMockPaymentError.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMockWebAuthenticationConfiguration.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMockWebAuthenticationConfiguration.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMouseEvent.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMouseEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMouseEventInit.cpp
diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make
index c0a4f00..8e77e6d 100644
--- a/Source/WebCore/DerivedSources.make
+++ b/Source/WebCore/DerivedSources.make
@@ -1076,6 +1076,7 @@
     $(WebCore)/testing/MockPaymentContactFields.idl \
     $(WebCore)/testing/MockPaymentCoordinator.idl \
     $(WebCore)/testing/MockPaymentError.idl \
+    $(WebCore)/testing/MockWebAuthenticationConfiguration.idl \
     $(WebCore)/testing/ServiceWorkerInternals.idl \
     $(WebCore)/testing/TypeConversions.idl \
     $(WebCore)/workers/AbstractWorker.idl \
diff --git a/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h b/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h
index 372df1b..d8c7bbb 100644
--- a/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h
+++ b/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h
@@ -33,7 +33,6 @@
 #include "PublicKeyCredentialDescriptor.h"
 #include "PublicKeyCredentialType.h"
 #include "UserVerificationRequirement.h"
-#include <wtf/CrossThreadCopier.h>
 #include <wtf/Forward.h>
 
 namespace WebCore {
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 7a3a9bda..e373c81 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1738,6 +1738,10 @@
 		57152B6E21CD995D000C37CA /* U2fCommandConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 57152B6C21CD995C000C37CA /* U2fCommandConstructor.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		57152B7C21DD8BA1000C37CA /* U2fResponseConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 57152B7A21DD8BA1000C37CA /* U2fResponseConverter.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		57152B8021DDA581000C37CA /* WebAuthenticationUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 57152B7E21DDA581000C37CA /* WebAuthenticationUtils.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		5715610B234C1B49008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 57156108234C1B31008FC7AB /* MockWebAuthenticationConfiguration.h */; };
+		5715610C234C1CA1008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 57156108234C1B31008FC7AB /* MockWebAuthenticationConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		57156114234C7FD6008FC7AB /* JSMockWebAuthenticationConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57156111234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.cpp */; };
+		57156115234C7FDC008FC7AB /* JSMockWebAuthenticationConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 57156110234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.h */; };
 		571F21891DA57C54005C9EFD /* JSSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */; };
 		572093D31DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h */; };
 		5721A9871ECE53B10081295A /* CryptoDigestAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = 5721A9861ECE53B10081295A /* CryptoDigestAlgorithm.h */; };
@@ -8605,6 +8609,10 @@
 		57152B7B21DD8BA1000C37CA /* U2fResponseConverter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = U2fResponseConverter.cpp; sourceTree = "<group>"; };
 		57152B7E21DDA581000C37CA /* WebAuthenticationUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationUtils.h; sourceTree = "<group>"; };
 		57152B7F21DDA581000C37CA /* WebAuthenticationUtils.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebAuthenticationUtils.cpp; sourceTree = "<group>"; };
+		57156108234C1B31008FC7AB /* MockWebAuthenticationConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockWebAuthenticationConfiguration.h; sourceTree = "<group>"; };
+		5715610D234C7481008FC7AB /* MockWebAuthenticationConfiguration.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockWebAuthenticationConfiguration.idl; sourceTree = "<group>"; };
+		57156110234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMockWebAuthenticationConfiguration.h; sourceTree = "<group>"; };
+		57156111234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockWebAuthenticationConfiguration.cpp; sourceTree = "<group>"; };
 		571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSubtleCrypto.h; sourceTree = "<group>"; };
 		571F218A1DA57C7A005C9EFD /* JSSubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSubtleCrypto.cpp; sourceTree = "<group>"; };
 		572093D11DDCEA4B00310AB0 /* AesCbcCfbParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AesCbcCfbParams.idl; sourceTree = "<group>"; };
@@ -17892,6 +17900,8 @@
 				A1CBEF631F9F11290028DE7C /* MockPaymentMethod.h */,
 				A14061891E2ECA0A0032B34E /* MockPreviewLoaderClient.cpp */,
 				A140618A1E2ECA0A0032B34E /* MockPreviewLoaderClient.h */,
+				57156108234C1B31008FC7AB /* MockWebAuthenticationConfiguration.h */,
+				5715610D234C7481008FC7AB /* MockWebAuthenticationConfiguration.idl */,
 				417F0D801FFEE14F008EF303 /* ServiceWorkerInternals.cpp */,
 				417F0D7E1FFEE14E008EF303 /* ServiceWorkerInternals.h */,
 				417F0D811FFEE150008EF303 /* ServiceWorkerInternals.idl */,
@@ -17932,6 +17942,8 @@
 				A146D3181F99BCBA00D29196 /* JSMockPaymentCoordinator.h */,
 				A1BB85B42159B3890067E07D /* JSMockPaymentError.cpp */,
 				A1BB85B52159B38A0067E07D /* JSMockPaymentError.h */,
+				57156111234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.cpp */,
+				57156110234C7FBC008FC7AB /* JSMockWebAuthenticationConfiguration.h */,
 				427DA71B13735DFA007C57FB /* JSServiceWorkerInternals.cpp */,
 				427DA71C13735DFA007C57FB /* JSServiceWorkerInternals.h */,
 				EBF5121A1696496C0056BD25 /* JSTypeConversions.cpp */,
@@ -28425,6 +28437,7 @@
 				A104EC5E220A3E4E00CBF67A /* JSMockPaymentContactFields.h in Headers */,
 				A146D31B1F99BCFB00D29196 /* JSMockPaymentCoordinator.h in Headers */,
 				A1BB85B92159B3AE0067E07D /* JSMockPaymentError.h in Headers */,
+				57156115234C7FDC008FC7AB /* JSMockWebAuthenticationConfiguration.h in Headers */,
 				427DA71E13735DFA007C57FB /* JSServiceWorkerInternals.h in Headers */,
 				EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */,
 				CDC26B41160A8CCE0026757B /* LegacyMockCDM.h in Headers */,
@@ -28442,6 +28455,7 @@
 				A1AFEDE61F8BFF6D0087013F /* MockPaymentCoordinator.h in Headers */,
 				A1CBEF641F9F11290028DE7C /* MockPaymentMethod.h in Headers */,
 				A140618C1E2ECA0A0032B34E /* MockPreviewLoaderClient.h in Headers */,
+				5715610B234C1B49008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */,
 				AA5F3B8D16CC33D100455EB0 /* PlatformSpeechSynthesizerMock.h in Headers */,
 				A1763F3F1E205234001D58DE /* WebArchiveDumpSupport.h in Headers */,
 				41815C1F138319830057AAA4 /* WebCoreTestSupport.h in Headers */,
@@ -31021,6 +31035,7 @@
 				07EE76EF1BEA619800F89133 /* MockRealtimeVideoSourceMac.h in Headers */,
 				CDF2B0171820540700F2B424 /* MockSourceBufferPrivate.h in Headers */,
 				CDF2B0191820540700F2B424 /* MockTracks.h in Headers */,
+				5715610C234C1CA1008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */,
 				C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */,
 				709A01FE1E3D0BDD006B0D4C /* ModuleFetchFailureKind.h in Headers */,
 				E3201C1A1F8E82130076A032 /* ModuleFetchParameters.h in Headers */,
@@ -32984,6 +32999,7 @@
 				A104EC5D220A3E4B00CBF67A /* JSMockPaymentContactFields.cpp in Sources */,
 				A146D31A1F99BCF800D29196 /* JSMockPaymentCoordinator.cpp in Sources */,
 				A1BB85B82159B3A40067E07D /* JSMockPaymentError.cpp in Sources */,
+				57156114234C7FD6008FC7AB /* JSMockWebAuthenticationConfiguration.cpp in Sources */,
 				427DA71D13735DFA007C57FB /* JSServiceWorkerInternals.cpp in Sources */,
 				EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */,
 				CDC26B40160A8CC60026757B /* LegacyMockCDM.cpp in Sources */,
diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h
index fddb186..3505d44 100644
--- a/Source/WebCore/page/ChromeClient.h
+++ b/Source/WebCore/page/ChromeClient.h
@@ -110,6 +110,7 @@
 struct ContentRuleListResults;
 struct DateTimeChooserParameters;
 struct GraphicsDeviceAdapter;
+struct MockWebAuthenticationConfiguration;
 struct ShareDataWithParsedURL;
 struct ViewportArguments;
 struct WindowFeatures;
@@ -510,6 +511,10 @@
     virtual bool userIsInteracting() const { return false; }
     virtual void setUserIsInteracting(bool) { }
 
+#if ENABLE(WEB_AUTHN)
+    virtual void setMockWebAuthenticationConfiguration(const MockWebAuthenticationConfiguration&) { }
+#endif
+
 protected:
     virtual ~ChromeClient() = default;
 };
diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp
index ff40969..6da1cf3 100644
--- a/Source/WebCore/testing/Internals.cpp
+++ b/Source/WebCore/testing/Internals.cpp
@@ -5234,4 +5234,17 @@
     }
 }
 
+#if ENABLE(WEB_AUTHN)
+void Internals::setMockWebAuthenticationConfiguration(const MockWebAuthenticationConfiguration& configuration)
+{
+    auto* document = contextDocument();
+    if (!document)
+        return;
+    auto* page = document->page();
+    if (!page)
+        return;
+    page->chrome().client().setMockWebAuthenticationConfiguration(configuration);
+}
+#endif
+
 } // namespace WebCore
diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h
index 816595c..c134def 100644
--- a/Source/WebCore/testing/Internals.h
+++ b/Source/WebCore/testing/Internals.h
@@ -112,6 +112,8 @@
 
 template<typename IDLType> class DOMPromiseDeferred;
 
+struct MockWebAuthenticationConfiguration;
+
 class Internals final : public RefCounted<Internals>, private ContextDestructionObserver
 #if ENABLE(MEDIA_STREAM)
     , private RealtimeMediaSource::Observer
@@ -884,6 +886,10 @@
 
     void addPrefetchLoadEventListener(HTMLLinkElement&, RefPtr<EventListener>&&);
 
+#if ENABLE(WEB_AUTHN)
+    void setMockWebAuthenticationConfiguration(const MockWebAuthenticationConfiguration&);
+#endif
+
 private:
     explicit Internals(Document&);
     Document* contextDocument() const;
diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl
index 468ef23..4e3a412 100644
--- a/Source/WebCore/testing/Internals.idl
+++ b/Source/WebCore/testing/Internals.idl
@@ -794,4 +794,6 @@
     TextIndicatorInfo textIndicatorForRange(Range range, TextIndicatorOptions options);
 
     void addPrefetchLoadEventListener(HTMLLinkElement link, EventListener? callback);
+
+    [Conditional=WEB_AUTHN] void setMockWebAuthenticationConfiguration(MockWebAuthenticationConfiguration configuration);
 };
diff --git a/Source/WebCore/testing/MockWebAuthenticationConfiguration.h b/Source/WebCore/testing/MockWebAuthenticationConfiguration.h
new file mode 100644
index 0000000..7450f25
--- /dev/null
+++ b/Source/WebCore/testing/MockWebAuthenticationConfiguration.h
@@ -0,0 +1,293 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUTHN)
+
+#include <wtf/Forward.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct MockWebAuthenticationConfiguration {
+    enum class HidStage : bool {
+        Info,
+        Request
+    };
+
+    enum class HidSubStage : bool {
+        Init,
+        Msg
+    };
+
+    enum class HidError : uint8_t {
+        Success,
+        DataNotSent,
+        EmptyReport,
+        WrongChannelId,
+        MaliciousPayload,
+        UnsupportedOptions,
+        WrongNonce
+    };
+
+    enum class NfcError : uint8_t {
+        Success,
+        NoTags,
+        WrongTagType,
+        NoConnections,
+        MaliciousPayload
+    };
+
+    struct LocalConfiguration {
+        bool acceptAuthentication { false };
+        bool acceptAttestation { false };
+        String privateKeyBase64;
+        String userCertificateBase64;
+        String intermediateCACertificateBase64;
+        String preferredUserhandleBase64;
+
+        template<class Encoder> void encode(Encoder&) const;
+        template<class Decoder> static Optional<LocalConfiguration> decode(Decoder&);
+    };
+
+    struct HidConfiguration {
+        Vector<String> payloadBase64;
+        HidStage stage { HidStage::Info };
+        HidSubStage subStage { HidSubStage::Init };
+        HidError error { HidError::Success };
+        bool isU2f { false };
+        bool keepAlive { false };
+        bool fastDataArrival { false };
+        bool continueAfterErrorData { false };
+        bool canDowngrade { false };
+
+        template<class Encoder> void encode(Encoder&) const;
+        template<class Decoder> static Optional<HidConfiguration> decode(Decoder&);
+    };
+
+    struct NfcConfiguration {
+        NfcError error { NfcError::Success };
+        Vector<String> payloadBase64;
+        bool multipleTags { false };
+
+        template<class Encoder> void encode(Encoder&) const;
+        template<class Decoder> static Optional<NfcConfiguration> decode(Decoder&);
+    };
+
+    bool silentFailure { false };
+    Optional<LocalConfiguration> local;
+    Optional<HidConfiguration> hid;
+    Optional<NfcConfiguration> nfc;
+
+    template<class Encoder> void encode(Encoder&) const;
+    template<class Decoder> static Optional<MockWebAuthenticationConfiguration> decode(Decoder&);
+};
+
+template<class Encoder>
+void MockWebAuthenticationConfiguration::LocalConfiguration::encode(Encoder& encoder) const
+{
+    encoder << acceptAuthentication << acceptAttestation << privateKeyBase64 << userCertificateBase64 << intermediateCACertificateBase64 << preferredUserhandleBase64;
+}
+
+template<class Decoder>
+Optional<MockWebAuthenticationConfiguration::LocalConfiguration> MockWebAuthenticationConfiguration::LocalConfiguration::decode(Decoder& decoder)
+{
+    MockWebAuthenticationConfiguration::LocalConfiguration result;
+
+    Optional<bool> acceptAuthentication;
+    decoder >> acceptAuthentication;
+    if (!acceptAuthentication)
+        return WTF::nullopt;
+    result.acceptAuthentication = *acceptAuthentication;
+
+    Optional<bool> acceptAttestation;
+    decoder >> acceptAttestation;
+    if (!acceptAttestation)
+        return WTF::nullopt;
+    result.acceptAttestation = *acceptAttestation;
+
+    Optional<String> privateKeyBase64;
+    decoder >> privateKeyBase64;
+    if (!privateKeyBase64)
+        return WTF::nullopt;
+    result.privateKeyBase64 = WTFMove(*privateKeyBase64);
+
+    Optional<String> userCertificateBase64;
+    decoder >> userCertificateBase64;
+    if (!userCertificateBase64)
+        return WTF::nullopt;
+    result.userCertificateBase64 = WTFMove(*userCertificateBase64);
+
+    Optional<String> intermediateCACertificateBase64;
+    decoder >> intermediateCACertificateBase64;
+    if (!intermediateCACertificateBase64)
+        return WTF::nullopt;
+    result.intermediateCACertificateBase64 = WTFMove(*intermediateCACertificateBase64);
+
+    Optional<String> preferredUserhandleBase64;
+    decoder >> preferredUserhandleBase64;
+    if (!preferredUserhandleBase64)
+        return WTF::nullopt;
+    result.preferredUserhandleBase64 = WTFMove(*preferredUserhandleBase64);
+
+    return result;
+}
+
+template<class Encoder>
+void MockWebAuthenticationConfiguration::HidConfiguration::encode(Encoder& encoder) const
+{
+    encoder << payloadBase64 << stage << subStage << error << isU2f << keepAlive << fastDataArrival << continueAfterErrorData << canDowngrade;
+}
+
+template<class Decoder>
+Optional<MockWebAuthenticationConfiguration::HidConfiguration> MockWebAuthenticationConfiguration::HidConfiguration::decode(Decoder& decoder)
+{
+    MockWebAuthenticationConfiguration::HidConfiguration result;
+    if (!decoder.decode(result.payloadBase64))
+        return WTF::nullopt;
+    if (!decoder.decodeEnum(result.stage))
+        return WTF::nullopt;
+    if (!decoder.decodeEnum(result.subStage))
+        return WTF::nullopt;
+    if (!decoder.decodeEnum(result.error))
+        return WTF::nullopt;
+    if (!decoder.decode(result.isU2f))
+        return WTF::nullopt;
+    if (!decoder.decode(result.keepAlive))
+        return WTF::nullopt;
+    if (!decoder.decode(result.fastDataArrival))
+        return WTF::nullopt;
+    if (!decoder.decode(result.continueAfterErrorData))
+        return WTF::nullopt;
+    if (!decoder.decode(result.canDowngrade))
+        return WTF::nullopt;
+    return result;
+}
+
+template<class Encoder>
+void MockWebAuthenticationConfiguration::NfcConfiguration::encode(Encoder& encoder) const
+{
+    encoder << error << payloadBase64 << multipleTags;
+}
+
+template<class Decoder>
+Optional<MockWebAuthenticationConfiguration::NfcConfiguration> MockWebAuthenticationConfiguration::NfcConfiguration::decode(Decoder& decoder)
+{
+    MockWebAuthenticationConfiguration::NfcConfiguration result;
+    if (!decoder.decodeEnum(result.error))
+        return WTF::nullopt;
+    if (!decoder.decode(result.payloadBase64))
+        return WTF::nullopt;
+    if (!decoder.decode(result.multipleTags))
+        return WTF::nullopt;
+    return result;
+}
+
+template<class Encoder>
+void MockWebAuthenticationConfiguration::encode(Encoder& encoder) const
+{
+    encoder << silentFailure << local << hid << nfc;
+}
+
+template<class Decoder>
+Optional<MockWebAuthenticationConfiguration> MockWebAuthenticationConfiguration::decode(Decoder& decoder)
+{
+    MockWebAuthenticationConfiguration result;
+
+    Optional<bool> silentFailure;
+    decoder >> silentFailure;
+    if (!silentFailure)
+        return WTF::nullopt;
+    result.silentFailure = *silentFailure;
+
+    Optional<Optional<LocalConfiguration>> local;
+    decoder >> local;
+    if (!local)
+        return WTF::nullopt;
+    result.local = WTFMove(*local);
+
+    Optional<Optional<HidConfiguration>> hid;
+    decoder >> hid;
+    if (!hid)
+        return WTF::nullopt;
+    result.hid = WTFMove(*hid);
+
+    Optional<Optional<NfcConfiguration>> nfc;
+    decoder >> nfc;
+    if (!nfc)
+        return WTF::nullopt;
+    result.nfc = WTFMove(*nfc);
+
+    return result;
+}
+
+} // namespace WebCore
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::MockWebAuthenticationConfiguration::HidStage> {
+    using values = EnumValues<
+        WebCore::MockWebAuthenticationConfiguration::HidStage,
+        WebCore::MockWebAuthenticationConfiguration::HidStage::Info,
+        WebCore::MockWebAuthenticationConfiguration::HidStage::Request
+    >;
+};
+
+template<> struct EnumTraits<WebCore::MockWebAuthenticationConfiguration::HidSubStage> {
+    using values = EnumValues<
+        WebCore::MockWebAuthenticationConfiguration::HidSubStage,
+        WebCore::MockWebAuthenticationConfiguration::HidSubStage::Init,
+        WebCore::MockWebAuthenticationConfiguration::HidSubStage::Msg
+    >;
+};
+
+template<> struct EnumTraits<WebCore::MockWebAuthenticationConfiguration::HidError> {
+    using values = EnumValues<
+        WebCore::MockWebAuthenticationConfiguration::HidError,
+        WebCore::MockWebAuthenticationConfiguration::HidError::Success,
+        WebCore::MockWebAuthenticationConfiguration::HidError::DataNotSent,
+        WebCore::MockWebAuthenticationConfiguration::HidError::EmptyReport,
+        WebCore::MockWebAuthenticationConfiguration::HidError::WrongChannelId,
+        WebCore::MockWebAuthenticationConfiguration::HidError::MaliciousPayload,
+        WebCore::MockWebAuthenticationConfiguration::HidError::UnsupportedOptions,
+        WebCore::MockWebAuthenticationConfiguration::HidError::WrongNonce
+    >;
+};
+
+template<> struct EnumTraits<WebCore::MockWebAuthenticationConfiguration::NfcError> {
+    using values = EnumValues<
+        WebCore::MockWebAuthenticationConfiguration::NfcError,
+        WebCore::MockWebAuthenticationConfiguration::NfcError::Success,
+        WebCore::MockWebAuthenticationConfiguration::NfcError::NoTags,
+        WebCore::MockWebAuthenticationConfiguration::NfcError::WrongTagType,
+        WebCore::MockWebAuthenticationConfiguration::NfcError::NoConnections,
+        WebCore::MockWebAuthenticationConfiguration::NfcError::MaliciousPayload
+    >;
+};
+
+} // namespace WTF
+
+#endif // ENABLE(WEB_AUTHN)
diff --git a/Source/WebCore/testing/MockWebAuthenticationConfiguration.idl b/Source/WebCore/testing/MockWebAuthenticationConfiguration.idl
new file mode 100644
index 0000000..bdeb861
--- /dev/null
+++ b/Source/WebCore/testing/MockWebAuthenticationConfiguration.idl
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=WEB_AUTHN,
+] enum MockHidStage {
+    "info",
+    "request"
+};
+
+[
+    Conditional=WEB_AUTHN,
+] enum MockHidSubStage {
+    "init",
+    "msg"
+};
+
+[
+    Conditional=WEB_AUTHN,
+] enum MockHidError {
+    "success",
+    "data-not-sent",
+    "empty-report",
+    "wrong-channel-id",
+    "malicious-payload",
+    "unsupported-options",
+    "wrong-nonce"
+};
+
+[
+    Conditional=WEB_AUTHN,
+] enum MockNfcError {
+    "success",
+    "no-tags",
+    "wrong-tag-type",
+    "no-connections",
+    "malicious-payload"
+};
+
+[
+    Conditional=WEB_AUTHN,
+] dictionary MockWebAuthenticationConfiguration {
+    boolean silentFailure = false;
+    MockLocalConfiguration local;
+    MockHidConfiguration hid;
+    MockNfcConfiguration nfc;
+};
+
+[
+    Conditional=WEB_AUTHN,
+] dictionary MockLocalConfiguration {
+    boolean acceptAuthentication = false;
+    boolean acceptAttestation = false;
+    DOMString privateKeyBase64;
+    DOMString userCertificateBase64;
+    DOMString intermediateCACertificateBase64;
+    DOMString preferredUserhandleBase64;
+};
+
+[
+    Conditional=WEB_AUTHN,
+] dictionary MockHidConfiguration {
+    sequence<DOMString> payloadBase64;
+    MockHidStage stage = "info";
+    MockHidSubStage subStage = "init";
+    MockHidError error = "success";
+    boolean isU2f = false;
+    boolean keepAlive = false;
+    boolean fastDataArrival = false;
+    boolean continueAfterErrorData = false;
+    boolean canDowngrade = false;
+};
+
+[
+    Conditional=WEB_AUTHN,
+] dictionary MockNfcConfiguration {
+    MockNfcError error = "success";
+    sequence<DOMString> payloadBase64;
+    boolean multipleTags = false;
+};
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index e915c20..cc30af5 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,52 @@
+2019-10-09  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebAuthn] Move the mock testing entrance to Internals
+        https://bugs.webkit.org/show_bug.cgi?id=202560
+        <rdar://problem/55973793>
+
+        Reviewed by Chris Dumez.
+
+        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+        (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration): Deleted.
+        * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+        * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
+        (WebKit::AuthenticatorTransportService::createMock):
+        * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
+        * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
+        (WebKit::MockAuthenticatorManager::MockAuthenticatorManager):
+        * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h:
+        * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
+        (WebKit::MockHidConnection::send):
+        (WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
+        (WebKit::MockHidConnection::parseRequest):
+        (WebKit::MockHidConnection::feedReports):
+        (WebKit::MockHidConnection::shouldContinueFeedReports):
+        * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
+        * UIProcess/WebAuthentication/Mock/MockHidService.cpp:
+        (WebKit::MockHidService::MockHidService):
+        * UIProcess/WebAuthentication/Mock/MockHidService.h:
+        * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
+        * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
+        (WebKit::MockLocalConnection::MockLocalConnection):
+        * UIProcess/WebAuthentication/Mock/MockLocalService.h:
+        * UIProcess/WebAuthentication/Mock/MockLocalService.mm:
+        (WebKit::MockLocalService::MockLocalService):
+        * UIProcess/WebAuthentication/Mock/MockNfcService.h:
+        * UIProcess/WebAuthentication/Mock/MockNfcService.mm:
+        (WebKit::MockNfcService::MockNfcService):
+        (WebKit::MockNfcService::platformStartDiscovery):
+        (WebKit::MockNfcService::detectTags const):
+        * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h: Removed.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setMockWebAuthenticationConfiguration):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::setMockWebAuthenticationConfiguration):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2019-10-09  Andy Estes  <aestes@apple.com>
 
         [Cocoa] IPC::decode should gracefully handle a nil allowed class
diff --git a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
index 9d7fa7d..744fcba 100644
--- a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
+++ b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
@@ -28,7 +28,6 @@
 
 #include "APIArray.h"
 #include "APIHTTPCookieStore.h"
-#include "MockWebAuthenticationConfiguration.h"
 #include "ShouldGrandfatherStatistics.h"
 #include "WKAPICast.h"
 #include "WKDictionary.h"
@@ -658,108 +657,6 @@
 #endif
 }
 
-void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configurationRef)
-{
-#if ENABLE(WEB_AUTHN)
-    WebKit::MockWebAuthenticationConfiguration configuration;
-
-    if (auto silentFailureRef = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("SilentFailure")).get())))
-        configuration.silentFailure = WKBooleanGetValue(silentFailureRef);
-
-    if (auto localRef = static_cast<WKDictionaryRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("Local")).get()))) {
-        WebKit::MockWebAuthenticationConfiguration::Local local;
-        local.acceptAuthentication = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("AcceptAuthentication")).get())));
-        local.acceptAttestation = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("AcceptAttestation")).get())));
-        if (local.acceptAttestation) {
-            local.privateKeyBase64 = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("PrivateKeyBase64")).get())))->string();
-            local.userCertificateBase64 = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("UserCertificateBase64")).get())))->string();
-            local.intermediateCACertificateBase64 = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("IntermediateCACertificateBase64")).get())))->string();
-        }
-        if (auto preferredUserhandleBase64Ref = static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("PreferredUserhandleBase64")).get())))
-            local.preferredUserhandleBase64 = WebKit::toImpl(preferredUserhandleBase64Ref)->string();
-        configuration.local = WTFMove(local);
-    }
-
-    if (auto hidRef = static_cast<WKDictionaryRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("Hid")).get()))) {
-        WebKit::MockWebAuthenticationConfiguration::Hid hid;
-
-        auto stage = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("Stage")).get())))->string();
-        if (stage == "info")
-            hid.stage = WebKit::MockWebAuthenticationConfiguration::Hid::Stage::Info;
-        else if (stage == "request")
-            hid.stage = WebKit::MockWebAuthenticationConfiguration::Hid::Stage::Request;
-
-        auto subStage = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("SubStage")).get())))->string();
-        if (subStage == "init")
-            hid.subStage = WebKit::MockWebAuthenticationConfiguration::Hid::SubStage::Init;
-        else if (subStage == "msg")
-            hid.subStage = WebKit::MockWebAuthenticationConfiguration::Hid::SubStage::Msg;
-
-        auto error = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("Error")).get())))->string();
-        if (error == "success")
-            hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::Success;
-        else if (error == "data-not-sent")
-            hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::DataNotSent;
-        else if (error == "empty-report")
-            hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::EmptyReport;
-        else if (error == "wrong-channel-id")
-            hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::WrongChannelId;
-        else if (error == "malicious-payload")
-            hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::MaliciousPayload;
-        else if (error == "unsupported-options")
-            hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::UnsupportedOptions;
-        else if (error == "wrong-nonce")
-            hid.error = WebKit::MockWebAuthenticationConfiguration::Hid::Error::WrongNonce;
-
-        if (auto payloadBase64 = static_cast<WKArrayRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("PayloadBase64")).get())))
-            hid.payloadBase64 = WebKit::toImpl(payloadBase64)->toStringVector();
-
-        if (auto isU2f = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("IsU2f")).get())))
-            hid.isU2f = WKBooleanGetValue(isU2f);
-
-        if (auto keepAlive = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("KeepAlive")).get())))
-            hid.keepAlive = WKBooleanGetValue(keepAlive);
-
-        if (auto fastDataArrival = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("FastDataArrival")).get())))
-            hid.fastDataArrival = WKBooleanGetValue(fastDataArrival);
-
-        if (auto continueAfterErrorData = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("ContinueAfterErrorData")).get())))
-            hid.continueAfterErrorData = WKBooleanGetValue(continueAfterErrorData);
-
-        if (auto canDowngrade = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(hidRef, adoptWK(WKStringCreateWithUTF8CString("CanDowngrade")).get())))
-            hid.canDowngrade = WKBooleanGetValue(canDowngrade);
-
-        configuration.hid = WTFMove(hid);
-    }
-
-    if (auto nfcRef = static_cast<WKDictionaryRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("Nfc")).get()))) {
-        WebKit::MockWebAuthenticationConfiguration::Nfc nfc;
-
-        auto error = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(nfcRef, adoptWK(WKStringCreateWithUTF8CString("Error")).get())))->string();
-        if (error == "success")
-            nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::Success;
-        else if (error == "no-tags")
-            nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::NoTags;
-        else if (error == "wrong-tag-type")
-            nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::WrongTagType;
-        else if (error == "no-connections")
-            nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::NoConnections;
-        else if (error == "malicious-payload")
-            nfc.error = WebKit::MockWebAuthenticationConfiguration::Nfc::Error::MaliciousPayload;
-
-        if (auto payloadBase64 = static_cast<WKArrayRef>(WKDictionaryGetItemForKey(nfcRef, adoptWK(WKStringCreateWithUTF8CString("PayloadBase64")).get())))
-            nfc.payloadBase64 = WebKit::toImpl(payloadBase64)->toStringVector();
-
-        if (auto multipleTags = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(nfcRef, adoptWK(WKStringCreateWithUTF8CString("MultipleTags")).get())))
-            nfc.multipleTags = WKBooleanGetValue(multipleTags);
-
-        configuration.nfc = WTFMove(nfc);
-    }
-
-    WebKit::toImpl(dataStoreRef)->setMockWebAuthenticationConfiguration(WTFMove(configuration));
-#endif
-}
-
 void WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemovalFunction callback)
 {
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::AdClickAttributions;
diff --git a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
index c1f990b..ef43398 100644
--- a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
+++ b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
@@ -143,8 +143,6 @@
 
 WK_EXPORT void WKWebsiteDataStoreSetPerOriginStorageQuota(WKWebsiteDataStoreRef dataStoreRef, uint64_t quota) WK_C_API_DEPRECATED_WITH_REPLACEMENT(WKWebsiteDataStoreConfigurationSetPerOriginStorageQuota);
 
-WK_EXPORT void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configuration);
-
 WK_EXPORT void WKWebsiteDataStoreClearAllDeviceOrientationPermissions(WKWebsiteDataStoreRef dataStoreRef);
 
 typedef void (*WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemovalFunction)(void* functionContext);
diff --git a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.cpp b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.cpp
index 7a0f8f9..e81039b 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.cpp
+++ b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.cpp
@@ -53,7 +53,7 @@
     }
 }
 
-UniqueRef<AuthenticatorTransportService> AuthenticatorTransportService::createMock(WebCore::AuthenticatorTransport transport, Observer& observer, const MockWebAuthenticationConfiguration& configuration)
+UniqueRef<AuthenticatorTransportService> AuthenticatorTransportService::createMock(WebCore::AuthenticatorTransport transport, Observer& observer, const WebCore::MockWebAuthenticationConfiguration& configuration)
 {
     switch (transport) {
     case WebCore::AuthenticatorTransport::Internal:
diff --git a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h
index 6ce4618..09084ab 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h
+++ b/Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h
@@ -31,12 +31,14 @@
 #include <wtf/UniqueRef.h>
 #include <wtf/WeakPtr.h>
 
+namespace WebCore {
+struct MockWebAuthenticationConfiguration;
+}
+
 namespace WebKit {
 
 class Authenticator;
 
-struct MockWebAuthenticationConfiguration;
-
 class AuthenticatorTransportService : public CanMakeWeakPtr<AuthenticatorTransportService> {
     WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(AuthenticatorTransportService);
@@ -49,7 +51,7 @@
     };
 
     static UniqueRef<AuthenticatorTransportService> create(WebCore::AuthenticatorTransport, Observer&);
-    static UniqueRef<AuthenticatorTransportService> createMock(WebCore::AuthenticatorTransport, Observer&, const MockWebAuthenticationConfiguration&);
+    static UniqueRef<AuthenticatorTransportService> createMock(WebCore::AuthenticatorTransport, Observer&, const WebCore::MockWebAuthenticationConfiguration&);
 
     virtual ~AuthenticatorTransportService() = default;
 
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp
index 084c9be..f8ff2d6 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp
@@ -30,7 +30,7 @@
 
 namespace WebKit {
 
-MockAuthenticatorManager::MockAuthenticatorManager(MockWebAuthenticationConfiguration&& configuration)
+MockAuthenticatorManager::MockAuthenticatorManager(WebCore::MockWebAuthenticationConfiguration&& configuration)
     : m_testConfiguration(WTFMove(configuration))
 {
 }
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h
index 85d8009..a8eb80a 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.h
@@ -28,22 +28,22 @@
 #if ENABLE(WEB_AUTHN)
 
 #include "AuthenticatorManager.h"
-#include "MockWebAuthenticationConfiguration.h"
+#include <WebCore/MockWebAuthenticationConfiguration.h>
 
 namespace WebKit {
 
 class MockAuthenticatorManager final : public AuthenticatorManager {
 public:
-    explicit MockAuthenticatorManager(MockWebAuthenticationConfiguration&&);
+    explicit MockAuthenticatorManager(WebCore::MockWebAuthenticationConfiguration&&);
 
     bool isMock() const final { return true; }
-    void setTestConfiguration(MockWebAuthenticationConfiguration&& configuration) { m_testConfiguration = WTFMove(configuration); }
+    void setTestConfiguration(WebCore::MockWebAuthenticationConfiguration&& configuration) { m_testConfiguration = WTFMove(configuration); }
 
 private:
     UniqueRef<AuthenticatorTransportService> createService(WebCore::AuthenticatorTransport, AuthenticatorTransportService::Observer&) const final;
     void respondReceivedInternal(Respond&&) final;
 
-    MockWebAuthenticationConfiguration m_testConfiguration;
+    WebCore::MockWebAuthenticationConfiguration m_testConfiguration;
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp
index 8e0fe52..658466d 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp
@@ -38,7 +38,7 @@
 #include <wtf/text/Base64.h>
 
 namespace WebKit {
-using MockHid = MockWebAuthenticationConfiguration::Hid;
+using Mock = WebCore::MockWebAuthenticationConfiguration;
 using namespace WebCore;
 using namespace cbor;
 using namespace fido;
@@ -82,7 +82,7 @@
             weakThis->assembleRequest(WTFMove(data));
 
             auto sent = DataSent::Yes;
-            if (weakThis->stagesMatch() && weakThis->m_configuration.hid->error == MockHid::Error::DataNotSent)
+            if (weakThis->stagesMatch() && weakThis->m_configuration.hid->error == Mock::HidError::DataNotSent)
                 sent = DataSent::No;
             callback(sent);
         });
@@ -92,7 +92,7 @@
 
 void MockHidConnection::registerDataReceivedCallbackInternal()
 {
-    if (stagesMatch() && m_configuration.hid->error == MockHid::Error::EmptyReport) {
+    if (stagesMatch() && m_configuration.hid->error == Mock::HidError::EmptyReport) {
         receiveReport({ });
         shouldContinueFeedReports();
         return;
@@ -123,14 +123,14 @@
     // Set stages.
     if (m_requestMessage->cmd() == FidoHidDeviceCommand::kInit) {
         auto previousSubStage = m_subStage;
-        m_subStage = MockHid::SubStage::Init;
-        if (previousSubStage == MockHid::SubStage::Msg)
-            m_stage = MockHid::Stage::Request;
+        m_subStage = Mock::HidSubStage::Init;
+        if (previousSubStage == Mock::HidSubStage::Msg)
+            m_stage = Mock::HidStage::Request;
     }
     if (m_requestMessage->cmd() == FidoHidDeviceCommand::kCbor || m_requestMessage->cmd() == FidoHidDeviceCommand::kMsg)
-        m_subStage = MockHid::SubStage::Msg;
+        m_subStage = Mock::HidSubStage::Msg;
 
-    if (m_stage == MockHid::Stage::Request && m_subStage == MockHid::SubStage::Msg) {
+    if (m_stage == Mock::HidStage::Request && m_subStage == Mock::HidSubStage::Msg) {
         // Make sure we issue different msg cmd for CTAP and U2F.
         if (m_configuration.hid->canDowngrade && !m_configuration.hid->isU2f)
             m_configuration.hid->isU2f = m_requestMessage->cmd() == FidoHidDeviceCommand::kMsg;
@@ -176,7 +176,7 @@
     }
 
     // Store nonce.
-    if (m_subStage == MockHid::SubStage::Init) {
+    if (m_subStage == Mock::HidSubStage::Init) {
         m_nonce = m_requestMessage->getMessagePayload();
         ASSERT(m_nonce.size() == kHidInitNonceLength);
     }
@@ -191,17 +191,17 @@
 {
     using namespace MockHidConnectionInternal;
 
-    if (m_subStage == MockHid::SubStage::Init) {
+    if (m_subStage == Mock::HidSubStage::Init) {
         Vector<uint8_t> payload;
         payload.reserveInitialCapacity(kHidInitResponseSize);
         payload.appendVector(m_nonce);
         size_t writePosition = payload.size();
-        if (stagesMatch() && m_configuration.hid->error == MockHid::Error::WrongNonce)
+        if (stagesMatch() && m_configuration.hid->error == Mock::HidError::WrongNonce)
             payload[0]--;
         payload.grow(kHidInitResponseSize);
         cryptographicallyRandomValues(payload.data() + writePosition, CtapChannelIdSize);
         auto channel = kHidBroadcastChannel;
-        if (stagesMatch() && m_configuration.hid->error == MockHid::Error::WrongChannelId)
+        if (stagesMatch() && m_configuration.hid->error == Mock::HidError::WrongChannelId)
             channel--;
         FidoHidInitPacket initPacket(channel, FidoHidDeviceCommand::kInit, WTFMove(payload), payload.size());
         receiveReport(initPacket.getSerializedData());
@@ -210,14 +210,14 @@
     }
 
     Optional<FidoHidMessage> message;
-    if (m_stage == MockHid::Stage::Info && m_subStage == MockHid::SubStage::Msg) {
+    if (m_stage == Mock::HidStage::Info && m_subStage == Mock::HidSubStage::Msg) {
         Vector<uint8_t> infoData;
         if (m_configuration.hid->canDowngrade)
             infoData = encodeAsCBOR(AuthenticatorGetInfoResponse({ ProtocolVersion::kCtap, ProtocolVersion::kU2f }, Vector<uint8_t>(aaguidLength, 0u)));
         else
             infoData = encodeAsCBOR(AuthenticatorGetInfoResponse({ ProtocolVersion::kCtap }, Vector<uint8_t>(aaguidLength, 0u)));
         infoData.insert(0, static_cast<uint8_t>(CtapDeviceResponseCode::kSuccess)); // Prepend status code.
-        if (stagesMatch() && m_configuration.hid->error == MockHid::Error::WrongChannelId)
+        if (stagesMatch() && m_configuration.hid->error == Mock::HidError::WrongChannelId)
             message = FidoHidMessage::create(m_currentChannel - 1, FidoHidDeviceCommand::kCbor, infoData);
         else {
             if (!m_configuration.hid->isU2f)
@@ -227,7 +227,7 @@
         }
     }
 
-    if (m_stage == MockHid::Stage::Request && m_subStage == MockHid::SubStage::Msg) {
+    if (m_stage == Mock::HidStage::Request && m_subStage == Mock::HidSubStage::Msg) {
         if (m_configuration.hid->keepAlive) {
             m_configuration.hid->keepAlive = false;
             FidoHidInitPacket initPacket(m_currentChannel, FidoHidDeviceCommand::kKeepAlive, { CtapKeepAliveStatusProcessing }, 1);
@@ -235,7 +235,7 @@
             continueFeedReports();
             return;
         }
-        if (stagesMatch() && m_configuration.hid->error == MockHid::Error::UnsupportedOptions && (m_requireResidentKey || m_requireUserVerification))
+        if (stagesMatch() && m_configuration.hid->error == Mock::HidError::UnsupportedOptions && (m_requireResidentKey || m_requireUserVerification))
             message = FidoHidMessage::create(m_currentChannel, FidoHidDeviceCommand::kCbor, { static_cast<uint8_t>(CtapDeviceResponseCode::kCtap2ErrUnsupportedOption) });
         else {
             Vector<uint8_t> payload;
@@ -254,7 +254,7 @@
     bool isFirst = true;
     while (message->numPackets()) {
         auto report = message->popNextPacket();
-        if (!isFirst && stagesMatch() && m_configuration.hid->error == MockHid::Error::WrongChannelId)
+        if (!isFirst && stagesMatch() && m_configuration.hid->error == Mock::HidError::WrongChannelId)
             report = FidoHidContinuationPacket(m_currentChannel - 1, 0, { }).getSerializedData();
         // Packets are feed asynchronously to mimic actual data transmission.
         RunLoop::main().dispatch([report = WTFMove(report), weakThis = makeWeakPtr(*this)]() mutable {
@@ -276,7 +276,7 @@
     if (!m_configuration.hid->continueAfterErrorData)
         return;
     m_configuration.hid->continueAfterErrorData = false;
-    m_configuration.hid->error = MockHid::Error::Success;
+    m_configuration.hid->error = Mock::HidError::Success;
     continueFeedReports();
 }
 
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h
index 378866f..40836d2 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.h
@@ -28,8 +28,8 @@
 #if ENABLE(WEB_AUTHN)
 
 #include "HidConnection.h"
-#include "MockWebAuthenticationConfiguration.h"
 #include <WebCore/FidoHidMessage.h>
+#include <WebCore/MockWebAuthenticationConfiguration.h>
 #include <wtf/WeakPtr.h>
 
 namespace WebKit {
@@ -45,7 +45,7 @@
 // According to different combinations of error and stages, error will manifest differently.
 class MockHidConnection final : public CanMakeWeakPtr<MockHidConnection>, public HidConnection {
 public:
-    MockHidConnection(IOHIDDeviceRef, const MockWebAuthenticationConfiguration&);
+    MockHidConnection(IOHIDDeviceRef, const WebCore::MockWebAuthenticationConfiguration&);
 
 private:
     void send(Vector<uint8_t>&& data, DataSentCallback&&) final;
@@ -60,10 +60,10 @@
     void shouldContinueFeedReports();
     void continueFeedReports();
 
-    MockWebAuthenticationConfiguration m_configuration;
+    WebCore::MockWebAuthenticationConfiguration m_configuration;
     Optional<fido::FidoHidMessage> m_requestMessage;
-    MockWebAuthenticationConfiguration::Hid::Stage m_stage { MockWebAuthenticationConfiguration::Hid::Stage::Info };
-    MockWebAuthenticationConfiguration::Hid::SubStage m_subStage { MockWebAuthenticationConfiguration::Hid::SubStage::Init };
+    WebCore::MockWebAuthenticationConfiguration::HidStage m_stage { MockWebAuthenticationConfiguration::HidStage::Info };
+    WebCore::MockWebAuthenticationConfiguration::HidSubStage m_subStage { MockWebAuthenticationConfiguration::HidSubStage::Init };
     uint32_t m_currentChannel { fido::kHidBroadcastChannel };
     bool m_requireResidentKey { false };
     bool m_requireUserVerification  { false };
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.cpp b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.cpp
index 24cc36b..8505f75 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.cpp
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.cpp
@@ -33,7 +33,7 @@
 
 namespace WebKit {
 
-MockHidService::MockHidService(Observer& observer, const MockWebAuthenticationConfiguration& configuration)
+MockHidService::MockHidService(Observer& observer, const WebCore::MockWebAuthenticationConfiguration& configuration)
     : HidService(observer)
     , m_configuration(configuration)
 {
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.h b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.h
index cbe015e..be1ead6 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.h
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidService.h
@@ -28,12 +28,10 @@
 #if ENABLE(WEB_AUTHN)
 
 #include "HidService.h"
-#include "MockWebAuthenticationConfiguration.h"
+#include <WebCore/MockWebAuthenticationConfiguration.h>
 
 namespace WebKit {
 
-struct MockWebAuthenticationConfiguration;
-
 class MockHidService final : public HidService {
 public:
     MockHidService(Observer&, const MockWebAuthenticationConfiguration&);
@@ -42,7 +40,7 @@
     void platformStartDiscovery() final;
     UniqueRef<HidConnection> createHidConnection(IOHIDDeviceRef) const final;
 
-    MockWebAuthenticationConfiguration m_configuration;
+    WebCore::MockWebAuthenticationConfiguration m_configuration;
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h
index 31ad71a..3559b80 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h
@@ -28,13 +28,13 @@
 #if ENABLE(WEB_AUTHN)
 
 #include "LocalConnection.h"
-#include "MockWebAuthenticationConfiguration.h"
+#include <WebCore/MockWebAuthenticationConfiguration.h>
 
 namespace WebKit {
 
 class MockLocalConnection final : public LocalConnection {
 public:
-    explicit MockLocalConnection(const MockWebAuthenticationConfiguration&);
+    explicit MockLocalConnection(const WebCore::MockWebAuthenticationConfiguration&);
 
 private:
     void getUserConsent(const String& reason, UserConsentCallback&&) const final;
@@ -42,7 +42,7 @@
     void getAttestation(const String& rpId, const String& username, const Vector<uint8_t>& hash, AttestationCallback&&) const final;
     NSDictionary *selectCredential(const NSArray *) const final;
 
-    MockWebAuthenticationConfiguration m_configuration;
+    WebCore::MockWebAuthenticationConfiguration m_configuration;
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm
index 571ecca..cdb1aa3 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm
@@ -36,7 +36,7 @@
 
 namespace WebKit {
 
-MockLocalConnection::MockLocalConnection(const MockWebAuthenticationConfiguration& configuration)
+MockLocalConnection::MockLocalConnection(const WebCore::MockWebAuthenticationConfiguration& configuration)
     : m_configuration(configuration)
 {
 }
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.h b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.h
index 7eb8f21..9169bd7 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.h
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.h
@@ -28,21 +28,19 @@
 #if ENABLE(WEB_AUTHN)
 
 #include "LocalService.h"
-#include "MockWebAuthenticationConfiguration.h"
+#include <WebCore/MockWebAuthenticationConfiguration.h>
 
 namespace WebKit {
 
-struct MockWebAuthenticationConfiguration;
-
 class MockLocalService final : public LocalService {
 public:
-    MockLocalService(Observer&, const MockWebAuthenticationConfiguration&);
+    MockLocalService(Observer&, const WebCore::MockWebAuthenticationConfiguration&);
 
 private:
     bool platformStartDiscovery() const final;
     UniqueRef<LocalConnection> createLocalConnection() const final;
 
-    MockWebAuthenticationConfiguration m_configuration;
+    WebCore::MockWebAuthenticationConfiguration m_configuration;
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.mm b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.mm
index 1eb0102..fec1927 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.mm
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.mm
@@ -33,7 +33,7 @@
 
 namespace WebKit {
 
-MockLocalService::MockLocalService(Observer& observer, const MockWebAuthenticationConfiguration& configuration)
+MockLocalService::MockLocalService(Observer& observer, const WebCore::MockWebAuthenticationConfiguration& configuration)
     : LocalService(observer)
     , m_configuration(configuration)
 {
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.h b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.h
index 132cde4..9fd1c9b 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.h
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.h
@@ -27,18 +27,16 @@
 
 #if ENABLE(WEB_AUTHN)
 
-#include "MockWebAuthenticationConfiguration.h"
 #include "NfcService.h"
+#include <WebCore/MockWebAuthenticationConfiguration.h>
 
 OBJC_CLASS NSData;
 
 namespace WebKit {
 
-struct MockWebAuthenticationConfiguration;
-
 class MockNfcService final : public NfcService {
 public:
-    MockNfcService(Observer&, const MockWebAuthenticationConfiguration&);
+    MockNfcService(Observer&, const WebCore::MockWebAuthenticationConfiguration&);
 
     NSData* transceive();
 
@@ -47,7 +45,7 @@
 
     void detectTags() const;
 
-    MockWebAuthenticationConfiguration m_configuration;
+    WebCore::MockWebAuthenticationConfiguration m_configuration;
 };
 
 } // namespace WebKit
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.mm b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.mm
index ca3de21..ca522c5 100644
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.mm
+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockNfcService.mm
@@ -108,7 +108,7 @@
 
 namespace WebKit {
 using namespace fido;
-using MockNfc = MockWebAuthenticationConfiguration::Nfc;
+using Mock = WebCore::MockWebAuthenticationConfiguration;
 
 #if HAVE(NEAR_FIELD)
 
@@ -143,7 +143,7 @@
 
 #endif // HAVE(NEAR_FIELD)
 
-MockNfcService::MockNfcService(Observer& observer, const MockWebAuthenticationConfiguration& configuration)
+MockNfcService::MockNfcService(Observer& observer, const WebCore::MockWebAuthenticationConfiguration& configuration)
     : NfcService(observer)
     , m_configuration(configuration)
 {
@@ -169,7 +169,7 @@
         method_setImplementation(methodToSwizzle1, (IMP)NFReaderSessionSetDelegate);
 
         Method methodToSwizzle2 = class_getInstanceMethod(getNFReaderSessionClass(), @selector(connectTag:));
-        if (m_configuration.nfc->error == MockNfc::Error::NoConnections)
+        if (m_configuration.nfc->error == Mock::NfcError::NoConnections)
             method_setImplementation(methodToSwizzle2, (IMP)NFReaderSessionConnectTagFail);
         else
             method_setImplementation(methodToSwizzle2, (IMP)NFReaderSessionConnectTag);
@@ -194,12 +194,12 @@
 void MockNfcService::detectTags() const
 {
 #if HAVE(NEAR_FIELD)
-    if (m_configuration.nfc->error == MockNfc::Error::NoTags)
+    if (m_configuration.nfc->error == Mock::NfcError::NoTags)
         return;
 
     auto callback = makeBlockPtr([configuration = m_configuration] {
         auto tags = adoptNS([[NSMutableArray alloc] init]);
-        if (configuration.nfc->error == MockNfc::Error::WrongTagType || configuration.nfc->multipleTags)
+        if (configuration.nfc->error == Mock::NfcError::WrongTagType || configuration.nfc->multipleTags)
             [tags addObject:adoptNS([[WKMockNFTag alloc] initWithType:NFTagTypeUnknown]).get()];
         else
             [tags addObject:adoptNS([[WKMockNFTag alloc] initWithType:NFTagTypeGeneric4A]).get()];
diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h
deleted file mode 100644
index 913e85c..0000000
--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEB_AUTHN)
-
-#include <wtf/text/WTFString.h>
-
-namespace WebKit {
-
-struct MockWebAuthenticationConfiguration {
-    struct Local {
-        bool acceptAuthentication { false };
-        bool acceptAttestation { false };
-        String privateKeyBase64;
-        String userCertificateBase64;
-        String intermediateCACertificateBase64;
-        String preferredUserhandleBase64;
-    };
-
-    struct Hid {
-        enum class Stage : bool {
-            Info,
-            Request
-        };
-
-        enum class SubStage : bool {
-            Init,
-            Msg
-        };
-
-        enum class Error : uint8_t {
-            Success,
-            DataNotSent,
-            EmptyReport,
-            WrongChannelId,
-            MaliciousPayload,
-            UnsupportedOptions,
-            WrongNonce
-        };
-
-        Vector<String> payloadBase64;
-        Stage stage { Stage::Info };
-        SubStage subStage { SubStage::Init };
-        Error error { Error::Success };
-        bool isU2f { false };
-        bool keepAlive { false };
-        bool fastDataArrival { false };
-        bool continueAfterErrorData { false };
-        bool canDowngrade { false };
-    };
-
-    struct Nfc {
-        enum class Error : uint8_t {
-            Success,
-            NoTags,
-            WrongTagType,
-            NoConnections,
-            MaliciousPayload
-        };
-
-        Error error { Error::Success };
-        Vector<String> payloadBase64;
-        bool multipleTags { false };
-    };
-
-    bool silentFailure { false };
-    Optional<Local> local;
-    Optional<Hid> hid;
-    Optional<Nfc> nfc;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(WEB_AUTHN)
diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp
index 87820d3..6a8faf9 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp
@@ -9392,6 +9392,13 @@
 }
 #endif
 
+#if ENABLE(WEB_AUTHN)
+void WebPageProxy::setMockWebAuthenticationConfiguration(MockWebAuthenticationConfiguration&& configuration)
+{
+    m_websiteDataStore->setMockWebAuthenticationConfiguration(WTFMove(configuration));
+}
+#endif
+
 } // namespace WebKit
 
 #undef MERGE_WHEEL_EVENTS
diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h
index 8c77509..b7a9af8 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.h
+++ b/Source/WebKit/UIProcess/WebPageProxy.h
@@ -213,6 +213,7 @@
 struct FileChooserSettings;
 struct GlobalWindowIdentifier;
 struct MediaStreamRequest;
+struct MockWebAuthenticationConfiguration;
 struct PrewarmInformation;
 struct SecurityOriginData;
 struct ShareData;
@@ -1587,6 +1588,10 @@
 
     void maybeInitializeSandboxExtensionHandle(WebProcessProxy&, const URL&, const URL& resourceDirectoryURL, SandboxExtension::Handle&);
 
+#if ENABLE(WEB_AUTHN)
+    void setMockWebAuthenticationConfiguration(WebCore::MockWebAuthenticationConfiguration&&);
+#endif
+
 private:
     WebPageProxy(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&);
     void platformInitialize();
diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in
index dc65276..83937d2 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in
@@ -574,4 +574,8 @@
 #if HAVE(VISIBILITY_PROPAGATION_VIEW)
     DidCreateContextForVisibilityPropagation(WebKit::LayerHostingContextID contextID);
 #endif
+
+#if ENABLE(WEB_AUTHN)
+    SetMockWebAuthenticationConfiguration(struct WebCore::MockWebAuthenticationConfiguration configuration);
+#endif
 }
diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
index 4d49091..94de9ee 100644
--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
@@ -64,6 +64,8 @@
 namespace WebCore {
 class RegistrableDomain;
 class SecurityOrigin;
+
+struct MockWebAuthenticationConfiguration;
 }
 
 namespace WebKit {
@@ -78,7 +80,6 @@
 class WebResourceLoadStatisticsStore;
 enum class WebsiteDataFetchOption;
 enum class WebsiteDataType;
-struct MockWebAuthenticationConfiguration;
 struct WebsiteDataRecord;
 struct WebsiteDataStoreParameters;
 
@@ -252,7 +253,7 @@
 
 #if ENABLE(WEB_AUTHN)
     AuthenticatorManager& authenticatorManager() { return m_authenticatorManager.get(); }
-    void setMockWebAuthenticationConfiguration(MockWebAuthenticationConfiguration&&);
+    void setMockWebAuthenticationConfiguration(WebCore::MockWebAuthenticationConfiguration&&);
 #endif
 
     void didCreateNetworkProcess();
diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
index 05a1eaa..638ebed 100644
--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -1073,7 +1073,6 @@
 		57DCEDB1214C60480016B847 /* Authenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED8B21485BD70016B847 /* Authenticator.h */; };
 		57DCEDB2214C604C0016B847 /* WebAuthenticationRequestData.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDA62149F9DA0016B847 /* WebAuthenticationRequestData.h */; };
 		57DCEDB3214C60530016B847 /* WebAuthenticatorCoordinatorProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 57608295202BD8BA00116678 /* WebAuthenticatorCoordinatorProxy.h */; };
-		57DCEDBF214F0DCF0016B847 /* MockWebAuthenticationConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDBE214CA01B0016B847 /* MockWebAuthenticationConfiguration.h */; };
 		57DCEDC3214F114C0016B847 /* MockLocalService.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC1214F114C0016B847 /* MockLocalService.h */; };
 		57DCEDC7214F18300016B847 /* MockLocalConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC5214F18300016B847 /* MockLocalConnection.h */; };
 		57DCEDCB214F4E420016B847 /* MockAuthenticatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */; };
@@ -3564,7 +3563,6 @@
 		57DCEDA7214A568B0016B847 /* LocalConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalConnection.h; sourceTree = "<group>"; };
 		57DCEDA8214A568B0016B847 /* LocalConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalConnection.mm; sourceTree = "<group>"; };
 		57DCEDAA214B9B430016B847 /* DeviceIdentitySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceIdentitySPI.h; sourceTree = "<group>"; };
-		57DCEDBE214CA01B0016B847 /* MockWebAuthenticationConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockWebAuthenticationConfiguration.h; sourceTree = "<group>"; };
 		57DCEDC1214F114C0016B847 /* MockLocalService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockLocalService.h; sourceTree = "<group>"; };
 		57DCEDC2214F114C0016B847 /* MockLocalService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MockLocalService.mm; sourceTree = "<group>"; };
 		57DCEDC5214F18300016B847 /* MockLocalConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockLocalConnection.h; sourceTree = "<group>"; };
@@ -7143,7 +7141,6 @@
 				57DCEDC2214F114C0016B847 /* MockLocalService.mm */,
 				57B8264A230603C100B72EB0 /* MockNfcService.h */,
 				57B8264B230603C100B72EB0 /* MockNfcService.mm */,
-				57DCEDBE214CA01B0016B847 /* MockWebAuthenticationConfiguration.h */,
 			);
 			path = Mock;
 			sourceTree = "<group>";
@@ -9583,7 +9580,6 @@
 				57DCEDC7214F18300016B847 /* MockLocalConnection.h in Headers */,
 				57DCEDC3214F114C0016B847 /* MockLocalService.h in Headers */,
 				57B8264C230603C100B72EB0 /* MockNfcService.h in Headers */,
-				57DCEDBF214F0DCF0016B847 /* MockWebAuthenticationConfiguration.h in Headers */,
 				C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */,
 				2D50366B1BCDE17900E20BB3 /* NativeWebGestureEvent.h in Headers */,
 				263172CF18B469490065B9C3 /* NativeWebTouchEvent.h in Headers */,
diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
index 29f2530..4e62959 100644
--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
@@ -98,6 +98,10 @@
 #include "PrinterListGtk.h"
 #endif
 
+#if ENABLE(WEB_AUTHN)
+#include <WebCore/MockWebAuthenticationConfiguration.h>
+#endif
+
 namespace WebKit {
 using namespace WebCore;
 using namespace HTMLNames;
@@ -1357,4 +1361,11 @@
     m_page.setUserIsInteracting(userIsInteracting);
 }
 
+#if ENABLE(WEB_AUTHN)
+void WebChromeClient::setMockWebAuthenticationConfiguration(const MockWebAuthenticationConfiguration& configuration)
+{
+    m_page.send(Messages::WebPageProxy::SetMockWebAuthenticationConfiguration(configuration));
+}
+#endif
+
 } // namespace WebKit
diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
index 77fe307..99918c7 100644
--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
@@ -381,6 +381,10 @@
     bool userIsInteracting() const final;
     void setUserIsInteracting(bool) final;
 
+#if ENABLE(WEB_AUTHN)
+    void setMockWebAuthenticationConfiguration(const WebCore::MockWebAuthenticationConfiguration&) final;
+#endif
+
     String m_cachedToolTip;
     mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
     mutable bool m_cachedMainFrameHasHorizontalScrollbar { false };
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 46cdeaa..b3f0883a 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,21 @@
+2019-10-09  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebAuthn] Move the mock testing entrance to Internals
+        https://bugs.webkit.org/show_bug.cgi?id=202560
+        <rdar://problem/55973793>
+
+        Reviewed by Chris Dumez.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setWebAuthenticationMockConfiguration): Deleted.
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::setWebAuthenticationMockConfiguration): Deleted.
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
 2019-10-09  Daniel Bates  <dabates@apple.com>
 
         Add support for CompactPointerTuple<..., OptionSet<...>>
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
index 8c97c7b..9570144 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
@@ -391,8 +391,7 @@
 
     void setServiceWorkerFetchTimeout(double seconds);
 
-    // WebAuthN
-    void setWebAuthenticationMockConfiguration(object configuration);
+    // WebAuthn
     void addTestKeyToKeychain(DOMString privateKeyBase64, DOMString attrLabel, DOMString applicationTagBase64);
     void cleanUpKeychain(DOMString attrLabel, optional DOMString applicationTagBase64);
     boolean keyExistsInKeychain(DOMString attrLabel, DOMString applicationTagBase64);
diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
index 5fea83d..4617ee3 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
@@ -2628,301 +2628,7 @@
     WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
 }
 
-// WebAuthN
-void TestRunner::setWebAuthenticationMockConfiguration(JSValueRef configurationValue)
-{
-    auto& injectedBundle = InjectedBundle::singleton();
-    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page());
-    JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
-    if (!JSValueIsObject(context, configurationValue))
-        return;
-    JSObjectRef configuration = JSValueToObject(context, configurationValue, 0);
-
-    Vector<WKRetainPtr<WKStringRef>> configurationKeys;
-    Vector<WKRetainPtr<WKTypeRef>> configurationValues;
-
-    JSRetainPtr<JSStringRef> silentFailurePropertyName(Adopt, JSStringCreateWithUTF8CString("silentFailure"));
-    JSValueRef silentFailureValue = JSObjectGetProperty(context, configuration, silentFailurePropertyName.get(), 0);
-    if (!JSValueIsUndefined(context, silentFailureValue)) {
-        if (!JSValueIsBoolean(context, silentFailureValue))
-            return;
-        bool silentFailure = JSValueToBoolean(context, silentFailureValue);
-        configurationKeys.append(adoptWK(WKStringCreateWithUTF8CString("SilentFailure")));
-        configurationValues.append(adoptWK(WKBooleanCreate(silentFailure)).get());
-    }
-
-    JSRetainPtr<JSStringRef> localPropertyName(Adopt, JSStringCreateWithUTF8CString("local"));
-    JSValueRef localValue = JSObjectGetProperty(context, configuration, localPropertyName.get(), 0);
-    if (!JSValueIsUndefined(context, localValue) && !JSValueIsNull(context, localValue)) {
-        if (!JSValueIsObject(context, localValue))
-            return;
-        JSObjectRef local = JSValueToObject(context, localValue, 0);
-
-        JSRetainPtr<JSStringRef> acceptAuthenticationPropertyName(Adopt, JSStringCreateWithUTF8CString("acceptAuthentication"));
-        JSValueRef acceptAuthenticationValue = JSObjectGetProperty(context, local, acceptAuthenticationPropertyName.get(), 0);
-        if (!JSValueIsBoolean(context, acceptAuthenticationValue))
-            return;
-        bool acceptAuthentication = JSValueToBoolean(context, acceptAuthenticationValue);
-
-        JSRetainPtr<JSStringRef> acceptAttestationPropertyName(Adopt, JSStringCreateWithUTF8CString("acceptAttestation"));
-        JSValueRef acceptAttestationValue = JSObjectGetProperty(context, local, acceptAttestationPropertyName.get(), 0);
-        if (!JSValueIsBoolean(context, acceptAttestationValue))
-            return;
-        bool acceptAttestation = JSValueToBoolean(context, acceptAttestationValue);
-
-        Vector<WKRetainPtr<WKStringRef>> localKeys;
-        Vector<WKRetainPtr<WKTypeRef>> localValues;
-        localKeys.append(adoptWK(WKStringCreateWithUTF8CString("AcceptAuthentication")));
-        localValues.append(adoptWK(WKBooleanCreate(acceptAuthentication)).get());
-        localKeys.append(adoptWK(WKStringCreateWithUTF8CString("AcceptAttestation")));
-        localValues.append(adoptWK(WKBooleanCreate(acceptAttestation)).get());
-
-        if (acceptAttestation) {
-            JSRetainPtr<JSStringRef> privateKeyBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("privateKeyBase64"));
-            JSValueRef privateKeyBase64Value = JSObjectGetProperty(context, local, privateKeyBase64PropertyName.get(), 0);
-            if (!JSValueIsString(context, privateKeyBase64Value))
-                return;
-
-            JSRetainPtr<JSStringRef> userCertificateBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("userCertificateBase64"));
-            JSValueRef userCertificateBase64Value = JSObjectGetProperty(context, local, userCertificateBase64PropertyName.get(), 0);
-            if (!JSValueIsString(context, userCertificateBase64Value))
-                return;
-
-            JSRetainPtr<JSStringRef> intermediateCACertificateBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("intermediateCACertificateBase64"));
-            JSValueRef intermediateCACertificateBase64Value = JSObjectGetProperty(context, local, intermediateCACertificateBase64PropertyName.get(), 0);
-            if (!JSValueIsString(context, intermediateCACertificateBase64Value))
-                return;
-
-            localKeys.append(adoptWK(WKStringCreateWithUTF8CString("PrivateKeyBase64")));
-            localValues.append(toWK(adopt(JSValueToStringCopy(context, privateKeyBase64Value, 0)).get()));
-            localKeys.append(adoptWK(WKStringCreateWithUTF8CString("UserCertificateBase64")));
-            localValues.append(toWK(adopt(JSValueToStringCopy(context, userCertificateBase64Value, 0)).get()));
-            localKeys.append(adoptWK(WKStringCreateWithUTF8CString("IntermediateCACertificateBase64")));
-            localValues.append(toWK(adopt(JSValueToStringCopy(context, intermediateCACertificateBase64Value, 0)).get()));
-        }
-
-        JSRetainPtr<JSStringRef> preferredUserhandleBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("preferredUserhandleBase64"));
-        JSValueRef preferredUserhandleBase64Value = JSObjectGetProperty(context, local, preferredUserhandleBase64PropertyName.get(), 0);
-        if (!JSValueIsUndefined(context, preferredUserhandleBase64Value) && !JSValueIsNull(context, preferredUserhandleBase64Value)) {
-            if (!JSValueIsString(context, preferredUserhandleBase64Value))
-                return;
-
-            localKeys.append(adoptWK(WKStringCreateWithUTF8CString("PreferredUserhandleBase64")));
-            localValues.append(toWK(adopt(JSValueToStringCopy(context, preferredUserhandleBase64Value, 0)).get()));
-        }
-
-        Vector<WKStringRef> rawLocalKeys;
-        Vector<WKTypeRef> rawLocalValues;
-        rawLocalKeys.resize(localKeys.size());
-        rawLocalValues.resize(localValues.size());
-        for (size_t i = 0; i < localKeys.size(); ++i) {
-            rawLocalKeys[i] = localKeys[i].get();
-            rawLocalValues[i] = localValues[i].get();
-        }
-
-        configurationKeys.append(adoptWK(WKStringCreateWithUTF8CString("Local")));
-        configurationValues.append(adoptWK(WKDictionaryCreate(rawLocalKeys.data(), rawLocalValues.data(), rawLocalKeys.size())));
-    }
-
-    JSRetainPtr<JSStringRef> hidPropertyName(Adopt, JSStringCreateWithUTF8CString("hid"));
-    JSValueRef hidValue = JSObjectGetProperty(context, configuration, hidPropertyName.get(), 0);
-    if (!JSValueIsUndefined(context, hidValue) && !JSValueIsNull(context, hidValue)) {
-        if (!JSValueIsObject(context, hidValue))
-            return;
-        JSObjectRef hid = JSValueToObject(context, hidValue, 0);
-
-        JSRetainPtr<JSStringRef> stagePropertyName(Adopt, JSStringCreateWithUTF8CString("stage"));
-        JSValueRef stageValue = JSObjectGetProperty(context, hid, stagePropertyName.get(), 0);
-        if (!JSValueIsString(context, stageValue))
-            return;
-
-        JSRetainPtr<JSStringRef> subStagePropertyName(Adopt, JSStringCreateWithUTF8CString("subStage"));
-        JSValueRef subStageValue = JSObjectGetProperty(context, hid, subStagePropertyName.get(), 0);
-        if (!JSValueIsString(context, subStageValue))
-            return;
-
-        JSRetainPtr<JSStringRef> errorPropertyName(Adopt, JSStringCreateWithUTF8CString("error"));
-        JSValueRef errorValue = JSObjectGetProperty(context, hid, errorPropertyName.get(), 0);
-        if (!JSValueIsString(context, errorValue))
-            return;
-
-        Vector<WKRetainPtr<WKStringRef>> hidKeys;
-        Vector<WKRetainPtr<WKTypeRef>> hidValues;
-        hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("Stage")));
-        hidValues.append(toWK(adopt(JSValueToStringCopy(context, stageValue, 0)).get()));
-        hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("SubStage")));
-        hidValues.append(toWK(adopt(JSValueToStringCopy(context, subStageValue, 0)).get()));
-        hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("Error")));
-        hidValues.append(toWK(adopt(JSValueToStringCopy(context, errorValue, 0)).get()));
-
-        JSRetainPtr<JSStringRef> payloadBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("payloadBase64"));
-        JSValueRef payloadBase64Value = JSObjectGetProperty(context, hid, payloadBase64PropertyName.get(), 0);
-        if (!JSValueIsUndefined(context, payloadBase64Value) && !JSValueIsNull(context, payloadBase64Value)) {
-            if (!JSValueIsArray(context, payloadBase64Value))
-                return;
-
-            JSObjectRef payloadBase64 = JSValueToObject(context, payloadBase64Value, nullptr);
-            static auto lengthProperty = adopt(JSStringCreateWithUTF8CString("length"));
-            JSValueRef payloadBase64LengthValue = JSObjectGetProperty(context, payloadBase64, lengthProperty.get(), nullptr);
-            if (!JSValueIsNumber(context, payloadBase64LengthValue))
-                return;
-
-            auto payloadBase64s = adoptWK(WKMutableArrayCreate());
-            auto payloadBase64Length = static_cast<size_t>(JSValueToNumber(context, payloadBase64LengthValue, nullptr));
-            for (size_t i = 0; i < payloadBase64Length; ++i) {
-                JSValueRef payloadBase64Value = JSObjectGetPropertyAtIndex(context, payloadBase64, i, nullptr);
-                if (!JSValueIsString(context, payloadBase64Value))
-                    continue;
-                WKArrayAppendItem(payloadBase64s.get(), toWK(adopt(JSValueToStringCopy(context, payloadBase64Value, 0)).get()).get());
-            }
-
-            hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("PayloadBase64")));
-            hidValues.append(payloadBase64s);
-        }
-
-        JSRetainPtr<JSStringRef> isU2fPropertyName(Adopt, JSStringCreateWithUTF8CString("isU2f"));
-        JSValueRef isU2fValue = JSObjectGetProperty(context, hid, isU2fPropertyName.get(), 0);
-        if (!JSValueIsUndefined(context, isU2fValue) && !JSValueIsNull(context, isU2fValue)) {
-            if (!JSValueIsBoolean(context, isU2fValue))
-                return;
-            bool isU2f = JSValueToBoolean(context, isU2fValue);
-            hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("IsU2f")));
-            hidValues.append(adoptWK(WKBooleanCreate(isU2f)).get());
-        }
-
-        JSRetainPtr<JSStringRef> keepAlivePropertyName(Adopt, JSStringCreateWithUTF8CString("keepAlive"));
-        JSValueRef keepAliveValue = JSObjectGetProperty(context, hid, keepAlivePropertyName.get(), 0);
-        if (!JSValueIsUndefined(context, keepAliveValue) && !JSValueIsNull(context, keepAliveValue)) {
-            if (!JSValueIsBoolean(context, keepAliveValue))
-                return;
-            bool keepAlive = JSValueToBoolean(context, keepAliveValue);
-            hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("KeepAlive")));
-            hidValues.append(adoptWK(WKBooleanCreate(keepAlive)).get());
-        }
-
-        JSRetainPtr<JSStringRef> fastDataArrivalPropertyName(Adopt, JSStringCreateWithUTF8CString("fastDataArrival"));
-        JSValueRef fastDataArrivalValue = JSObjectGetProperty(context, hid, fastDataArrivalPropertyName.get(), 0);
-        if (!JSValueIsUndefined(context, fastDataArrivalValue) && !JSValueIsNull(context, fastDataArrivalValue)) {
-            if (!JSValueIsBoolean(context, fastDataArrivalValue))
-                return;
-            bool fastDataArrival = JSValueToBoolean(context, fastDataArrivalValue);
-            hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("FastDataArrival")));
-            hidValues.append(adoptWK(WKBooleanCreate(fastDataArrival)).get());
-        }
-
-        JSRetainPtr<JSStringRef> continueAfterErrorDataPropertyName(Adopt, JSStringCreateWithUTF8CString("continueAfterErrorData"));
-        JSValueRef continueAfterErrorDataValue = JSObjectGetProperty(context, hid, continueAfterErrorDataPropertyName.get(), 0);
-        if (!JSValueIsUndefined(context, continueAfterErrorDataValue) && !JSValueIsNull(context, continueAfterErrorDataValue)) {
-            if (!JSValueIsBoolean(context, continueAfterErrorDataValue))
-                return;
-            bool continueAfterErrorData = JSValueToBoolean(context, continueAfterErrorDataValue);
-            hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("ContinueAfterErrorData")));
-            hidValues.append(adoptWK(WKBooleanCreate(continueAfterErrorData)).get());
-        }
-
-        JSRetainPtr<JSStringRef> canDowngradePropertyName(Adopt, JSStringCreateWithUTF8CString("canDowngrade"));
-        JSValueRef canDowngradeValue = JSObjectGetProperty(context, hid, canDowngradePropertyName.get(), 0);
-        if (!JSValueIsUndefined(context, canDowngradeValue) && !JSValueIsNull(context, canDowngradeValue)) {
-            if (!JSValueIsBoolean(context, canDowngradeValue))
-                return;
-            bool canDowngrade = JSValueToBoolean(context, canDowngradeValue);
-            hidKeys.append(adoptWK(WKStringCreateWithUTF8CString("CanDowngrade")));
-            hidValues.append(adoptWK(WKBooleanCreate(canDowngrade)).get());
-        }
-
-        Vector<WKStringRef> rawHidKeys;
-        Vector<WKTypeRef> rawHidValues;
-        rawHidKeys.resize(hidKeys.size());
-        rawHidValues.resize(hidValues.size());
-        for (size_t i = 0; i < hidKeys.size(); ++i) {
-            rawHidKeys[i] = hidKeys[i].get();
-            rawHidValues[i] = hidValues[i].get();
-        }
-
-        configurationKeys.append(adoptWK(WKStringCreateWithUTF8CString("Hid")));
-        configurationValues.append(adoptWK(WKDictionaryCreate(rawHidKeys.data(), rawHidValues.data(), rawHidKeys.size())));
-    }
-
-    JSRetainPtr<JSStringRef> nfcPropertyName(Adopt, JSStringCreateWithUTF8CString("nfc"));
-    JSValueRef nfcValue = JSObjectGetProperty(context, configuration, nfcPropertyName.get(), 0);
-    if (!JSValueIsUndefined(context, nfcValue) && !JSValueIsNull(context, nfcValue)) {
-        if (!JSValueIsObject(context, nfcValue))
-            return;
-        JSObjectRef nfc = JSValueToObject(context, nfcValue, 0);
-
-        JSRetainPtr<JSStringRef> errorPropertyName(Adopt, JSStringCreateWithUTF8CString("error"));
-        JSValueRef errorValue = JSObjectGetProperty(context, nfc, errorPropertyName.get(), 0);
-        if (!JSValueIsString(context, errorValue))
-            return;
-
-        Vector<WKRetainPtr<WKStringRef>> nfcKeys;
-        Vector<WKRetainPtr<WKTypeRef>> nfcValues;
-        nfcKeys.append(adoptWK(WKStringCreateWithUTF8CString("Error")));
-        nfcValues.append(toWK(adopt(JSValueToStringCopy(context, errorValue, 0)).get()));
-
-        JSRetainPtr<JSStringRef> payloadBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("payloadBase64"));
-        JSValueRef payloadBase64Value = JSObjectGetProperty(context, nfc, payloadBase64PropertyName.get(), 0);
-        if (!JSValueIsUndefined(context, payloadBase64Value) && !JSValueIsNull(context, payloadBase64Value)) {
-            if (!JSValueIsArray(context, payloadBase64Value))
-                return;
-
-            JSObjectRef payloadBase64 = JSValueToObject(context, payloadBase64Value, nullptr);
-            static auto lengthProperty = adopt(JSStringCreateWithUTF8CString("length"));
-            JSValueRef payloadBase64LengthValue = JSObjectGetProperty(context, payloadBase64, lengthProperty.get(), nullptr);
-            if (!JSValueIsNumber(context, payloadBase64LengthValue))
-                return;
-
-            auto payloadBase64s = adoptWK(WKMutableArrayCreate());
-            auto payloadBase64Length = static_cast<size_t>(JSValueToNumber(context, payloadBase64LengthValue, nullptr));
-            for (size_t i = 0; i < payloadBase64Length; ++i) {
-                JSValueRef payloadBase64Value = JSObjectGetPropertyAtIndex(context, payloadBase64, i, nullptr);
-                if (!JSValueIsString(context, payloadBase64Value))
-                    continue;
-                WKArrayAppendItem(payloadBase64s.get(), toWK(adopt(JSValueToStringCopy(context, payloadBase64Value, 0)).get()).get());
-            }
-
-            nfcKeys.append(adoptWK(WKStringCreateWithUTF8CString("PayloadBase64")));
-            nfcValues.append(payloadBase64s);
-        }
-
-        JSRetainPtr<JSStringRef> multipleTagsPropertyName(Adopt, JSStringCreateWithUTF8CString("multipleTags"));
-        JSValueRef multipleTagsValue = JSObjectGetProperty(context, nfc, multipleTagsPropertyName.get(), 0);
-        if (!JSValueIsUndefined(context, multipleTagsValue) && !JSValueIsNull(context, multipleTagsValue)) {
-            if (!JSValueIsBoolean(context, multipleTagsValue))
-                return;
-            bool multipleTags = JSValueToBoolean(context, multipleTagsValue);
-            nfcKeys.append(adoptWK(WKStringCreateWithUTF8CString("MultipleTags")));
-            nfcValues.append(adoptWK(WKBooleanCreate(multipleTags)).get());
-        }
-
-        Vector<WKStringRef> rawNfcKeys;
-        Vector<WKTypeRef> rawNfcValues;
-        rawNfcKeys.resize(nfcKeys.size());
-        rawNfcValues.resize(nfcValues.size());
-        for (size_t i = 0; i < nfcKeys.size(); ++i) {
-            rawNfcKeys[i] = nfcKeys[i].get();
-            rawNfcValues[i] = nfcValues[i].get();
-        }
-
-        configurationKeys.append(adoptWK(WKStringCreateWithUTF8CString("Nfc")));
-        configurationValues.append(adoptWK(WKDictionaryCreate(rawNfcKeys.data(), rawNfcValues.data(), rawNfcKeys.size())));
-    }
-
-    Vector<WKStringRef> rawConfigurationKeys;
-    Vector<WKTypeRef> rawConfigurationValues;
-    rawConfigurationKeys.resize(configurationKeys.size());
-    rawConfigurationValues.resize(configurationValues.size());
-    for (size_t i = 0; i < configurationKeys.size(); ++i) {
-        rawConfigurationKeys[i] = configurationKeys[i].get();
-        rawConfigurationValues[i] = configurationValues[i].get();
-    }
-
-    WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetWebAuthenticationMockConfiguration"));
-    WKRetainPtr<WKDictionaryRef> messageBody = adoptWK(WKDictionaryCreate(rawConfigurationKeys.data(), rawConfigurationValues.data(), rawConfigurationKeys.size()));
-    
-    WKBundlePostSynchronousMessage(injectedBundle.bundle(), messageName.get(), messageBody.get(), nullptr);
-}
-
+// WebAuthn
 void TestRunner::addTestKeyToKeychain(JSStringRef privateKeyBase64, JSStringRef attrLabel, JSStringRef applicationTagBase64)
 {
     Vector<WKRetainPtr<WKStringRef>> keys;
diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
index 5f23a80..6271d52 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
@@ -490,9 +490,7 @@
     void sendDisplayConfigurationChangedMessageForTesting();
 
     void setServiceWorkerFetchTimeout(double seconds);
-    
-    // WebAuthN
-    void setWebAuthenticationMockConfiguration(JSValueRef);
+
     // FIXME(189876)
     void addTestKeyToKeychain(JSStringRef privateKeyBase64, JSStringRef attrLabel, JSStringRef applicationTagBase64);
     void cleanUpKeychain(JSStringRef attrLabel, JSStringRef applicationTagBase64);
diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp
index ecd7d9b8..657b79b 100644
--- a/Tools/WebKitTestRunner/TestController.cpp
+++ b/Tools/WebKitTestRunner/TestController.cpp
@@ -3621,11 +3621,6 @@
     WKContextSetServiceWorkerFetchTimeoutForTesting(platformContext(), seconds);
 }
 
-void TestController::setWebAuthenticationMockConfiguration(WKDictionaryRef configuration)
-{
-    WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(TestController::websiteDataStore(), configuration);
-}
-
 struct AdClickAttributionStringResultCallbackContext {
     explicit AdClickAttributionStringResultCallbackContext(TestController& controller)
         : testController(controller)
diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h
index 530b334..4bf9023 100644
--- a/Tools/WebKitTestRunner/TestController.h
+++ b/Tools/WebKitTestRunner/TestController.h
@@ -296,7 +296,6 @@
 
     void setServiceWorkerFetchTimeoutForTesting(double seconds);
 
-    void setWebAuthenticationMockConfiguration(WKDictionaryRef);
     void addTestKeyToKeychain(const String& privateKeyBase64, const String& attrLabel, const String& applicationTagBase64);
     void cleanUpKeychain(const String& attrLabel, const String& applicationTagBase64);
     bool keyExistsInKeychain(const String& attrLabel, const String& applicationTagBase64);
diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp
index ae8d594..a8f9a79 100644
--- a/Tools/WebKitTestRunner/TestInvocation.cpp
+++ b/Tools/WebKitTestRunner/TestInvocation.cpp
@@ -1630,12 +1630,6 @@
         return nullptr;
     }
 
-    if (WKStringIsEqualToUTF8CString(messageName, "SetWebAuthenticationMockConfiguration")) {
-        ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
-        TestController::singleton().setWebAuthenticationMockConfiguration(static_cast<WKDictionaryRef>(messageBody));
-        return nullptr;
-    }
-
     if (WKStringIsEqualToUTF8CString(messageName, "AddTestKeyToKeychain")) {
         ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
         WKDictionaryRef testKeyDictionary = static_cast<WKDictionaryRef>(messageBody);