summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webauthn
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/webauthn')
-rw-r--r--testing/web-platform/tests/webauthn/WEB_FEATURES.yml4
-rw-r--r--testing/web-platform/tests/webauthn/createcredential-passing.https.html4
-rw-r--r--testing/web-platform/tests/webauthn/createcredential-pubkeycredparams.https.html8
-rw-r--r--testing/web-platform/tests/webauthn/getcredential-allowcredentials.https.html77
4 files changed, 89 insertions, 4 deletions
diff --git a/testing/web-platform/tests/webauthn/WEB_FEATURES.yml b/testing/web-platform/tests/webauthn/WEB_FEATURES.yml
new file mode 100644
index 0000000000..8b273de80b
--- /dev/null
+++ b/testing/web-platform/tests/webauthn/WEB_FEATURES.yml
@@ -0,0 +1,4 @@
+features:
+- name: webauthn-public-key-easy
+ files:
+ - createcredential-getpublickey.https.html
diff --git a/testing/web-platform/tests/webauthn/createcredential-passing.https.html b/testing/web-platform/tests/webauthn/createcredential-passing.https.html
index f64a4ff039..4124c2247e 100644
--- a/testing/web-platform/tests/webauthn/createcredential-passing.https.html
+++ b/testing/web-platform/tests/webauthn/createcredential-passing.https.html
@@ -58,6 +58,10 @@ standardSetup(function() {
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [pkParamEC512, pkParamEC256])
.runTest("SelectEC256 pubKeyCredParams from a list");
+ // pubKeyCredParams with unknown value
+ new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [{ "type": "unknown", alg: -7, }, { "type": "public-key", alg: -7, }])
+ .runTest("pubKeyCredParams with unknown value");
+
// timeout
new CreateCredentialsTest({path: "options.publicKey.timeout", value: undefined}).runTest("passing credentials.create() with no timeout");
diff --git a/testing/web-platform/tests/webauthn/createcredential-pubkeycredparams.https.html b/testing/web-platform/tests/webauthn/createcredential-pubkeycredparams.https.html
index d1df7952d6..cb830bfe92 100644
--- a/testing/web-platform/tests/webauthn/createcredential-pubkeycredparams.https.html
+++ b/testing/web-platform/tests/webauthn/createcredential-pubkeycredparams.https.html
@@ -36,10 +36,10 @@ standardSetup(function() {
new CreateCredentialsTest({path: "options.publicKey.pubKeyCredParams", value: undefined}).runTest("Bad pubKeyCredParams: pubKeyCredParams is undefined", TypeError);
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", "hi mom").runTest("Bad pubKeyCredParams: pubKeyCredParams is string", TypeError);
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", null).runTest("Bad pubKeyCredParams: pubKeyCredParams is null", TypeError);
- new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badType]).runTest("Bad pubKeyCredParams: first param has bad type (\"something-else\")", TypeError);
- new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badTypeEmptyString]).runTest("Bad pubKeyCredParams: first param has bad type (\"\")", TypeError);
- new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badTypeNull]).runTest("Bad pubKeyCredParams: first param has bad type (null)", TypeError);
- new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badTypeEmptyObj]).runTest("Bad pubKeyCredParams: first param has bad type (empty object)", TypeError);
+ new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badType]).runTest("Bad pubKeyCredParams: first param has bad type (\"something-else\")", "NotSupportedError");
+ new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badTypeEmptyString]).runTest("Bad pubKeyCredParams: first param has bad type (\"\")", "NotSupportedError");
+ new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badTypeNull]).runTest("Bad pubKeyCredParams: first param has bad type (null)", "NotSupportedError");
+ new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badTypeEmptyObj]).runTest("Bad pubKeyCredParams: first param has bad type (empty object)", "NotSupportedError");
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badAlg])
.modify("options.publicKey.timeout", 300)
.runTest("Bad pubKeyCredParams: first param has bad alg (42)", "NotAllowedError");
diff --git a/testing/web-platform/tests/webauthn/getcredential-allowcredentials.https.html b/testing/web-platform/tests/webauthn/getcredential-allowcredentials.https.html
new file mode 100644
index 0000000000..0263774142
--- /dev/null
+++ b/testing/web-platform/tests/webauthn/getcredential-allowcredentials.https.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>navigator.credentials.get() tests with allowCredentials</title>
+<meta name="timeout" content="long">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src=helpers.js></script>
+<body></body>
+<script>
+standardSetup(async function() {
+ "use strict";
+
+ promise_test(async t => {
+ await navigator.credentials.get({publicKey: {
+ challenge: new Uint8Array(),
+ allowCredentials: [{
+ id: (await createCredential()).rawId,
+ type: "public-key",
+ }],
+ }});
+ }, "navigator.credentials.get() with public-key allowCredentials.");
+
+ promise_test(async t => {
+ return promise_rejects_dom(t, "NotAllowedError",
+ navigator.credentials.get({publicKey: {
+ challenge: new Uint8Array(),
+ allowCredentials: [],
+ }}));
+ }, "navigator.credentials.get() with empty allowCredentials.");
+
+ promise_test(async t => {
+ return promise_rejects_dom(t, "NotAllowedError",
+ navigator.credentials.get({publicKey: {
+ challenge: new Uint8Array(),
+ allowCredentials: [{
+ id: (await createCredential()).rawId,
+ type: "not-yet-supported-by-browser",
+ }],
+ }}));
+ }, "navigator.credentials.get() with unknown allowCredentials.");
+
+ promise_test(async t => {
+ await navigator.credentials.get({publicKey: {
+ challenge: new Uint8Array(),
+ allowCredentials: [{
+ id: (await createCredential()).rawId,
+ type: "not-yet-supported-by-browser",
+ },
+ {
+ id: (await createCredential()).rawId,
+ type: "public-key",
+ }],
+ }});
+ }, "navigator.credentials.get() with mixing allowCredentials with first unknown type.");
+
+ promise_test(async t => {
+ await navigator.credentials.get({publicKey: {
+ challenge: new Uint8Array(),
+ allowCredentials: [{
+ id: (await createCredential()).rawId,
+ type: "public-key",
+ },
+ {
+ id: (await createCredential()).rawId,
+ type: "not-yet-supported-by-browser",
+ }],
+ }});
+ }, "navigator.credentials.get() with mixing allowCredentials with last unknown type.");
+}, {
+ protocol: "ctap2_1",
+ hasResidentKey: true,
+ hasUserVerification: true,
+ isUserVerified: true,
+});
+</script>