[WebAuthN] Polish WebAuthN auto-test environment
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Sep 2018 00:02:39 +0000 (00:02 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Sep 2018 00:02:39 +0000 (00:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189283
<rdar://problem/44117828>

Reviewed by Chris Dumez.

Source/WebCore:

This patch removes the old mocking mechanism.

Tests: http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html
       http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html
       http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html

* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* testing/Internals.cpp:
(WebCore::Internals::Internals):
(WebCore::Internals::mockAuthenticatorCoordinator const): Deleted.
* testing/Internals.h:
* testing/Internals.idl:
* testing/MockAuthenticatorCoordinator.cpp: Removed.
* testing/MockAuthenticatorCoordinator.h: Removed.
* testing/MockAuthenticatorCoordinator.idl: Removed.

Source/WebKit:

This patch changes MockWebAuthenticationConfiguration.local to optional such that tests can express
absence of local authenticators.

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
* UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
(WebKit::MockLocalConnection::getUserConsent const):
(WebKit::MockLocalConnection::getAttestation const):
* UIProcess/WebAuthentication/Mock/MockLocalService.cpp:
(WebKit::MockLocalService::platformStartDiscovery const):
* UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:

Tools:

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setWebAuthenticationMockConfiguration):

LayoutTests:

This patch does the following few things:
1. Update tests that employ old mocking mechnism to the new one.
2. Move tests from http/tests/webauthn to http/wpt/webauthn. As a result, we have one unified place for
all WebAuthN tests: http/wpt/webauthn.
3. Add a helper function to check DOMException message as well.

* TestExpectations:
* http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt: Removed.
* http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt: Removed.
* http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https-expected.txt: Removed.
* http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html: Removed.
* http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt: Removed.
* http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html: Removed.
* http/tests/webauthn/resources/last-layer-frame.https.html: Removed.
* http/tests/webauthn/resources/util.js: Removed.
* http/wpt/credential-management/credentialscontainer-store-basics.https.html:
* http/wpt/webauthn/idl.https.html:
* http/wpt/webauthn/public-key-credential-create-failure-local.https.html:
* http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt:
* http/wpt/webauthn/public-key-credential-create-failure.https.html:
* http/wpt/webauthn/public-key-credential-create-success.https-expected.txt: Removed.
* http/wpt/webauthn/public-key-credential-create-success.https.html: Removed.
* http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html: Renamed from LayoutTests/http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html.
* http/wpt/webauthn/public-key-credential-get-failure-local.https.html:
* http/wpt/webauthn/public-key-credential-get-failure.https-expected.txt:
* http/wpt/webauthn/public-key-credential-get-failure.https.html:
* http/wpt/webauthn/public-key-credential-get-success.https-expected.txt: Removed.
* http/wpt/webauthn/public-key-credential-get-success.https.html: Removed.
* http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html: Renamed from LayoutTests/http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https.html.
* http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html: Added.
* http/wpt/webauthn/resources/last-layer-frame.https.html: Added.
* http/wpt/webauthn/resources/second-layer-frame.https.html: Renamed from LayoutTests/http/tests/webauthn/resources/second-layer-frame.https.html.
* http/wpt/webauthn/resources/util.js:
* platform/gtk/TestExpectations:
* platform/ios-wk1/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:
* platform/wpe/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236625 268f45cc-cd09-0410-ab3c-d52691b4dbfc

54 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt [deleted file]
LayoutTests/http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt [deleted file]
LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https-expected.txt [deleted file]
LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html [deleted file]
LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt [deleted file]
LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html [deleted file]
LayoutTests/http/tests/webauthn/resources/last-layer-frame.https.html [deleted file]
LayoutTests/http/tests/webauthn/resources/util.js [deleted file]
LayoutTests/http/wpt/credential-management/credentialscontainer-store-basics.https.html
LayoutTests/http/wpt/webauthn/idl.https.html
LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-local.https.html
LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt
LayoutTests/http/wpt/webauthn/public-key-credential-create-failure.https.html
LayoutTests/http/wpt/webauthn/public-key-credential-create-success.https-expected.txt [deleted file]
LayoutTests/http/wpt/webauthn/public-key-credential-create-success.https.html [deleted file]
LayoutTests/http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html [moved from LayoutTests/http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html with 91% similarity]
LayoutTests/http/wpt/webauthn/public-key-credential-get-failure-local.https.html
LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https-expected.txt
LayoutTests/http/wpt/webauthn/public-key-credential-get-failure.https.html
LayoutTests/http/wpt/webauthn/public-key-credential-get-success.https-expected.txt [deleted file]
LayoutTests/http/wpt/webauthn/public-key-credential-get-success.https.html [deleted file]
LayoutTests/http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html [moved from LayoutTests/http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https.html with 82% similarity]
LayoutTests/http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/resources/last-layer-frame.https.html [new file with mode: 0644]
LayoutTests/http/wpt/webauthn/resources/second-layer-frame.https.html [moved from LayoutTests/http/tests/webauthn/resources/second-layer-frame.https.html with 100% similarity]
LayoutTests/http/wpt/webauthn/resources/util.js
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios-wk1/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/mac-wk2/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
LayoutTests/platform/wpe/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/testing/MockAuthenticatorCoordinator.cpp [deleted file]
Source/WebCore/testing/MockAuthenticatorCoordinator.h [deleted file]
Source/WebCore/testing/MockAuthenticatorCoordinator.idl [deleted file]
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.mm
Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp
Source/WebKit/UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

index cbff444..367aa85 100644 (file)
@@ -1,3 +1,55 @@
+2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebAuthN] Polish WebAuthN auto-test environment
+        https://bugs.webkit.org/show_bug.cgi?id=189283
+        <rdar://problem/44117828>
+
+        Reviewed by Chris Dumez.
+
+        This patch does the following few things:
+        1. Update tests that employ old mocking mechnism to the new one.
+        2. Move tests from http/tests/webauthn to http/wpt/webauthn. As a result, we have one unified place for
+        all WebAuthN tests: http/wpt/webauthn.
+        3. Add a helper function to check DOMException message as well.
+
+        * TestExpectations:
+        * http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt: Removed.
+        * http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt: Removed.
+        * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https-expected.txt: Removed.
+        * http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html: Removed.
+        * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt: Removed.
+        * http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html: Removed.
+        * http/tests/webauthn/resources/last-layer-frame.https.html: Removed.
+        * http/tests/webauthn/resources/util.js: Removed.
+        * http/wpt/credential-management/credentialscontainer-store-basics.https.html:
+        * http/wpt/webauthn/idl.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure-local.https.html:
+        * http/wpt/webauthn/public-key-credential-create-failure.https-expected.txt:
+        * http/wpt/webauthn/public-key-credential-create-failure.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success.https-expected.txt: Removed.
+        * http/wpt/webauthn/public-key-credential-create-success.https.html: Removed.
+        * http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt: Added.
+        * http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html: Renamed from LayoutTests/http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https.html.
+        * http/wpt/webauthn/public-key-credential-get-failure-local.https.html:
+        * http/wpt/webauthn/public-key-credential-get-failure.https-expected.txt:
+        * http/wpt/webauthn/public-key-credential-get-failure.https.html:
+        * http/wpt/webauthn/public-key-credential-get-success.https-expected.txt: Removed.
+        * http/wpt/webauthn/public-key-credential-get-success.https.html: Removed.
+        * http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt: Added.
+        * http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html: Renamed from LayoutTests/http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https.html.
+        * http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt: Added.
+        * http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html: Added.
+        * http/wpt/webauthn/resources/last-layer-frame.https.html: Added.
+        * http/wpt/webauthn/resources/second-layer-frame.https.html: Renamed from LayoutTests/http/tests/webauthn/resources/second-layer-frame.https.html.
+        * http/wpt/webauthn/resources/util.js:
+        * platform/gtk/TestExpectations:
+        * platform/ios-wk1/TestExpectations:
+        * platform/mac-wk1/TestExpectations:
+        * platform/mac-wk2/TestExpectations:
+        * platform/win/TestExpectations:
+        * platform/wincairo/TestExpectations:
+        * platform/wpe/TestExpectations:
+
 2018-09-28  Jer Noble  <jer.noble@apple.com>
 
         Refactoring: eliminate raw pointer usage in Fullscreen code
index 8233eee..f775cb1 100644 (file)
@@ -2875,14 +2875,6 @@ fast/gradients/conic-two-hints.html [ Skip ]
 
 webkit.org/b/187773 http/tests/webAPIStatistics [ Skip ]
 
-# Temporary disables old WebAuthN tests, will either reenable or remove them in webkit.org/b/189283
-http/wpt/credential-management/credentialscontainer-store-basics.https.html [ Skip ]
-http/wpt/webauthn/public-key-credential-create-failure.https.html [ Skip ]
-http/wpt/webauthn/public-key-credential-create-success.https.html [ Skip ]
-http/wpt/webauthn/public-key-credential-get-failure.https.html [ Skip ]
-http/wpt/webauthn/public-key-credential-get-success.https.html [ Skip ]
-http/wpt/webauthn/idl.https.html [ Skip ]
-
 webkit.org/b/189997 imported/w3c/web-platform-tests/resource-timing/resource_timing.worker.html [ Failure ]
 
 # This is fallout from turning Web Animations on.
