Add WPTs for navigator.credentials.store() with unsupported cred types

Add web platform tests for navigator.credentials.store() with web otp,
public key (webauthn) and identity (fedcm) credentials. These must all
return NotSupportedError, but there was no test asserting that.

Also fix the error description for credential types other than webauthn.

Fixed: 1463439
Change-Id: Ic1a2959a36e9f2f74982afc214697bb5acac2f42
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4973504
Reviewed-by: Nicolás Peña <npm@chromium.org>
Auto-Submit: Nina Satragno <nsatragno@chromium.org>
Commit-Queue: Nina Satragno <nsatragno@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215695}
diff --git a/credential-management/fedcm-store.https.html b/credential-management/fedcm-store.https.html
new file mode 100644
index 0000000..d1e6ef4
--- /dev/null
+++ b/credential-management/fedcm-store.https.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<title>Federated Credential Management API store() tests.</title>
+<link rel="help" href="https://fedidcg.github.io/FedCM">
+<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 type="module">
+import {fedcm_test,
+        request_options_with_mediation_required,
+        fedcm_get_and_select_first_account} from "./support/fedcm-helper.sub.js";
+
+fedcm_test(async t => {
+  const cred = await fedcm_get_and_select_first_account(t, request_options_with_mediation_required());
+  return promise_rejects_dom(t, "NotSupportedError", navigator.credentials.store(cred));
+}, "navigator.credentials.store() with an identity credential returns NotSupportedError");
+
+</script>
diff --git a/credential-management/otpcredential-store.https.html b/credential-management/otpcredential-store.https.html
new file mode 100644
index 0000000..fa2ae89
--- /dev/null
+++ b/credential-management/otpcredential-store.https.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<link rel="help" href="https://github.com/WICG/WebOTP">
+<title>Tests OTPCredential handing of store()</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script type="module">
+import {Status, expectOTPRequest} from "./support/otpcredential-helper.js";
+
+promise_test(async t => {
+  await expectOTPRequest().andReturn(
+      () => ({status: Status.SUCCESS, otp: "ABC"}));
+
+  const cred = await navigator.credentials.get({otp: {transport: ["sms"]}});
+  return promise_rejects_dom(t, "NotSupportedError", navigator.credentials.store(cred));
+}, "navigator.credentials.store() with an otp credential returns NotSupportedError");
+
+</script>
diff --git a/webauthn/storecredential.https.html b/webauthn/storecredential.https.html
new file mode 100644
index 0000000..726b289
--- /dev/null
+++ b/webauthn/storecredential.https.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<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>
+<script>
+    "use strict";
+
+    virtualAuthenticatorPromiseTest(async t => {
+        const cred = await navigator.credentials.get({publicKey: {
+            challenge: new Uint8Array(),
+            allowCredentials: [{
+                id: (await createCredential()).rawId,
+                type: "public-key",
+            }],
+        }});
+        return promise_rejects_dom(t, "NotSupportedError", navigator.credentials.store(cred));
+    }, {}, "navigator.credentials.store() throws NotAllowedError with a public key credential");
+
+</script>