tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

confirm-idp-login.https.html (1543B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>FedCM IDP log-in status API tests</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/testdriver.js"></script>
      7 <script src="/resources/testdriver-vendor.js"></script>
      8 
      9 <script type="module">
     10 import {request_options_with_mediation_required,
     11        fedcm_test,
     12        fedcm_get_dialog_type_promise,
     13        select_manifest} from '../support/fedcm-helper.sub.js';
     14 
     15 fedcm_test(async t => {
     16  let test_options = request_options_with_mediation_required("manifest_with_variable_accounts.json");
     17  await select_manifest(t, test_options);
     18 
     19  let cred_promise = navigator.credentials.get(test_options);
     20  let type = await fedcm_get_dialog_type_promise(t);
     21  assert_equals(type, "ConfirmIdpLogin");
     22 
     23  // Manifest selection only persists for a single fetch, so we need to set it
     24  // again because Chrome's implementation re-fetches the manifest as well, not
     25  // just the accounts endpoint.
     26  // TODO(crbug.com/392661388): This is not technically spec-compliant
     27  await select_manifest(t, test_options);
     28  await window.test_driver.click_fedcm_dialog_button("ConfirmIdpLoginContinue");
     29 
     30  // Now wait for the account chooser.
     31  type = await fedcm_get_dialog_type_promise(t);
     32  assert_equals(type, "AccountChooser");
     33  window.test_driver.select_fedcm_account(0);
     34 
     35  let cred = await cred_promise;
     36  assert_equals(cred.token, "account_id=1234");
     37 }, 'Tests the IDP login dialog and subsequent account chooser.');
     38 </script>