diff --git a/LayoutTests/http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt b/LayoutTests/http/tests/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt
deleted file mode 100644 (file)
index 6ce1dfb..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-Tests that PublicKeyCredential's [[create]] throws TypeError when invalid options are passed.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialCreationOptions.rp is required and must be an instance of PublicKeyCredentialRpEntity.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialCreationOptions.user is required and must be an instance of PublicKeyCredentialUserEntity.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialCreationOptions.challenge is required and must be an instance of (ArrayBufferView or ArrayBuffer).
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialCreationOptions.pubKeyCredParams is required and must be an instance of sequence.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialRpEntity.name is required and must be an instance of DOMString.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialUserEntity.name is required and must be an instance of DOMString.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialUserEntity.id is required and must be an instance of (ArrayBufferView or ArrayBuffer).
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialUserEntity.displayName is required and must be an instance of DOMString.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialParameters.type is required and must be an instance of PublicKeyCredentialType.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialParameters.alg is required and must be an instance of long.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialDescriptor.type is required and must be an instance of PublicKeyCredentialType.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialDescriptor.id is required and must be an instance of (ArrayBufferView or ArrayBuffer).
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a number.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a number.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.create(invalidOptions) rejected promise  with TypeError: Type error.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt b/LayoutTests/http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt
deleted file mode 100644 (file)
index 3cc8676..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-Tests that PublicKeyCredential's [[get]] throws TypeError when invalid options are passed.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialRequestOptions.challenge is required and must be an instance of (ArrayBufferView or ArrayBuffer).
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialDescriptor.type is required and must be an instance of PublicKeyCredentialType.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Member PublicKeyCredentialDescriptor.id is required and must be an instance of (ArrayBufferView or ArrayBuffer).
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a number.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Cannot convert a symbol to a string.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS navigator.credentials.get(invalidOptions) rejected promise  with TypeError: Type error.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https-expected.txt b/LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https-expected.txt
deleted file mode 100644 (file)
index 3334c4d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-Tests that a frame that doesn't share the same origin with all its ancestors could not access the API.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS Throw NotAllowedError for both PublicKeyCredential's [[create]] and [[get]].
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html b/LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors-2.https.html
deleted file mode 100644 (file)
index c9011a9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <script src="/js-test-resources/js-test.js"></script>
-    <script src="./resources/util.js"></script>
-    <script>
-        description("Tests that a frame that doesn't share the same origin with all its ancestors could not access the API.");
-        jsTestIsAsync = true;
-
-        window.addEventListener("message", receiveMessage, false);
-    </script>
-</head>
-<body>
-    <iframe src="https://localhost:8443/webauthn/resources/last-layer-frame.https.html"></iframe>
-</body>
-</html>
diff --git a/LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt b/LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt
deleted file mode 100644 (file)
index 3334c4d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-Tests that a frame that doesn't share the same origin with all its ancestors could not access the API.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS Throw NotAllowedError for both PublicKeyCredential's [[create]] and [[get]].
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html b/LayoutTests/http/tests/webauthn/public-key-credential-same-origin-with-ancestors.https.html
deleted file mode 100644 (file)
index b8c95cf..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <script src="/js-test-resources/js-test.js"></script>
-    <script src="./resources/util.js"></script>
-    <script>
-        description("Tests that a frame that doesn't share the same origin with all its ancestors could not access the API.");
-        jsTestIsAsync = true;
-
-        window.addEventListener("message", receiveMessage, false);
-    </script>
-</head>
-<body>
-    <iframe src="https://localhost:8443/webauthn/resources/second-layer-frame.https.html"></iframe>
-</body>
-</html>
diff --git a/LayoutTests/http/tests/webauthn/resources/last-layer-frame.https.html b/LayoutTests/http/tests/webauthn/resources/last-layer-frame.https.html
deleted file mode 100644 (file)
index 6d26e57..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<html>
-<head>
-    <script src="/js-test-resources/js-test.js"></script>
-    <script src="util.js"></script>
-    <script>
-    function messageToTop(messagePrefix) {
-        top.postMessage(messagePrefix, "https://127.0.0.1:8443");
-    }
-
-    const makeOptions = {
-        publicKey: {
-            rp: {
-                name: "example.com"
-            },
-            user: {
-                name: "John Appleseed",
-                id: asciiToUint8Array("123456"),
-                displayName: "Appleseed",
-            },
-            challenge: asciiToUint8Array("123456"),
-            pubKeyCredParams: [{ type: "public-key", alg: -7 }]
-        }
-    };
-    const requestOptions = {
-        publicKey: {
-            challenge: asciiToUint8Array("123456"),
-        }
-    };
-
-    navigator.credentials.create(makeOptions).then(
-        function(value) {
-            messageToTop("Access granted. " + value);
-        },
-        function(exception) {
-            if (exception.name == "NotAllowedError")
-                return navigator.credentials.get(requestOptions)
-            else
-                messageToTop("Throw " + exception.name  + ".");
-        }
-    ).then(function(value) {
-            messageToTop("Access granted. " + value);
-        },
-        function(exception) {
-            if (exception.name == "NotAllowedError")
-                messageToTop("PASS Throw NotAllowedError for both PublicKeyCredential's [[create]] and [[get]].");
-            else
-                messageToTop("Throw " + exception.name  + ".");
-    });
-    </script>
-</head>
-</html>
diff --git a/LayoutTests/http/tests/webauthn/resources/util.js b/LayoutTests/http/tests/webauthn/resources/util.js
deleted file mode 100644 (file)
index 27b6f4e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-function receiveMessage(event) {
-    if (event.origin === "https://localhost:8443") {
-        if (event.data.indexOf("PASS ") !== -1)
-            testPassed(event.data.replace("PASS ", ""));
-        else
-            testFailed(event.data);
-    } else
-        testFailed("Received a message from an unexpected origin: " + event.origin);
-    finishJSTest();
-}
-
-function asciiToUint8Array(str)
-{
-    const chars = [];
-    for (var i = 0; i < str.length; ++i)
-        chars.push(str.charCodeAt(i));
-    return new Uint8Array(chars);
-}
index 2369135..c5df029 100644 (file)
@@ -3,6 +3,11 @@
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
+    const testES256PrivateKeyBase64 =
+        "BDj/zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF/Qm1749VBJPgqUIwfhWHJ91nb7U" +
+        "PH76c0+WFOzZKslPyyFse4goGIW2R7k9VHLPEZl5nfnBgEVFh5zev+/xpHQIvuq6" +
+        "RQ==";
+    const testRpId = "localhost";
     function asciiToUint8Array(str)
     {
         var chars = [];
             }
         };
         // A mock attestation object
-        internals.mockAuthenticatorCoordinator.setCreationReturnBundle(hexStringToUint8Array('00'), hexStringToUint8Array('01'));
+        if (window.testRunner)
+            testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: true, privateKeyBase64: testES256PrivateKeyBase64 } });
         const credential = await navigator.credentials.create(options);
 
         return promise_rejects(t, "NotSupportedError",
-            navigator.credentials.store(credential));
+            navigator.credentials.store(credential)).then(() => {
+                if (window.testRunner)
+                    testRunner.cleanUpKeychain(testRpId);
+        });
     }, "navigator.credentials.store().");
 </script>
index 4cf8caf..ab41829 100644 (file)
@@ -19,6 +19,9 @@
 <div id='log'></div>
 
 <script>
+if (window.testRunner)
+    testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: true, privateKeyBase64: testES256PrivateKeyBase64 } });
+
 promise_test(async () => {
     const idlURL = ["WebAuthN.idl"];
     const idlArray = new IdlArray();
@@ -44,15 +47,13 @@ promise_test(async () => {
             },
             user: {
                 name: "John Appleseed",
-                id: asciiToUint8Array("123456"),
+                id: Base64URL.parse(testUserhandleBase64),
                 displayName: "Appleseed",
             },
             challenge: Base64URL.parse("MTIzNDU2"),
             pubKeyCredParams: [{ type: "public-key", alg: -7 }],
         }
     };
-    // A mock attestation object
-    internals.mockAuthenticatorCoordinator.setCreationReturnBundle(hexStringToUint8Array('00'), hexStringToUint8Array('01'));
     createdCredential = await navigator.credentials.create(creationOptions);
 
 
@@ -61,11 +62,12 @@ promise_test(async () => {
             challenge: Base64URL.parse("MTIzNDU2"),
         }
     };
-    // A mock assertion return bundle.
-    internals.mockAuthenticatorCoordinator.setAssertionReturnBundle(hexStringToUint8Array('00'), hexStringToUint8Array('01'), hexStringToUint8Array('02'), hexStringToUint8Array('03'));
     requestedCredential = await navigator.credentials.get(requestOptions);
 
     idlArray.add_objects({"PublicKeyCredential": ["createdCredential"], "AuthenticatorAttestationResponse": ["createdCredential.response"], "AuthenticatorAssertionResponse": ["requestedCredential.response"]});
     idlArray.test();
+
+    if (window.testRunner)
+        testRunner.cleanUpKeychain(testRpId);
 }, "Setup for WebAuthN API IDL tests.");
 </script>
index ac3a636..2bc4d1d 100644 (file)
@@ -23,7 +23,7 @@
                 pubKeyCredParams: [{ type: "public-key", alg: -35 }, { type: "public-key", alg: -257 }], // ES384, RS256
             }
         };
