Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<meta charset="utf-8">
<title>FedCM IDP log-in status API tests</title>
<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 {request_options_with_mediation_required,
fedcm_test,
fedcm_get_dialog_type_promise,
select_manifest,
mark_signed_in} from '../support/fedcm-helper.sub.js';
fedcm_test(async t => {
await mark_signed_in();
let test_options = request_options_with_mediation_required("manifest_broken_login.json");
await select_manifest(t, test_options);
let cred_promise = navigator.credentials.get(test_options);
let type = await fedcm_get_dialog_type_promise(t);
assert_equals(type, "ConfirmIdpLogin");
// Manifest selection only persists for a single fetch, so we need to set it
// again because Chrome's implementation re-fetches the manifest as well, not
// just the accounts endpoint.
// TODO(crbug.com/392661388): This is not technically spec-compliant
await select_manifest(t, test_options);
await window.test_driver.click_fedcm_dialog_button("ConfirmIdpLoginContinue");
// Because the login page never sends a signin status header, we
// expect a promise rejection.
return promise_rejects_dom(t, 'NetworkError', cred_promise);
}, 'Tests that the promise does get resolved if a login page does not send a signin status header.');
</script>