diff options
Diffstat (limited to 'testing/web-platform/tests/webtransport/server-certificate-hashes.https.any.js')
-rw-r--r-- | testing/web-platform/tests/webtransport/server-certificate-hashes.https.any.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webtransport/server-certificate-hashes.https.any.js b/testing/web-platform/tests/webtransport/server-certificate-hashes.https.any.js new file mode 100644 index 0000000000..01efab1191 --- /dev/null +++ b/testing/web-platform/tests/webtransport/server-certificate-hashes.https.any.js @@ -0,0 +1,21 @@ +// META: global=window,worker +// META: script=/common/get-host-info.sub.js +// META: script=resources/webtransport-test-helpers.sub.js + +promise_test(async t => { + const hashValue = new Uint8Array(32); + // The connection fails because the fingerprint does not match. + const wt = new WebTransport(webtransport_url('echo.py'), { + serverCertificateHashes: [ + { + algorithm: "sha-256", + value: hashValue, + } + ] + }); + + const e = await wt.ready.catch(e => e); + await promise_rejects_exactly(t, e, wt.ready, 'ready should be rejected'); + await promise_rejects_exactly(t, e, wt.closed, 'closed should be rejected'); + assert_true(e instanceof WebTransportError); +}, 'Connection fails due to certificate hash mismatch'); |