-        return promise_rejects(t, "NotSupportedError", navigator.credentials.create(options), "The platform attached authenticator doesn't support any provided PublicKeyCredentialParameters.");
+        return promiseRejects(t, "NotSupportedError", navigator.credentials.create(options), "The platform attached authenticator doesn't support any provided PublicKeyCredentialParameters.");
     }, "PublicKeyCredential's [[create]] with unsupported public key credential parameters in a mock local authenticator.");
 
     promise_test(t => {
@@ -44,7 +44,7 @@
         };
         if (window.testRunner)
             testRunner.addTestKeyToKeychain(testES256PrivateKeyBase64, testRpId, testUserhandleBase64);
-        return promise_rejects(t, "NotAllowedError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => {
+        return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => {
             if (window.testRunner)
                 testRunner.cleanUpKeychain(testRpId);
         });
@@ -73,7 +73,7 @@
         };
         if (window.testRunner)
             testRunner.addTestKeyToKeychain(testES256PrivateKeyBase64, testRpId, testUserhandleBase64);
-        return promise_rejects(t, "NotAllowedError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => {
+        return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.").then(() => {
             if (window.testRunner)
                 testRunner.cleanUpKeychain(testRpId);
         });
@@ -94,7 +94,7 @@
                 pubKeyCredParams: [{ type: "public-key", alg: -7 }]
             }
         };
-        return promise_rejects(t, "NotAllowedError", navigator.credentials.create(options), "Couldn't get user consent.");
+        return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Couldn't get user consent.");
     }, "PublicKeyCredential's [[create]] without user consent in a mock local authenticator.");
 
     promise_test(t => {
         };
         if (window.testRunner)
             testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false, privateKeyBase64: "" } });
-        return promise_rejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error.");
+        return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error.");
     }, "PublicKeyCredential's [[create]] without attestation in a mock local authenticator.");
 
     promise_test(t => {
             testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false, privateKeyBase64: "" } });
             testRunner.addTestKeyToKeychain(testES256PrivateKeyBase64, testRpId, testUserhandleBase64);
         }
-        return promise_rejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error.").then(() => {
+        return promiseRejects(t, "UnknownError", navigator.credentials.create(options), "Unknown internal error.").then(() => {
             if (window.testRunner)
                 assert_false(testRunner.keyExistsInKeychain(testRpId, testUserhandleBase64));
         });
index c4761f3..080d3ce 100644 (file)
@@ -1,6 +1,4 @@
 
-PASS PublicKeyCredential's [[create]] with timeout 
 PASS PublicKeyCredential's [[create]] with a mismatched RP ID 
 PASS PublicKeyCredential's [[create]] with an empty pubKeyCredParams 
-PASS PublicKeyCredential's [[create]] with user cancellations 
 
index 45077a3..c52496c 100644 (file)
@@ -4,27 +4,31 @@
 <script src="/resources/testharnessreport.js"></script>
 <script src="./resources/util.js"></script>
 <script>
-    promise_test(function(t) {
-        const options = {
-            publicKey: {
-                rp: {
-                    name: "example.com"
-                },
-                user: {
-                    name: "John Appleseed",
-                    id: asciiToUint8Array("123456"),
-                    displayName: "John",
-                },
-                challenge: asciiToUint8Array("123456"),
-                pubKeyCredParams: [{ type: "public-key", alg: -7 }],
-                timeout: 0,
-            }
-        };
-        internals.mockAuthenticatorCoordinator.setDidTimeOut();
+    // Default mock configuration. Tests need to override if they need different configuration.
+    if (window.testRunner)
+        testRunner.setWebAuthenticationMockConfiguration({ });
 
-        return promise_rejects(t, "NotAllowedError",
-            navigator.credentials.create(options));
-    }, "PublicKeyCredential's [[create]] with timeout");
+    // FIXME(189642): Re-enable the following test.
+    // promise_test(function(t) {
+    //     const options = {
+    //         publicKey: {
+    //             rp: {
+    //                 name: "example.com"
+    //             },
+    //             user: {
+    //                 name: "John Appleseed",
+    //                 id: asciiToUint8Array("123456"),
+    //                 displayName: "John",
+    //             },
+    //             challenge: asciiToUint8Array("123456"),
+    //             pubKeyCredParams: [{ type: "public-key", alg: -7 }],
+    //             timeout: 0,
+    //         }
+    //     };
+    //
+    //     return promiseRejects(t, "NotAllowedError",
+    //         navigator.credentials.create(options), "Operation timed out.");
+    // }, "PublicKeyCredential's [[create]] with timeout");
 
     promise_test(function(t) {
         const options = {
@@ -42,8 +46,9 @@
                 pubKeyCredParams: [{ type: "public-key", alg: -7 }],
             }
         };
-        return promise_rejects(t, "SecurityError",
-            navigator.credentials.create(options));
+
+        return promiseRejects(t, "SecurityError",
+            navigator.credentials.create(options), "The origin of the document is not a registrable domain suffix of the provided RP ID.");
     }, "PublicKeyCredential's [[create]] with a mismatched RP ID");
 
     promise_test(function(t) {
                 pubKeyCredParams: [ ],
             }
         };
-        return promise_rejects(t, "NotSupportedError",
-            navigator.credentials.create(options));
-    }, "PublicKeyCredential's [[create]] with an empty pubKeyCredParams");
-
-    promise_test(function(t) {
-        const options = {
-            publicKey: {
-                rp: {
-                    name: "localhost",
-                    id: "localhost"
-                },
-                user: {
-                    name: "John Appleseed",
-                    id: asciiToUint8Array("123456"),
-                    displayName: "John",
-                },
-                challenge: asciiToUint8Array("123456"),
-                pubKeyCredParams: [{ type: "public-key", alg: -7 }],
-            }
-        };
-        internals.mockAuthenticatorCoordinator.setDidUserCancel();
 
-        return promise_rejects(t, "NotAllowedError",
-            navigator.credentials.create(options));
-    }, "PublicKeyCredential's [[create]] with user cancellations");
+        return promiseRejects(t, "NotSupportedError",
+            navigator.credentials.create(options), "No desired properties of the to be created credential are provided.");
+    }, "PublicKeyCredential's [[create]] with an empty pubKeyCredParams");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success.https-expected.txt b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success.https-expected.txt
deleted file mode 100644 (file)
index ca86840..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS PublicKeyCredential's [[create]] with minimum options 
-
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-success.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-create-success.https.html
deleted file mode 100644 (file)
index ac584a0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<title>Web Authentication API: PublicKeyCredential's [[create]] success cases.</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="./resources/util.js"></script>
-<script>
-    promise_test(function(t) {
-        const options = {
-            publicKey: {
-                rp: {
-                    name: "localhost",
-                },
-                user: {
-                    name: "John Appleseed",
-                    id: asciiToUint8Array("123456"),
-                    displayName: "Appleseed",
-                },
-                challenge: Base64URL.parse("MTIzNDU2"),
-                pubKeyCredParams: [{ type: "public-key", alg: -7 }],
-            }
-        };
-        // A mock attestation object
-        internals.mockAuthenticatorCoordinator.setCreationReturnBundle(hexStringToUint8Array('00'), hexStringToUint8Array('01'));
-
-        return navigator.credentials.create(options).then(function(credential) {
-                assert_equals(credential.id, 'AA');
-                assert_equals(credential.type, 'public-key');
-                assert_equals(bytesToHexString(credential.rawId), '00');
-                assert_equals(bytesToASCIIString(credential.response.clientDataJSON), '{"type":"webauthn.create","challenge":"MTIzNDU2","origin":"https://localhost:9443","hashAlgorithm":"SHA-256"}');
-                assert_equals(bytesToHexString(credential.response.attestationObject), '01');
-                assert_throws("NotSupportedError", () => { credential.getClientExtensionResults() });
-            });
-    }, "PublicKeyCredential's [[create]] with minimum options");
-</script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt b/LayoutTests/http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https-expected.txt
new file mode 100644 (file)
index 0000000..056731c
--- /dev/null
@@ -0,0 +1,57 @@
+
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 1 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 2 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 3 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 4 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 5 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 6 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 7 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 8 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 9 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 10 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 11 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 12 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 13 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 14 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 15 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 16 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 17 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 18 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 19 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 20 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 21 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 22 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 23 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 24 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 25 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 26 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 27 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 28 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 29 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 30 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 31 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 32 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 33 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 34 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 35 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 36 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 37 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 38 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 39 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 40 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 41 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 42 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 43 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 44 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 45 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 46 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 47 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 48 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 49 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 50 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 51 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 52 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 53 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 54 
+PASS PublicKeyCredential's [[create]] with with invalid parameters. 55 
+
@@ -1,17 +1,9 @@
 <!DOCTYPE html>
-<html>
-<head>
-    <script src="/js-test-resources/js-test.js"></script>
-    <script src="./resources/util.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
+<title>Web Authentication API: PublicKeyCredential's [[create]] with invalid parameters.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="./resources/util.js"></script>
 <script>
-    description("Tests that PublicKeyCredential's [[create]] throws TypeError when invalid options are passed.");
-
-    jsTestIsAsync = true;
-
     const rp = {
         name: "example.com"
     };
@@ -94,7 +86,7 @@
         [rp, user, challenge, [pubKeyCredParam], undefined, [{ type: excludeCredentials.type, id: "foo" }]],
         [rp, user, challenge, [pubKeyCredParam], undefined, [{ type: excludeCredentials.type, id: [ ] }]],
         [rp, user, challenge, [pubKeyCredParam], undefined, [{ type: excludeCredentials.type, id: { } }]]
-    ]
+    ];
 
     function makeOptions(attributes)
     {
         return { publicKey: { rp: attributes[0], user: attributes[1], challenge: attributes[2], pubKeyCredParams: attributes[3], timeout: attributes[4],  excludeCredentials: attributes[5]} };
     }
 
