test_two_providers.html (1684B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Two Providers in a Credential.get()</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_providers").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 configURL: "https://example.net/tests/dom/credentialmanagement/identity/tests/mochitest/server_manifest.sjs", 24 clientId: "mochitest", 25 nonce: "nonce2" 26 } 27 ] 28 } 29 }); 30 } 31 ).then((cred) => { 32 ok(true, "successfully got a credential"); 33 is(cred.token, 34 "account_id=1234&client_id=mochitest&nonce=nonce&disclosure_text_shown=false&is_auto_selected=false", 35 "Correct token on the credential."); 36 is(cred.id, 37 "1234", 38 "Correct id on the credential"); 39 is(cred.type, 40 "identity", 41 "Correct type on the credential"); 42 }).catch(() => { 43 ok(false, "must not have an error"); 44 }).finally(() => { 45 SimpleTest.finish(); 46 }) 47 </script> 48 </head> 49 <body> 50 <p id="display"></p> 51 <div id="content" style="display: none"></div> 52 <pre id="test"></pre> 53 </body> 54 </html>