fedcm-multi-idp-mediation-silent.https.html (1755B)
1 <!DOCTYPE html> 2 <title>Federated Credential Management API multi IDP silent mediation tests.</title> 3 <meta name="timeout" content="long"> 4 <link rel="help" href="https://fedidcg.github.io/FedCM"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 10 <script type="module"> 11 import {request_options_with_two_idps, 12 fedcm_test, 13 fedcm_get_and_select_first_account, 14 fedcm_select_account_promise} from '../support/fedcm-helper.sub.js'; 15 16 fedcm_test(async t => { 17 const cred = navigator.credentials.get(request_options_with_two_idps('silent')); 18 return promise_rejects_dom(t, 'NetworkError', cred); 19 }, "Mediation silent fails if there is no returning account."); 20 21 fedcm_test(async t => { 22 // Sign in to the first account. 23 await fedcm_get_and_select_first_account(t, request_options_with_two_idps()); 24 25 // Now use mediation:silent and it should work. 26 return navigator.credentials.get(request_options_with_two_idps('silent')); 27 }, "Mediation silent succeeds when there is one returning account."); 28 29 fedcm_test(async t => { 30 // Sign in to the first account. 31 await fedcm_get_and_select_first_account(t, request_options_with_two_idps()); 32 33 // Sign in to the second account as well. 34 let cred = navigator.credentials.get(request_options_with_two_idps()); 35 fedcm_select_account_promise(t, 1); 36 await cred; 37 38 // Now use mediation:silent and it should fail. 39 cred = navigator.credentials.get(request_options_with_two_idps('silent')); 40 return promise_rejects_dom(t, 'NetworkError', cred); 41 }, "Mediation silent fails when there is more than one returning account."); 42 </script>