Automatic update from web-platform-tests [FedCM] Removing picture URLs Removing the picture URLs as they take a long time to load and most tests do not need them. Made a new picture_account.py and manifest_with_picture_account.json for tests which need the URL. Bug: 41482163 Change-Id: Ib9756d6d39034b8a7a19d91c8977c92600d5a14a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6872503 Commit-Queue: Jaimukund Bhan <bhanjaimukund@gmail.com> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Christian Biesinger <cbiesinger@chromium.org> Cr-Commit-Position: refs/heads/main@{#1505841} -- wpt-commits: 38c66e872352352b56329736d345ad546abe3dbb wpt-pr: 54504
71 lines
2.8 KiB
HTML
71 lines
2.8 KiB
HTML
<!DOCTYPE html>
|
|
<title>Federated Credential Management API getUserInfo() tests.</title>
|
|
<meta name="timeout" content="long">
|
|
<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,
|
|
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);
|
|
let message = null;
|
|
// Ignore internal "testdriver-complete" messages.
|
|
do {
|
|
message = await messageWatcher.wait_for("message");
|
|
} while (!("result" in message.data));
|
|
return message.data;
|
|
}
|
|
|
|
fedcm_test(async t => {
|
|
const cred = await fedcm_get_and_select_first_account(t, alt_request_options_with_mediation_required());
|
|
assert_equals(cred.token, "token");
|
|
|
|
const iframe_in_idp_scope = `${alt_manifest_origin}/\
|
|
fedcm/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://localhost/profile/123");
|
|
}, 'Test basic User Info API flow');
|
|
|
|
fedcm_test(async t => {
|
|
const cred = await fedcm_get_and_select_first_account(t, alt_request_options_with_mediation_required());
|
|
assert_equals(cred.token, "token");
|
|
|
|
const iframe_in_idp_scope = `support/fedcm/userinfo-iframe.html`;
|
|
const message = await createIframeWithPermissionPolicyAndWaitForMessage(t, iframe_in_idp_scope);
|
|
assert_equals(message.result, "Fail");
|
|
}, 'Test that User Info API only works when invoked from iframe that is same origin as the IDP');
|
|
|
|
fedcm_test(async t => {
|
|
const cred = await fedcm_get_and_select_first_account(t, alt_request_options_with_mediation_required());
|
|
assert_equals(cred.token, "token");
|
|
|
|
const manifest_path = `${alt_manifest_origin}/\
|
|
fedcm/support/fedcm/manifest.py`;
|
|
await promise_rejects_dom(t, 'InvalidStateError',
|
|
IdentityProvider.getUserInfo({
|
|
configURL: manifest_path,
|
|
// Approved client
|
|
clientId: '123',
|
|
}))
|
|
}, 'Test that User Info API does not work in the top frame');
|
|
|
|
</script>
|