diff options
author | WPT Sync Bot <josh+wptsync@joshmatthews.net> | 2018-07-19 21:07:28 -0400 |
---|---|---|
committer | WPT Sync Bot <josh+wptsync@joshmatthews.net> | 2018-07-19 22:44:23 -0400 |
commit | 158f7eec0eb23882a3ee56144c2dba24f0a14f72 (patch) | |
tree | 88351345304208969bab3c3a80dadf5028623f1c /tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js | |
parent | 908a642063fc5b024b19e732636165c2cb82c00a (diff) | |
download | servo-158f7eec0eb23882a3ee56144c2dba24f0a14f72.tar.gz servo-158f7eec0eb23882a3ee56144c2dba24f0a14f72.zip |
Update web-platform-tests to revision abd18b3e018d25ed668d179c905b7869dca5e239
Diffstat (limited to 'tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js')
-rw-r--r-- | tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js b/tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js new file mode 100644 index 00000000000..8ca5b99c861 --- /dev/null +++ b/tests/wpt/web-platform-tests/webauthn/idlharness.https.window.js @@ -0,0 +1,59 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +// META: script=helpers.js + +// https://w3c.github.io/webauthn/ + +'use strict'; + +promise_test(() => { + const execute_test = () => idl_test( + ['webauthn'], + ['credential-management'], + idlArray => { + idlArray.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};"); + idlArray.add_objects({ + WebAuthentication: ['navigator.authentication'], + PublicKeyCredential: ['cred'], + AuthenticatorAssertionResponse: ['assertionResponse'] + }); + }, + 'WebAuthn interfaces.' + ); + + let challengeBytes = new Uint8Array(16); + window.crypto.getRandomValues(challengeBytes); + + return createCredential({ + options: { + publicKey: { + timeout: 3000, + user: { + id: new Uint8Array(16), + }, + } + } + }) + .then(cred => { + self.cred = cred; + return navigator.credentials.get({ + publicKey: { + timeout: 3000, + allowCredentials: [{ + id: cred.rawId, + transports: ["usb", "nfc", "ble"], + type: "public-key" + }], + challenge: challengeBytes, + } + }); + }) + .then(assertion => { + self.assertionResponse = assertion.response; + }) + .then(execute_test) + .catch(reason => { + execute_test(); + return Promise.reject(reason); + }); +}); |