fedcm-multi-idp-mediation-optional.https.html (1646B)
1 <!DOCTYPE html> 2 <title>Federated Credential Management API multi IDP optional mediation tests.</title> 3 <link rel="help" href="https://fedidcg.github.io/FedCM"> 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_two_idps, 11 fedcm_test, 12 fedcm_get_and_select_first_account, 13 fedcm_select_account_promise} from '../support/fedcm-helper.sub.js'; 14 15 fedcm_test(async t => { 16 return fedcm_get_and_select_first_account(t, request_options_with_two_idps('optional')); 17 }, "Mediation optional can succeed without a returning account."); 18 19 fedcm_test(async t => { 20 // Sign in to the first account. 21 await fedcm_get_and_select_first_account(t, request_options_with_two_idps()); 22 23 // Now use mediation:optional and it should work. 24 return navigator.credentials.get(request_options_with_two_idps('optional')); 25 }, "Mediation optional automatically succeeds when there is one returning account."); 26 27 fedcm_test(async t => { 28 // Sign in to the first account. 29 await fedcm_get_and_select_first_account(t, request_options_with_two_idps()); 30 31 // Sign in to the second account as well. 32 let cred = navigator.credentials.get(request_options_with_two_idps()); 33 fedcm_select_account_promise(t, 1); 34 await cred; 35 36 // Now use mediation:optional. 37 return fedcm_get_and_select_first_account(t, request_options_with_two_idps('optional')); 38 }, "Mediation optional can succeed when there is more than one returning account."); 39 </script>