Improve WebAuthn NFC tests after r252297
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Nov 2019 01:35:20 +0000 (01:35 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Nov 2019 01:35:20 +0000 (01:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=204251

Reviewed by Alexey Proskuryakov.

This patch fixes a test failure after r252297 and adds new test contents for r252297.

* http/wpt/webauthn/public-key-credential-create-failure-nfc.https-expected.txt:
* http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html:
* http/wpt/webauthn/public-key-credential-create-success-nfc.https-expected.txt:
* http/wpt/webauthn/public-key-credential-create-success-nfc.https.html:

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

LayoutTests/ChangeLog
LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https-expected.txt
LayoutTests/http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html
LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https-expected.txt
LayoutTests/http/wpt/webauthn/public-key-credential-create-success-nfc.https.html

index 6fe4bf5..387d5af 100644 (file)
@@ -1,3 +1,17 @@
+2019-11-19  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Improve WebAuthn NFC tests after r252297
+        https://bugs.webkit.org/show_bug.cgi?id=204251
+
+        Reviewed by Alexey Proskuryakov.
+
+        This patch fixes a test failure after r252297 and adds new test contents for r252297.
+
+        * http/wpt/webauthn/public-key-credential-create-failure-nfc.https-expected.txt:
+        * http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html:
+        * http/wpt/webauthn/public-key-credential-create-success-nfc.https-expected.txt:
+        * http/wpt/webauthn/public-key-credential-create-success-nfc.https.html:
+
 2019-11-19  Sunny He  <sunny_he@apple.com>
 
         Nullptr crash in Node::setTextContent via Document::setTitle if title element is removed before setTextContent call.
index e725098..817b584 100644 (file)
@@ -5,4 +5,5 @@ PASS PublicKeyCredential's [[create]] with wrong tag type in a mock nfc authenti
 PASS PublicKeyCredential's [[create]] with no connections in a mock nfc authenticator. 
 PASS PublicKeyCredential's [[create]] with null version in a mock nfc authenticator. 
 PASS PublicKeyCredential's [[create]] with wrong version in a mock nfc authenticator. 
+PASS PublicKeyCredential's [[create]] with wrong version in a mock nfc authenticator.2 
 
index 25353f0..2389570 100644 (file)
         return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
     }, "PublicKeyCredential's [[create]] with wrong version in a mock nfc authenticator.");
 
+    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: 10
+            }
+        };
+
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload", payloadBase64:[testDummyMessagePayloadBase64, testDummyMessagePayloadBase64] } });
+        return promiseRejects(t, "NotAllowedError", navigator.credentials.create(options), "Operation timed out.");
+    }, "PublicKeyCredential's [[create]] with wrong version in a mock nfc authenticator.2");
+
 </script>
index d374d69..7beebea 100644 (file)
@@ -5,4 +5,5 @@ PASS PublicKeyCredential's [[create]] with multiple tags in a mock nfc authentic
 PASS PublicKeyCredential's [[create]] with U2F in a mock nfc authenticator. 
 PASS PublicKeyCredential's [[create]] with multiple physical tags in a mock nfc authenticator. 
 PASS PublicKeyCredential's [[create]] with service restart in a mock nfc authenticator. 
+PASS PublicKeyCredential's [[create]] with legacy U2F keys in a mock nfc authenticator. 
 
index 0b9622a..0dc0349 100644 (file)
         };
 
         if (window.internals)
-            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, nfc: { error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64, testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64] } });
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, nfc: { error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64, testDummyMessagePayloadBase64, testNfcCtapVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64] } });
         return navigator.credentials.create(options).then(credential => {
             checkCtapMakeCredentialResult(credential);
         });
     }, "PublicKeyCredential's [[create]] with service restart in a mock nfc authenticator.");
+
+    promise_test(t => {
+        const options = {
+            publicKey: {
+                rp: {
+                    name: "localhost",
+                },
+                user: {
+                    name: "John Appleseed",
+                    id: Base64URL.parse(testUserhandleBase64),
+                    displayName: "Appleseed",
+                },
+                challenge: Base64URL.parse("MTIzNDU2"),
+                pubKeyCredParams: [{ type: "public-key", alg: -7 }]
+            }
+        };
+
+        if (window.internals)
+            internals.setMockWebAuthenticationConfiguration({ silentFailure: true, nfc: { error: "malicious-payload", payloadBase64: [testDummyMessagePayloadBase64, testNfcU2fVersionBase64, testGetInfoResponseApduBase64, testCreationMessageApduBase64] } });
+        return navigator.credentials.create(options).then(credential => {
+            checkCtapMakeCredentialResult(credential);
+        });
+    }, "PublicKeyCredential's [[create]] with legacy U2F keys in a mock nfc authenticator.");
 </script>