+    let index = 1;
     function runTest(attributesVectors) {
         attributesVectors.forEach(function(attributesVector) {
             attributesVector.forEach(async function(attributes) {
-                invalidOptions = makeOptions(attributes);
-                await shouldReject('navigator.credentials.create(invalidOptions)');
+                promise_test(function(t) {
+                    return promise_rejects(t, new TypeError(),
+                        navigator.credentials.create(makeOptions(attributes)));
+                }, "PublicKeyCredential's [[create]] with with invalid parameters. " + index);
+                index = index + 1;
             });
         });
-
-        finishJSTest();
     }
 
     const vectors = [];
     vectors.push(wrongTypeAttributeVector);
     runTest(vectors);
 </script>
-</body>
-</html>
index 3954a06..7f4dd96 100644 (file)
@@ -21,7 +21,7 @@
             }
         };
 
-        return promise_rejects(t, "NotAllowedError", navigator.credentials.get(options), "No matched credentials are found in the platform attached authenticator.");
+        return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No matched credentials are found in the platform attached authenticator.");
     }, "PublicKeyCredential's [[get]] with no matched credentials in a mock local authenticator.");
 
     promise_test(t => {
@@ -36,7 +36,7 @@
 
         if (window.testRunner)
             testRunner.addTestKeyToKeychain(testES256PrivateKeyBase64, testRpId, testUserhandleBase64);
-        return promise_rejects(t, "NotAllowedError", navigator.credentials.get(options), "No matched credentials are found in the platform attached authenticator.").then(() => {
+        return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "No matched credentials are found in the platform attached authenticator.").then(() => {
                 if (window.testRunner)
                     testRunner.cleanUpKeychain(testRpId);
             });
@@ -51,7 +51,7 @@
 
         if (window.testRunner)
             testRunner.addTestKeyToKeychain(testES256PrivateKeyBase64, testRpId, testUserhandleBase64);
-        return promise_rejects(t, "NotAllowedError", navigator.credentials.get(options), "Couldn't get user consent.").then(() => {
+        return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Couldn't get user consent.").then(() => {
             if (window.testRunner)
                 testRunner.cleanUpKeychain(testRpId);
         });
index 2e880cf..dc0b917 100644 (file)
@@ -1,5 +1,3 @@
 
-PASS PublicKeyCredential's [[get]] with timeout 
 PASS PublicKeyCredential's [[get]] with a mismatched RP ID 
-PASS PublicKeyCredential's [[get]] with user cancellations 
 
index 0d4c045..ce5e28b 100644 (file)
@@ -4,18 +4,22 @@
 <script src="/resources/testharnessreport.js"></script>
 <script src="./resources/util.js"></script>
 <script>
-    promise_test(function(t) {
-        const options = {
-            publicKey: {
-                challenge: asciiToUint8Array("123456"),
-                timeout: 0,
-            }
-        };
-        internals.mockAuthenticatorCoordinator.setDidTimeOut();
+    // Default mock configuration. Tests need to override if they need different configuration.
+    if (window.testRunner)
+        testRunner.setWebAuthenticationMockConfiguration({ });
 
-        return promise_rejects(t, "NotAllowedError",
-            navigator.credentials.get(options));
-    }, "PublicKeyCredential's [[get]] with timeout");
+    // FIXME(189642): Re-enable the following test.
+    // promise_test(function(t) {
+    //     const options = {
+    //         publicKey: {
+    //             challenge: asciiToUint8Array("123456"),
+    //             timeout: 0,
+    //         }
+    //     };
+    //
+    //     return promiseRejects(t, "NotAllowedError",
+    //         navigator.credentials.get(options), "Operation timed out.");
+    // }, "PublicKeyCredential's [[get]] with timeout");
 
     promise_test(function(t) {
         const options = {
                 challenge: asciiToUint8Array("123456"),
             }
         };
-        return promise_rejects(t, "SecurityError",
-            navigator.credentials.get(options));
+        return promiseRejects(t, "SecurityError",
+            navigator.credentials.get(options), "The origin of the document is not a registrable domain suffix of the provided RP ID.");
     }, "PublicKeyCredential's [[get]] with a mismatched RP ID");
-
-    promise_test(function(t) {
-        const options = {
-            publicKey: {
-                challenge: asciiToUint8Array("123456"),
-                allowCredentials: [{ type: "public-key", id: asciiToUint8Array("123456") }],
-            }
-        };
-        internals.mockAuthenticatorCoordinator.setDidUserCancel();
-
-        return promise_rejects(t, "NotAllowedError",
-            navigator.credentials.get(options));
-    }, "PublicKeyCredential's [[get]] with user cancellations");
 </script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success.https-expected.txt b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success.https-expected.txt
deleted file mode 100644 (file)
index 78d5370..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS PublicKeyCredential's [[get]] with minimum options 
-
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-success.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-get-success.https.html
deleted file mode 100644 (file)
index 0664b1c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<title>Web Authentication API: PublicKeyCredential's [[get]] success cases.</title>
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="./resources/util.js"></script>
-<script>
-    // The following test is specifically tuned for current dummy authenticator.
-    promise_test(function(t) {
-        const options = {
-            publicKey: {
-                challenge: Base64URL.parse("MTIzNDU2"),
-            }
-        };
-        // A mock assertion return bundle.
-        internals.mockAuthenticatorCoordinator.setAssertionReturnBundle(hexStringToUint8Array('00'), hexStringToUint8Array('01'), hexStringToUint8Array('02'), hexStringToUint8Array('03'));
-
-        return navigator.credentials.get(options).then(function(credential) {
-            assert_equals(credential.id, 'AA');
-            assert_equals(credential.type, 'public-key');
-            assert_equals(bytesToHexString(credential.rawId), '00');
-            assert_equals(bytesToASCIIString(credential.response.clientDataJSON), '{"type":"webauthn.get","challenge":"MTIzNDU2","origin":"https://localhost:9443","hashAlgorithm":"SHA-256"}');
-            assert_equals(bytesToHexString(credential.response.authenticatorData), '01');
-            assert_equals(bytesToHexString(credential.response.signature), '02');
-            assert_equals(bytesToHexString(credential.response.userHandle), '03');
-            assert_throws("NotSupportedError", () => { credential.getClientExtensionResults() });
-        });
-    }, "PublicKeyCredential's [[get]] with minimum options");
-</script>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt b/LayoutTests/http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https-expected.txt
new file mode 100644 (file)
index 0000000..8d5c91f
--- /dev/null
@@ -0,0 +1,28 @@
+
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 1 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 2 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 3 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 4 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 5 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 6 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 7 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 8 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 9 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 10 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 11 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 12 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 13 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 14 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 15 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 16 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 17 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 18 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 19 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 20 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 21 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 22 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 23 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 24 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 25 
+PASS PublicKeyCredential's [[get]] with with invalid parameters. 26 
+
@@ -1,17 +1,9 @@
 <!DOCTYPE html>
-<html>
-<head>
-    <script src="/js-test-resources/js-test.js"></script>
-    <script src="./resources/util.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
+<title>Web Authentication API: PublicKeyCredential's [[get]] with invalid parameters.</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="./resources/util.js"></script>
 <script>
-    description("Tests that PublicKeyCredential's [[get]] throws TypeError when invalid options are passed.");
-
-    jsTestIsAsync = true;
-
     const challenge = asciiToUint8Array("123456");
     const allowCredential = { type: "public-key", id: asciiToUint8Array("123456") };
 
         return { publicKey: { challenge: attributes[0], timeout: attributes[1], rpId: attributes[2], allowCredentials: attributes[3] } };
     }
 
+    let index = 1;
     function runTest(attributesVectors) {
         attributesVectors.forEach(function(attributesVector) {
             attributesVector.forEach(async function(attributes) {
-                invalidOptions = makeOptions(attributes);
-                await shouldReject('navigator.credentials.get(invalidOptions)');
+                promise_test(function(t) {
+                    return promise_rejects(t, new TypeError(),
+                        navigator.credentials.get(makeOptions(attributes)));
+                }, "PublicKeyCredential's [[get]] with with invalid parameters. " + index);
+                index = index + 1;
             });
         });
-
-        finishJSTest();
     }
 
     const vectors = [];
@@ -76,5 +70,3 @@
     vectors.push(wrongTypeAttributeVector);
     runTest(vectors);
 </script>
-</body>
-</html>
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt b/LayoutTests/http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https-expected.txt
new file mode 100644 (file)
index 0000000..8cd377f
--- /dev/null
@@ -0,0 +1,5 @@
+  
+
+PASS Tests that a frame that doesn't share the same origin with all its ancestors could not access the API. 
+PASS Tests that a frame that doesn't share the same origin with all its ancestors could not access the API. 2 
+
diff --git a/LayoutTests/http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html b/LayoutTests/http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html
new file mode 100644 (file)
index 0000000..21f147b
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>Web Authentication API: Tests that a frame that doesn't share the same origin with all its ancestors could not access the API.</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <script src="/common/utils.js"></script>
+    <script src="/common/get-host-info.sub.js"></script>
+    <script src="./resources/util.js"></script>
+</head>
+<body>
+    <script>
+        promise_test(t => {
+            return withCrossOriginIframe("last-layer-frame.https.html").then((message) => {
+                assert_equals(message.data, "PASS.");
+            });
+        }, "Tests that a frame that doesn't share the same origin with all its ancestors could not access the API.");
+
+        promise_test(t => {
+            return withCrossOriginIframe("second-layer-frame.https.html").then((message) => {
+                assert_equals(message.data, "PASS.");
+            });
+        }, "Tests that a frame that doesn't share the same origin with all its ancestors could not access the API. 2");
+    </script>
+</body>
+</html>
diff --git a/LayoutTests/http/wpt/webauthn/resources/last-layer-frame.https.html b/LayoutTests/http/wpt/webauthn/resources/last-layer-frame.https.html
new file mode 100644 (file)
index 0000000..6a4da4c
--- /dev/null
@@ -0,0 +1,48 @@
+<script src="./util.js"></script>
+<script>
+function messageToTop(message) {
+    top.postMessage(message, "*");
+}
+
+const makeOptions = {
+    publicKey: {
+        rp: {
+            name: "example.com"
+        },
+        user: {
+            name: "John Appleseed",
+            id: asciiToUint8Array("123456"),
+            displayName: "Appleseed",
+        },
+        challenge: asciiToUint8Array("123456"),
+        pubKeyCredParams: [{ type: "public-key", alg: -7 }]
+    }
+};
+const requestOptions = {
+    publicKey: {
+        challenge: asciiToUint8Array("123456"),
+    }
+};
+
+
+navigator.credentials.create(makeOptions).then(
+    function(value) {
+        messageToTop("Access granted. " + value);
+    },
+    function(exception) {
+        if (exception.name == "NotAllowedError" && exception.message == "The origin of the document is not the same as its ancestors.")
+            return navigator.credentials.get(requestOptions);
+        else
+            messageToTop("Throw " + exception.name  + ".");
+    }
+).then(function(value) {
+        messageToTop("Access granted. " + value);
+    },
+    function(exception) {
+        if (exception.name == "NotAllowedError" && exception.message == "The origin of the document is not the same as its ancestors.")
+            messageToTop("PASS.");
+        else
+            messageToTop("Throw " + exception.name  + ".");
+    }
+);
+</script>
index 120f90d..1e0649f 100644 (file)
@@ -1,3 +1,16 @@
+const testCredentialIdBase64url = "SMSXHngF7hEOsElA73C3RY-8bR4";
+const testES256PrivateKeyBase64 =
+    "BDj/zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF/Qm1749VBJPgqUIwfhWHJ91nb7U" +
+    "PH76c0+WFOzZKslPyyFse4goGIW2R7k9VHLPEZl5nfnBgEVFh5zev+/xpHQIvuq6" +
+    "RQ==";
+const testES256PublicKeyBase64url =
+    "BDj_zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF_Qm1749VBJPgqUIwfhWHJ91nb7U" +
+    "PH76c0-WFOzZKslPyyFse4g";
+const testRpId = "localhost";
+const testUserhandleBase64 = "AAECAwQFBgcICQ==";
+
+const RESOURCES_DIR = "/WebKit/webauthn/resources/";
+
 function asciiToUint8Array(str)
 {
     var chars = [];
@@ -138,13 +151,31 @@ function extractRawSignature(asn1signature)
     return tmp.buffer;
 }
 
-const testCredentialIdBase64url = "SMSXHngF7hEOsElA73C3RY-8bR4";
-const testES256PrivateKeyBase64 =
-    "BDj/zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF/Qm1749VBJPgqUIwfhWHJ91nb7U" +
-    "PH76c0+WFOzZKslPyyFse4goGIW2R7k9VHLPEZl5nfnBgEVFh5zev+/xpHQIvuq6" +
-    "RQ==";
-const testES256PublicKeyBase64url =
-    "BDj_zxSkzKgaBuS3cdWDF558of8AaIpgFpsjF_Qm1749VBJPgqUIwfhWHJ91nb7U" +
-    "PH76c0-WFOzZKslPyyFse4g";
-const testRpId = "localhost";
-const testUserhandleBase64 = "AAECAwQFBgcICQ==";
+function waitForLoad()
+{
+    return new Promise((resolve) => {
+        window.addEventListener('message', (message) => {
+            resolve(message);
+        });
+    });
+}
+
+function withCrossOriginIframe(resourceFile)
+{
+    return new Promise((resolve) => {
+        waitForLoad().then((message) => {
+            resolve(message);
+        });
+        const frame = document.createElement("iframe");
+        frame.src = get_host_info().HTTPS_REMOTE_ORIGIN + RESOURCES_DIR + resourceFile;
+        document.body.appendChild(frame);
+    });
+}
+
+function promiseRejects(test, expected, promise, description)
+{
+    return promise.then(test.unreached_func("Should have rejected: " + description)).catch(function(e) {
+        assert_throws(expected, function() { throw e }, description);
+        assert_equals(e.message, description);
+    });
+}
\ No newline at end of file
index 58e7e28..e1f8b7f 100644 (file)
@@ -1150,7 +1150,6 @@ webkit.org/b/175419 http/wpt/service-workers/navigation-redirect-main-frame.http
 webkit.org/b/175419 http/wpt/service-workers/third-party-registration.html [ Skip ]
 
 # Skip anything related to WebAuthN
-http/tests/webauthn/ [ Skip ]
 http/wpt/credential-management/ [ Skip ]
 http/wpt/webauthn/ [ Skip ]
 imported/w3c/web-platform-tests/credential-management/ [ Skip ]
index 7e95802..90fd0a4 100644 (file)
@@ -1969,7 +1969,6 @@ webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]
 http/tests/xmlhttprequest/range-test.html [ Skip ]
 
 # Skip anything related to WebAuthN
