| <!DOCTYPE html><!-- webkit-test-runner [ WebAuthenticationModernEnabled=true ] --> |
| <title>Web Authentication API: PublicKeyCredential's [[get]] failure cases with a mock nfc authenticator.</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="./resources/util.js"></script> |
| <script> |
| // Default mock configuration. Tests need to override if they need different configuration. |
| if (window.internals) |
| internals.setMockWebAuthenticationConfiguration({ nfc: { error: "malicious-payload" } }); |
| |
| promise_test(t => { |
| const options = { |
| publicKey: { |
| challenge: asciiToUint8Array("123456"), |
| allowCredentials: [ |
| { type: "public-key", id: Base64URL.parse(testHidCredentialIdBase64), transports: ["usb"] }, |
| { type: "public-key", id: Base64URL.parse(testHidCredentialIdBase64), transports: ["ble"] }, |
| { type: "public-key", id: Base64URL.parse(testHidCredentialIdBase64), transports: ["internal"] } |
| ], |
| timeout: 10 |
| } |
| }; |
| |
| return promiseRejects(t, "NotAllowedError", navigator.credentials.get(options), "Operation timed out."); |
| }, "PublicKeyCredential's [[get]] with timeout in a mock nfc authenticator."); |
| </script> |