summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/credential-management/fedcm-authz/fedcm-userinfo-after-resolve.https.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/credential-management/fedcm-authz/fedcm-userinfo-after-resolve.https.html')
-rw-r--r--testing/web-platform/tests/credential-management/fedcm-authz/fedcm-userinfo-after-resolve.https.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/web-platform/tests/credential-management/fedcm-authz/fedcm-userinfo-after-resolve.https.html b/testing/web-platform/tests/credential-management/fedcm-authz/fedcm-userinfo-after-resolve.https.html
new file mode 100644
index 0000000000..ef53ed4ffc
--- /dev/null
+++ b/testing/web-platform/tests/credential-management/fedcm-authz/fedcm-userinfo-after-resolve.https.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<title>Federated Credential Management API authz getUserInfo() 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>
+
+<body>
+
+<script type="module">
+import {alt_manifest_origin,
+ alt_request_options_with_mediation_required,
+ select_manifest,
+ fedcm_test,
+ fedcm_get_and_select_first_account} from '../support/fedcm-helper.sub.js';
+
+async function createIframeWithPermissionPolicyAndWaitForMessage(test, iframeUrl) {
+ const messageWatcher = new EventWatcher(test, window, "message");
+ let iframe = document.createElement("iframe");
+ iframe.src = iframeUrl;
+ iframe.allow = "identity-credentials-get";
+ document.body.appendChild(iframe);
+ const message = await messageWatcher.wait_for("message");
+ return message.data;
+}
+
+fedcm_test(async t => {
+ const options = alt_request_options_with_mediation_required('manifest_with_continue_on.json');
+ await select_manifest(t, options);
+ const cred = await fedcm_get_and_select_first_account(t, options);
+ assert_equals(cred.token, "resolved token");
+
+ const iframe_in_idp_scope = `${alt_manifest_origin}/\
+credential-management/support/fedcm/userinfo-iframe.html`;
+ const message = await createIframeWithPermissionPolicyAndWaitForMessage(t, iframe_in_idp_scope);
+ assert_equals(message.result, "Pass");
+ assert_equals(message.numAccounts, 1);
+ assert_equals(message.firstAccountEmail, "john_doe@idp.example");
+ assert_equals(message.firstAccountName, "John Doe");
+ assert_equals(message.firstAccountGivenName, "John");
+ assert_equals(message.firstAccountPicture, "https://idp.example/profile/123");
+}, 'Test getUserInfo() after resolve() to verify that resolve stores the RP/IDP connection');
+
+</script>