-http/tests/webauthn/ [ Skip ]
 http/wpt/credential-management/ [ Skip ]
 http/wpt/webauthn/ [ Skip ]
 imported/w3c/web-platform-tests/credential-management/ [ Skip ]
index 2e09e0d..5e6bf19 100644 (file)
@@ -545,7 +545,6 @@ webkit.org/b/181862 [ Debug ] http/tests/images/image-supports-video.html [ Pass
 webkit.org/b/179853 imported/blink/fast/text/international-iteration-simple-text.html [ Pass Failure ]
 
 # Skip anything related to WebAuthN
-http/tests/webauthn/ [ Skip ]
 http/wpt/credential-management/ [ Skip ]
 http/wpt/webauthn/ [ Skip ]
 imported/w3c/web-platform-tests/credential-management/ [ Skip ]
index cf511a9..346a284 100644 (file)
@@ -887,3 +887,6 @@ http/wpt/webauthn/public-key-credential-create-failure-local.https.html [ Skip ]
 http/wpt/webauthn/public-key-credential-create-success-local.https.html [ Skip ]
 http/wpt/webauthn/public-key-credential-get-failure-local.https.html [ Skip ]
 http/wpt/webauthn/public-key-credential-get-success-local.https.html [ Skip ]
+# The following tests require PublicKeyCredential objects. We can only produce them via local authenticators now.
+http/wpt/credential-management/credentialscontainer-store-basics.https.html [ Skip ]
+http/wpt/webauthn/idl.https.html [ Skip ]
index 33a9307..0b0c4f6 100644 (file)
@@ -654,7 +654,6 @@ webkit.org/b/149630 css3/font-variant-all.html [ ImageOnlyFailure ]
 webkit.org/b/158836 imported/w3c/web-platform-tests/encrypted-media [ Skip ]
 
 # Skip anything related to WebAuthN
-http/tests/webauthn/ [ Skip ]
 http/wpt/credential-management/ [ Skip ]
 http/wpt/webauthn/ [ Skip ]
 imported/w3c/web-platform-tests/credential-management/ [ Skip ]
index 75a5762..d1a89ee 100644 (file)
@@ -924,7 +924,6 @@ http/tests/ssl [ Skip ]
 
 http/tests/subresource-integrity [ Skip ]
 http/tests/webarchive [ Skip ]
-http/tests/webauthn [ Skip ]
 http/tests/webgl [ Skip ]
 http/tests/webrtc [ Skip ]
 
index 71b810b..49d9e04 100644 (file)
@@ -120,7 +120,6 @@ webkit.org/b/169811 fast/mediastream/captureStream/canvas3d.html [ Crash Timeout
 
 # Skip anything related to WebAuthN
 # ---------------------------------
-http/tests/webauthn/ [ Skip ]
 http/wpt/credential-management/ [ Skip ]
 http/wpt/webauthn/ [ Skip ]
 imported/w3c/web-platform-tests/credential-management/ [ Skip ]
index b2f6b4a..5dc76ac 100644 (file)
@@ -1,3 +1,28 @@
+2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebAuthN] Polish WebAuthN auto-test environment
+        https://bugs.webkit.org/show_bug.cgi?id=189283
+        <rdar://problem/44117828>
+
+        Reviewed by Chris Dumez.
+
+        This patch removes the old mocking mechanism.
+
+        Tests: http/wpt/webauthn/public-key-credential-create-with-invalid-parameters.https.html
+               http/wpt/webauthn/public-key-credential-get-with-invalid-parameters.https.html
+               http/wpt/webauthn/public-key-credential-same-origin-with-ancestors.https.html
+
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * testing/Internals.cpp:
+        (WebCore::Internals::Internals):
+        (WebCore::Internals::mockAuthenticatorCoordinator const): Deleted.
+        * testing/Internals.h:
+        * testing/Internals.idl:
+        * testing/MockAuthenticatorCoordinator.cpp: Removed.
+        * testing/MockAuthenticatorCoordinator.h: Removed.
+        * testing/MockAuthenticatorCoordinator.idl: Removed.
+
 2018-09-28  Jer Noble  <jer.noble@apple.com>
 
         Refactoring: eliminate raw pointer usage in Fullscreen code
index 7b8d5c2..360fde7 100644 (file)
@@ -978,7 +978,6 @@ JS_BINDING_IDLS = \
     $(WebCore)/testing/Internals.idl \
     $(WebCore)/testing/MallocStatistics.idl \
     $(WebCore)/testing/MemoryInfo.idl \
-    $(WebCore)/testing/MockAuthenticatorCoordinator.idl \
     $(WebCore)/testing/MockCDMFactory.idl \
     $(WebCore)/testing/MockContentFilterSettings.idl \
     $(WebCore)/testing/MockPageOverlay.idl \
index 411eaea..52ac996 100644 (file)
                5750A9871E6A216800705C4A /* CryptoAlgorithmECDH.h in Headers */ = {isa = PBXBuildFile; fileRef = 5750A9851E6A216800705C4A /* CryptoAlgorithmECDH.h */; };
                5754719F1ECE628300DD63B2 /* JSRsaPssParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 575471991ECE5D2A00DD63B2 /* JSRsaPssParams.h */; };
                5760827220215A5500116678 /* AuthenticatorCoordinatorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 576082702021513F00116678 /* AuthenticatorCoordinatorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               5760827A2024EA5C00116678 /* MockAuthenticatorCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 5760827820244DAB00116678 /* MockAuthenticatorCoordinator.h */; };
