getcredential-allowcredentials.https.html (2409B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>navigator.credentials.get() tests with allowCredentials</title> 4 <meta name="timeout" content="long"> 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 <script src=helpers.js></script> 10 <body></body> 11 <script> 12 standardSetup(async function() { 13 "use strict"; 14 15 promise_test(async t => { 16 await navigator.credentials.get({publicKey: { 17 challenge: new Uint8Array(), 18 allowCredentials: [{ 19 id: (await createCredential()).rawId, 20 type: "public-key", 21 }], 22 }}); 23 }, "navigator.credentials.get() with public-key allowCredentials."); 24 25 promise_test(async t => { 26 return promise_rejects_dom(t, "NotAllowedError", 27 navigator.credentials.get({publicKey: { 28 challenge: new Uint8Array(), 29 allowCredentials: [], 30 }})); 31 }, "navigator.credentials.get() with empty allowCredentials."); 32 33 promise_test(async t => { 34 return promise_rejects_dom(t, "NotAllowedError", 35 navigator.credentials.get({publicKey: { 36 challenge: new Uint8Array(), 37 allowCredentials: [{ 38 id: (await createCredential()).rawId, 39 type: "not-yet-supported-by-browser", 40 }], 41 }})); 42 }, "navigator.credentials.get() with unknown allowCredentials."); 43 44 promise_test(async t => { 45 await navigator.credentials.get({publicKey: { 46 challenge: new Uint8Array(), 47 allowCredentials: [{ 48 id: (await createCredential()).rawId, 49 type: "not-yet-supported-by-browser", 50 }, 51 { 52 id: (await createCredential()).rawId, 53 type: "public-key", 54 }], 55 }}); 56 }, "navigator.credentials.get() with mixing allowCredentials with first unknown type."); 57 58 promise_test(async t => { 59 await navigator.credentials.get({publicKey: { 60 challenge: new Uint8Array(), 61 allowCredentials: [{ 62 id: (await createCredential()).rawId, 63 type: "public-key", 64 }, 65 { 66 id: (await createCredential()).rawId, 67 type: "not-yet-supported-by-browser", 68 }], 69 }}); 70 }, "navigator.credentials.get() with mixing allowCredentials with last unknown type."); 71 }, { 72 protocol: "ctap2_1", 73 hasResidentKey: true, 74 hasUserVerification: true, 75 isUserVerified: true, 76 }); 77 </script>