[FedCM] Check that clientId is passed to disconnect()

Bug: 1473134
Change-Id: Ie5484d6966f75339318bba84ff62320e783c8a6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5057596
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1228595}
diff --git a/credential-management/fedcm-disconnect-errors.https.html b/credential-management/fedcm-disconnect-errors.https.html
new file mode 100644
index 0000000..7168d3b
--- /dev/null
+++ b/credential-management/fedcm-disconnect-errors.https.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<title>Federated Credential Management API disconnect() basic errors.</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>
+
+<body>
+
+<script type="module">
+import {fedcm_test,
+        mark_signed_in,
+        set_fedcm_cookie,
+        fedcm_get_and_select_first_account,
+        manifest_origin,
+        request_options_with_mediation_required} from './support/fedcm-helper.sub.js';
+
+fedcm_test(async t => {
+  await mark_signed_in();
+  await set_fedcm_cookie();
+  // Get at least one connected account that can be disconnected.
+  const cred = await fedcm_get_and_select_first_account(t, request_options_with_mediation_required());
+  const manifest = `${manifest_origin}/\
+credential-management/support/fedcm/manifest.py`;
+  let disconnect = IdentityCredential.disconnect({
+    configURL: manifest,
+    clientId: '1'
+  });
+  await promise_rejects_dom(t, 'InvalidStateError', disconnect);
+  disconnect = IdentityCredential.disconnect({
+    configURL: manifest,
+    accountHint: 'hint'
+  });
+  await promise_rejects_dom(t, 'InvalidStateError', disconnect);
+  disconnect = IdentityCredential.disconnect({
+    clientId: '1',
+    accountHint: 'hint'
+  });
+  return promise_rejects_dom(t, 'InvalidStateError', disconnect);
+}, "disconnect requires 3 parameters: configURL, clientId, and accountHint");
+</script>