-               5760827B2024ED2900116678 /* MockAuthenticatorCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5760827920244DAC00116678 /* MockAuthenticatorCoordinator.cpp */; };
                5768142A1E6F99C100E77754 /* CryptoAlgorithmEcdhKeyDeriveParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 576814291E6F99C100E77754 /* CryptoAlgorithmEcdhKeyDeriveParams.h */; };
                576814411E709FA400E77754 /* JSEcdhKeyDeriveParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5768143E1E709C3600E77754 /* JSEcdhKeyDeriveParams.h */; };
                576814451E70CB1F00E77754 /* JSAesKeyParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 576814431E70CB1000E77754 /* JSAesKeyParams.h */; };
                57D846281FE8960500CA3682 /* NavigatorCredentials.h in Headers */ = {isa = PBXBuildFile; fileRef = 57D846261FE895F800CA3682 /* NavigatorCredentials.h */; };
                57D8462E1FEAF69900CA3682 /* PublicKeyCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 57D8462B1FEAF68F00CA3682 /* PublicKeyCredential.h */; settings = {ATTRIBUTES = (Private, ); }; };
                57D846351FEAFCD300CA3682 /* JSPublicKeyCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 57D846301FEAFC2F00CA3682 /* JSPublicKeyCredential.h */; };
-               57DCED672140775B0016B847 /* JSMockAuthenticatorCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED622140763C0016B847 /* JSMockAuthenticatorCoordinator.h */; };
-               57DCED69214077640016B847 /* JSMockAuthenticatorCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57DCED632140763C0016B847 /* JSMockAuthenticatorCoordinator.cpp */; };
                57DCED74214305F00016B847 /* PublicKeyCredentialData.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED72214305F00016B847 /* PublicKeyCredentialData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                57DCED9021487FF70016B847 /* AuthenticatorTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED8C21487EDB0016B847 /* AuthenticatorTransport.h */; settings = {ATTRIBUTES = (Private, ); }; };
                57DCED98214882160016B847 /* JSAuthenticatorTransport.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCED92214880C60016B847 /* JSAuthenticatorTransport.h */; };
                5760824F20118D8D00116678 /* JSBasicCredentialCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSBasicCredentialCustom.cpp; sourceTree = "<group>"; };
                576082562011BE0200116678 /* JSAuthenticatorResponseCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSAuthenticatorResponseCustom.cpp; sourceTree = "<group>"; };
                576082702021513F00116678 /* AuthenticatorCoordinatorClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticatorCoordinatorClient.h; sourceTree = "<group>"; };
-               5760827820244DAB00116678 /* MockAuthenticatorCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockAuthenticatorCoordinator.h; sourceTree = "<group>"; };
-               5760827920244DAC00116678 /* MockAuthenticatorCoordinator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MockAuthenticatorCoordinator.cpp; sourceTree = "<group>"; };
-               57608280202556F400116678 /* MockAuthenticatorCoordinator.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockAuthenticatorCoordinator.idl; sourceTree = "<group>"; };
                57608293202BA95300116678 /* AuthenticatorCoordinatorClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticatorCoordinatorClient.cpp; sourceTree = "<group>"; };
                576814281E6F98AD00E77754 /* EcdhKeyDeriveParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = EcdhKeyDeriveParams.idl; sourceTree = "<group>"; };
                576814291E6F99C100E77754 /* CryptoAlgorithmEcdhKeyDeriveParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmEcdhKeyDeriveParams.h; sourceTree = "<group>"; };
                57D8462D1FEAF68F00CA3682 /* PublicKeyCredential.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PublicKeyCredential.idl; sourceTree = "<group>"; };
                57D846301FEAFC2F00CA3682 /* JSPublicKeyCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPublicKeyCredential.h; sourceTree = "<group>"; };
                57D846311FEAFC2F00CA3682 /* JSPublicKeyCredential.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPublicKeyCredential.cpp; sourceTree = "<group>"; };
-               57DCED622140763C0016B847 /* JSMockAuthenticatorCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMockAuthenticatorCoordinator.h; sourceTree = "<group>"; };
-               57DCED632140763C0016B847 /* JSMockAuthenticatorCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockAuthenticatorCoordinator.cpp; sourceTree = "<group>"; };
                57DCED72214305F00016B847 /* PublicKeyCredentialData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PublicKeyCredentialData.h; sourceTree = "<group>"; };
                57DCED8C21487EDB0016B847 /* AuthenticatorTransport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AuthenticatorTransport.h; sourceTree = "<group>"; };
                57DCED8E21487EDB0016B847 /* AuthenticatorTransport.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AuthenticatorTransport.idl; sourceTree = "<group>"; };
                                A7BE7EDE14C9175A0014489D /* MallocStatistics.idl */,
                                CD5393CB175DCCE600C07123 /* MemoryInfo.h */,
                                CD5393CC175DCCE600C07123 /* MemoryInfo.idl */,
-                               5760827920244DAC00116678 /* MockAuthenticatorCoordinator.cpp */,
-                               5760827820244DAB00116678 /* MockAuthenticatorCoordinator.h */,
-                               57608280202556F400116678 /* MockAuthenticatorCoordinator.idl */,
                                CDF4B7211E03BF8100E235A2 /* MockCDMFactory.cpp */,
                                CDF4B7221E03BF8100E235A2 /* MockCDMFactory.h */,
                                CDF4B71F1E03BF6F00E235A2 /* MockCDMFactory.idl */,
                                A7B4EA6914C9348400C8F5BF /* JSMallocStatistics.h */,
                                CD5393D1175E018600C07123 /* JSMemoryInfo.cpp */,
                                CD5393D2175E018600C07123 /* JSMemoryInfo.h */,
-                               57DCED632140763C0016B847 /* JSMockAuthenticatorCoordinator.cpp */,
-                               57DCED622140763C0016B847 /* JSMockAuthenticatorCoordinator.h */,
                                CDF4B72D1E03CA4A00E235A2 /* JSMockCDMFactory.cpp */,
                                CDF4B72E1E03CA4A00E235A2 /* JSMockCDMFactory.h */,
                                A19AEA1D1AAA806E00B52B25 /* JSMockContentFilterSettings.cpp */,
                574F55DD204F3744002948C6 /* cocoa */ = {
                        isa = PBXGroup;
                        children = (
-                               574F55DE204F3744002948C6 /* LocalAuthenticator.h */,
-                               574F55DF204F3744002948C6 /* LocalAuthenticator.mm */,
                        );
                        path = cocoa;
                        sourceTree = "<group>";
                                53ED3FDF167A88E7006762E6 /* JSInternalSettingsGenerated.h in Headers */,
                                A740B59514C935AB00A77FA4 /* JSMallocStatistics.h in Headers */,
                                CD5393D4175E018600C07123 /* JSMemoryInfo.h in Headers */,
-                               57DCED672140775B0016B847 /* JSMockAuthenticatorCoordinator.h in Headers */,
                                538EC9331F99B9F7004D22A8 /* JSMockCDMFactory.h in Headers */,
                                A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */,
                                538EC9341F99B9F7004D22A8 /* JSMockPageOverlay.h in Headers */,
                                427DA71E13735DFA007C57FB /* JSServiceWorkerInternals.h in Headers */,
                                EBF5121D1696496C0056BD25 /* JSTypeConversions.h in Headers */,
                                CDC26B41160A8CCE0026757B /* LegacyMockCDM.h in Headers */,
-                               5760827A2024EA5C00116678 /* MockAuthenticatorCoordinator.h in Headers */,
                                A1BF6B831AA96C7D00AF4A8A /* MockContentFilter.h in Headers */,
                                A1B5B29F1AAA846F008B6042 /* MockContentFilterSettings.h in Headers */,
                                51058ADC1D6792C1009A538C /* MockGamepad.h in Headers */,
                                53ED3FDE167A88E7006762E6 /* JSInternalSettingsGenerated.cpp in Sources */,
                                538EC9321F99B9F7004D22A8 /* JSMallocStatistics.cpp in Sources */,
                                CD5393D3175E018600C07123 /* JSMemoryInfo.cpp in Sources */,
-                               57DCED69214077640016B847 /* JSMockAuthenticatorCoordinator.cpp in Sources */,
                                CDF4B7321E03D06000E235A2 /* JSMockCDMFactory.cpp in Sources */,
                                A19AEA221AAA808A00B52B25 /* JSMockContentFilterSettings.cpp in Sources */,
                                2D4150DE1C1F868C000A3BA2 /* JSMockPageOverlay.cpp in Sources */,
                                427DA71D13735DFA007C57FB /* JSServiceWorkerInternals.cpp in Sources */,
                                EBF5121C1696496C0056BD25 /* JSTypeConversions.cpp in Sources */,
                                CDC26B40160A8CC60026757B /* LegacyMockCDM.cpp in Sources */,
-                               5760827B2024ED2900116678 /* MockAuthenticatorCoordinator.cpp in Sources */,
                                CDF4B7311E03D00700E235A2 /* MockCDMFactory.cpp in Sources */,
                                A1BF6B821AA96C7D00AF4A8A /* MockContentFilter.cpp in Sources */,
                                A1B5B29E1AAA846E008B6042 /* MockContentFilterSettings.cpp in Sources */,
index 81b912f..2219243 100644 (file)
 #include "PaymentCoordinator.h"
 #endif
 
-#if ENABLE(WEB_AUTHN)
-#include "AuthenticatorCoordinator.h"
-#include "MockAuthenticatorCoordinator.h"
-#endif
-
 #if PLATFORM(MAC) && USE(LIBWEBRTC)
 #include <webrtc/sdk/WebKit/VideoProcessingSoftLink.h>
 #endif
@@ -553,15 +548,6 @@ Internals::Internals(Document& document)
         frame->page()->setPaymentCoordinator(std::make_unique<PaymentCoordinator>(*m_mockPaymentCoordinator));
     }
 #endif
