test_two_accounts.html (1589B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Two Accounts in the List</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script src="head.js"></script> 8 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 9 <script> 10 SimpleTest.waitForExplicitFinish(); 11 setupTest("two_accounts").then( 12 function () { 13 SpecialPowers.wrap(document).notifyUserGestureActivation(); 14 return navigator.credentials.get({ 15 identity: { 16 mode: "active", 17 providers: [{ 18 configURL: "https://example.net/tests/dom/credentialmanagement/identity/tests/mochitest/server_manifest.sjs", 19 clientId: "mochitest", 20 nonce: "nonce" 21 }] 22 } 23 }); 24 } 25 ).then((cred) => { 26 ok(true, "successfully got a credential"); 27 is(cred.token, 28 "account_id=1234&client_id=mochitest&nonce=nonce&disclosure_text_shown=false&is_auto_selected=false", 29 "Correct token on the credential."); 30 is(cred.id, 31 "1234", 32 "Correct id on the credential"); 33 is(cred.type, 34 "identity", 35 "Correct type on the credential"); 36 }).catch(() => { 37 ok(false, "must not have an error"); 38 }).finally(() => { 39 SimpleTest.finish(); 40 }) 41 </script> 42 </head> 43 <body> 44 <p id="display"></p> 45 <div id="content" style="display: none">This test is temporary until we have an account chooser. It verifies that when we get more than one account from the IDP we just pick the first one.</div> 46 <pre id="test"></pre> 47 </body> 48 </html>