-
-#if ENABLE(WEB_AUTHN)
-    // FIXME(189283)
-    if (document.page()) {
-        auto mockAuthenticatorCoordinator = std::make_unique<MockAuthenticatorCoordinator>();
-        m_mockAuthenticatorCoordinator = makeWeakPtr(mockAuthenticatorCoordinator.get());
-//        document.page()->authenticatorCoordinator().setClient(WTFMove(mockAuthenticatorCoordinator));
-    }
-#endif
 }
 
 Document* Internals::contextDocument() const
@@ -4640,13 +4626,6 @@ MockPaymentCoordinator& Internals::mockPaymentCoordinator() const
 }
 #endif
 
-#if ENABLE(WEB_AUTHN)
-MockAuthenticatorCoordinator& Internals::mockAuthenticatorCoordinator() const
-{
-    return *m_mockAuthenticatorCoordinator;
-}
-#endif
-
 bool Internals::isSystemPreviewLink(Element& element) const
 {
 #if USE(SYSTEM_PREVIEW)
index da7f1cb..b0fd090 100644 (file)
@@ -79,7 +79,6 @@ class MediaStreamTrack;
 class MemoryInfo;
 class MockCDMFactory;
 class MockContentFilterSettings;
-class MockAuthenticatorCoordinator;
 class MockPageOverlay;
 class MockPaymentCoordinator;
 class NodeList;
@@ -704,10 +703,6 @@ public:
     void pauseTimeline(AnimationTimeline&);
     void setTimelineCurrentTime(AnimationTimeline&, double);
 
-#if ENABLE(WEB_AUTHN)
-    MockAuthenticatorCoordinator& mockAuthenticatorCoordinator() const;
-#endif
-
     bool isSystemPreviewLink(Element&) const;
     bool isSystemPreviewImage(Element&) const;
 
@@ -806,10 +801,6 @@ private:
 #if ENABLE(APPLE_PAY)
     MockPaymentCoordinator* m_mockPaymentCoordinator { nullptr };
 #endif
-
-#if ENABLE(WEB_AUTHN)
-    WeakPtr<MockAuthenticatorCoordinator> m_mockAuthenticatorCoordinator;
-#endif
 };
 
 } // namespace WebCore
index 078cf75..fed98f4 100644 (file)
@@ -684,7 +684,6 @@ enum CompositingPolicy {
     [EnabledAtRuntime=WebAnimations] void pauseTimeline(AnimationTimeline timeline);
     [EnabledAtRuntime=WebAnimations] void setTimelineCurrentTime(AnimationTimeline timeline, double currentTime);
     [Conditional=APPLE_PAY] readonly attribute MockPaymentCoordinator mockPaymentCoordinator;
-    [Conditional=WEB_AUTHN] readonly attribute MockAuthenticatorCoordinator mockAuthenticatorCoordinator;
 
     boolean isSystemPreviewLink(Element element);
     boolean isSystemPreviewImage(Element element);
diff --git a/Source/WebCore/testing/MockAuthenticatorCoordinator.cpp b/Source/WebCore/testing/MockAuthenticatorCoordinator.cpp
deleted file mode 100644 (file)
index cd7d69a..0000000
+++ /dev/null
@@ -1,115 +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.
- */
-
-#include "config.h"
-#include "MockAuthenticatorCoordinator.h"
-
-#if ENABLE(WEB_AUTHN)
-
-#include "Internals.h"
-#include <WebCore/PublicKeyCredentialData.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-void MockAuthenticatorCoordinator::setCreationReturnBundle(const BufferSource& credentialId, const BufferSource& attestationObject)
-{
-    ASSERT(!m_credentialId && !m_attestationObject);
-    m_credentialId = ArrayBuffer::create(credentialId.data(), credentialId.length());
-    m_attestationObject = ArrayBuffer::create(attestationObject.data(), attestationObject.length());
-}
-
-void MockAuthenticatorCoordinator::setAssertionReturnBundle(const BufferSource& credentialId, const BufferSource& authenticatorData, const BufferSource& signature, const BufferSource& userHandle)
-{
-    ASSERT(!m_credentialId && !m_authenticatorData && !m_signature && !m_userHandle);
-    m_credentialId = ArrayBuffer::create(credentialId.data(), credentialId.length());
-    m_authenticatorData = ArrayBuffer::create(authenticatorData.data(), authenticatorData.length());
-    m_signature = ArrayBuffer::create(signature.data(), signature.length());
-    m_userHandle = ArrayBuffer::create(userHandle.data(), userHandle.length());
-}
-
-void MockAuthenticatorCoordinator::makeCredential(const Vector<uint8_t>&, const PublicKeyCredentialCreationOptions&, RequestCompletionHandler&& handler)
-{
-    if (!setRequestCompletionHandler(WTFMove(handler)))
-        return;
-
-    if (m_didTimeOut) {
-        m_didTimeOut = false;
-        return;
-    }
-    if (m_didUserCancel) {
-        m_didUserCancel = false;
-        requestReply({ }, { NotAllowedError, "User cancelled."_s });
-        return;
-    }
-    if (m_credentialId) {
-        ASSERT(m_attestationObject);
-        requestReply(PublicKeyCredentialData { WTFMove(m_credentialId), true, nullptr, WTFMove(m_attestationObject), nullptr, nullptr, nullptr }, { });
-        m_credentialId = nullptr;
-        m_attestationObject = nullptr;
-        return;
-    }
-    ASSERT_NOT_REACHED();
-}
-
-void MockAuthenticatorCoordinator::getAssertion(const Vector<uint8_t>&, const PublicKeyCredentialRequestOptions&, RequestCompletionHandler&& handler)
-{
-    if (!setRequestCompletionHandler(WTFMove(handler)))
-        return;
-
-    if (m_didTimeOut) {
-        m_didTimeOut = false;
-        return;
-    }
-    if (m_didUserCancel) {
-        m_didUserCancel = false;
-        requestReply({ }, { NotAllowedError, "User cancelled."_s });
-        return;
-    }
-    if (m_credentialId) {
-        ASSERT(m_authenticatorData && m_signature && m_userHandle);
-        requestReply(PublicKeyCredentialData { WTFMove(m_credentialId), false, nullptr, nullptr, WTFMove(m_authenticatorData), WTFMove(m_signature), WTFMove(m_userHandle) }, { });
-        m_credentialId = nullptr;
-        m_authenticatorData = nullptr;
-        m_signature = nullptr;
-        m_userHandle = nullptr;
-        return;
-    }
-    ASSERT_NOT_REACHED();
-}
-
-void MockAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable(QueryCompletionHandler&& handler)
-{
-    auto messageId = addQueryCompletionHandler(WTFMove(handler));
-    if (m_didUserVerifyingPlatformAuthenticatorPresent) {
-        isUserVerifyingPlatformAuthenticatorAvailableReply(messageId, true);
-        m_didUserVerifyingPlatformAuthenticatorPresent = false;
-    } else
-        isUserVerifyingPlatformAuthenticatorAvailableReply(messageId, false);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUTHN)
diff --git a/Source/WebCore/testing/MockAuthenticatorCoordinator.h b/Source/WebCore/testing/MockAuthenticatorCoordinator.h
deleted file mode 100644 (file)
index 94ac45e..0000000
+++ /dev/null
@@ -1,68 +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 "AuthenticatorCoordinatorClient.h"
-#include "BufferSource.h"
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class Internals;
-
-class MockAuthenticatorCoordinator final : public AuthenticatorCoordinatorClient {
-public:
-    void setDidTimeOut() { m_didTimeOut = true; }
-    void setDidUserCancel() { m_didUserCancel = true; }
-    void setDidUserVerifyingPlatformAuthenticatorPresent() { m_didUserVerifyingPlatformAuthenticatorPresent = true; }
-    void setCreationReturnBundle(const BufferSource& credentialId, const BufferSource& attestationObject);
-    void setAssertionReturnBundle(const BufferSource& credentialId, const BufferSource& authenticatorData, const BufferSource& signature, const BufferSource& userHandle);
-
-    // RefCounted is required for JS wrapper. Therefore, fake them to compile.
-    void ref() const { }
-    void deref() const { }
-
-private:
-    void makeCredential(const Vector<uint8_t>& hash, const PublicKeyCredentialCreationOptions&, RequestCompletionHandler&&) final;
-    void getAssertion(const Vector<uint8_t>& hash, const PublicKeyCredentialRequestOptions&, RequestCompletionHandler&&) final;
-    void isUserVerifyingPlatformAuthenticatorAvailable(QueryCompletionHandler&&) final;
-
-    // All following fields are disposable.
-    bool m_didTimeOut { false };
-    bool m_didUserCancel { false };
-    bool m_didUserVerifyingPlatformAuthenticatorPresent { false };
-    RefPtr<ArrayBuffer> m_credentialId;
-    RefPtr<ArrayBuffer> m_attestationObject;
-    RefPtr<ArrayBuffer> m_authenticatorData;
-    RefPtr<ArrayBuffer> m_signature;
-    RefPtr<ArrayBuffer> m_userHandle;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEB_AUTHN)
diff --git a/Source/WebCore/testing/MockAuthenticatorCoordinator.idl b/Source/WebCore/testing/MockAuthenticatorCoordinator.idl
deleted file mode 100644 (file)
index eac5cb2..0000000
+++ /dev/null
@@ -1,35 +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.
- */
-
-[
-    Conditional=WEB_AUTHN,
-    NoInterfaceObject,
-] interface MockAuthenticatorCoordinator {
-    void setDidTimeOut();
-    void setDidUserCancel();
-    void setDidUserVerifyingPlatformAuthenticatorPresent();
-    void setCreationReturnBundle(BufferSource credentialId, BufferSource attestationObject);
-    void setAssertionReturnBundle(BufferSource credentialId, BufferSource authenticatorData, BufferSource signature, BufferSource userHandle);
-};
index 28c3364..edd212d 100644 (file)
@@ -1,3 +1,23 @@
+2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebAuthN] Polish WebAuthN auto-test environment
+        https://bugs.webkit.org/show_bug.cgi?id=189283
+        <rdar://problem/44117828>
+
+        Reviewed by Chris Dumez.
+
+        This patch changes MockWebAuthenticationConfiguration.local to optional such that tests can express
+        absence of local authenticators.
+
+        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+        (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
+        * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
+        (WebKit::MockLocalConnection::getUserConsent const):
+        (WebKit::MockLocalConnection::getAttestation const):
+        * UIProcess/WebAuthentication/Mock/MockLocalService.cpp:
+        (WebKit::MockLocalService::platformStartDiscovery const):
+        * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
+
 2018-09-28  Jer Noble  <jer.noble@apple.com>
 
         Refactoring: eliminate raw pointer usage in Fullscreen code
index 4a61c95..2ee53d4 100644 (file)
@@ -575,12 +575,16 @@ void WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory(WKWebsiteDataStoreR
 void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configurationRef)
 {
 #if ENABLE(WEB_AUTHN)
-    auto localRef = static_cast<WKDictionaryRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("Local")).get()));
-
     MockWebAuthenticationConfiguration configuration;
-    configuration.local.acceptAuthentication = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("AcceptAuthentication")).get())));
-    configuration.local.acceptAttestation = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("AcceptAttestation")).get())));
-    configuration.local.privateKeyBase64 = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("PrivateKeyBase64")).get())))->string();
+
+    auto localRef = static_cast<WKDictionaryRef>(WKDictionaryGetItemForKey(configurationRef, adoptWK(WKStringCreateWithUTF8CString("Local")).get()));
+    if (localRef) {
+        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())));
+        local.privateKeyBase64 = WebKit::toImpl(static_cast<WKStringRef>(WKDictionaryGetItemForKey(localRef, adoptWK(WKStringCreateWithUTF8CString("PrivateKeyBase64")).get())))->string();
+        configuration.local = WTFMove(local);
+    }
 
     WebKit::toImpl(dataStoreRef)->websiteDataStore().setMockWebAuthenticationConfiguration(WTFMove(configuration));
 #endif
index 627c91f..091d44d 100644 (file)
@@ -73,7 +73,8 @@ void MockLocalConnection::getUserConsent(const String&, UserConsentCallback&& ca
 {
     // Mock async operations.
     RunLoop::main().dispatch([configuration = m_configuration, callback = WTFMove(callback)]() mutable {
-        if (!configuration.local.acceptAuthentication) {
+        ASSERT(configuration.local);
+        if (!configuration.local->acceptAuthentication) {
             callback(UserConsent::No);
             return;
         }
@@ -85,7 +86,8 @@ void MockLocalConnection::getUserConsent(const String&, SecAccessControlRef, Use
 {
     // Mock async operations.
     RunLoop::main().dispatch([configuration = m_configuration, callback = WTFMove(callback)]() mutable {
-        if (!configuration.local.acceptAuthentication) {
+        ASSERT(configuration.local);
+        if (!configuration.local->acceptAuthentication) {
             callback(UserConsent::No, nil);
             return;
         }
@@ -99,7 +101,8 @@ void MockLocalConnection::getAttestation(const String& rpId, const String& usern
 
     // Mock async operations.
     RunLoop::main().dispatch([configuration = m_configuration, rpId, username, hash, callback = WTFMove(callback)]() mutable {
-        if (!configuration.local.acceptAttestation) {
+        ASSERT(configuration.local);
+        if (!configuration.local->acceptAttestation) {
             callback(NULL, NULL, [NSError errorWithDomain:NSOSStatusErrorDomain code:-1 userInfo:nil]);
             return;
         }
@@ -112,7 +115,7 @@ void MockLocalConnection::getAttestation(const String& rpId, const String& usern
         };
         CFErrorRef errorRef = nullptr;
         auto key = adoptCF(SecKeyCreateWithData(
-            (__bridge CFDataRef)adoptNS([[NSData alloc] initWithBase64EncodedString:configuration.local.privateKeyBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters]).get(),
+            (__bridge CFDataRef)adoptNS([[NSData alloc] initWithBase64EncodedString:configuration.local->privateKeyBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters]).get(),
             (__bridge CFDictionaryRef)options,
             &errorRef
         ));
index f0e7999..b054ee6 100644 (file)
@@ -42,8 +42,7 @@ MockLocalService::MockLocalService(Observer& observer, const MockWebAuthenticati
 
 bool MockLocalService::platformStartDiscovery() const
 {
-    // FIXME(189642): we should test false case.
-    return true;
+    return !!m_configuration.local;
 }
 
 UniqueRef<LocalConnection> MockLocalService::createLocalConnection() const
index 074fcac..fdcff37 100644 (file)
@@ -36,7 +36,7 @@ struct MockWebAuthenticationConfiguration {
         String privateKeyBase64;
     };
 
-    Local local;
+    std::optional<Local> local;
 };
 
 } // namespace WebKit
index 9187692..604add6 100644 (file)
@@ -1,3 +1,14 @@
+2018-09-28  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebAuthN] Polish WebAuthN auto-test environment
+        https://bugs.webkit.org/show_bug.cgi?id=189283
+        <rdar://problem/44117828>
+
+        Reviewed by Chris Dumez.
+
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setWebAuthenticationMockConfiguration):
+
 2018-09-28  Chris Dumez  <cdumez@apple.com>
 
         Drop support for cross-origin-window-policy header
index f3604b7..dd4e396 100644 (file)
@@ -2358,52 +2358,55 @@ void TestRunner::setWebAuthenticationMockConfiguration(JSValueRef configurationV
         return;
     JSObjectRef configuration = JSValueToObject(context, configurationValue, 0);
 
+    Vector<WKRetainPtr<WKStringRef>> configurationKeys;
+    Vector<WKRetainPtr<WKTypeRef>> configurationValues;
+
     JSRetainPtr<JSStringRef> localPropertyName(Adopt, JSStringCreateWithUTF8CString("local"));
     JSValueRef localValue = JSObjectGetProperty(context, configuration, localPropertyName.get(), 0);
-    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);
-
-    JSRetainPtr<JSStringRef> privateKeyBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("privateKeyBase64"));
-    JSValueRef privateKeyBase64Value = JSObjectGetProperty(context, local, privateKeyBase64PropertyName.get(), 0);
-    if (!JSValueIsString(context, privateKeyBase64Value))
-        return;
+    if (!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);
+
+        JSRetainPtr<JSStringRef> privateKeyBase64PropertyName(Adopt, JSStringCreateWithUTF8CString("privateKeyBase64"));
+        JSValueRef privateKeyBase64Value = JSObjectGetProperty(context, local, privateKeyBase64PropertyName.get(), 0);
+        if (!JSValueIsString(context, privateKeyBase64Value))
+            return;
+
+        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());
+        localKeys.append({ AdoptWK, WKStringCreateWithUTF8CString("PrivateKeyBase64") });
+        localValues.append(toWK(adopt(JSValueToStringCopy(context, privateKeyBase64Value, 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();
+        }
 
-    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());
-    localKeys.append({ AdoptWK, WKStringCreateWithUTF8CString("PrivateKeyBase64") });
-    localValues.append(toWK(adopt(JSValueToStringCopy(context, privateKeyBase64Value, 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()) });
     }
 
-    Vector<WKRetainPtr<WKStringRef>> configurationKeys;
-    Vector<WKRetainPtr<WKTypeRef>> configurationValues;
-    configurationKeys.append({ AdoptWK, WKStringCreateWithUTF8CString("Local") });
-    configurationValues.append({ AdoptWK, WKDictionaryCreate(rawLocalKeys.data(), rawLocalValues.data(), rawLocalKeys.size()) });
-
     Vector<WKStringRef> rawConfigurationKeys;
     Vector<WKTypeRef> rawConfigurationValues;
     rawConfigurationKeys.resize(configurationKeys.size());