mirror of
https://github.com/servo/servo.git
synced 2025-08-27 16:18:21 +01:00
Update web-platform-tests to revision ac3d096a5972dea5ecca1c43e324086895db7c6f
This commit is contained in:
parent
1c74a80e28
commit
db54f176d0
47 changed files with 860 additions and 246 deletions
|
@ -309,6 +309,21 @@ function listenToConnected(pc) {
|
|||
});
|
||||
}
|
||||
|
||||
// Returns a promise that resolves when |pc.connectionState| is in one of the
|
||||
// wanted states.
|
||||
function waitForConnectionStateChange(pc, wantedStates) {
|
||||
return new Promise((resolve) => {
|
||||
if (wantedStates.includes(pc.connectionState)) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
pc.addEventListener('connectionstatechange', () => {
|
||||
if (wantedStates.includes(pc.connectionState))
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Resolves when RTP packets have been received.
|
||||
function listenForSSRCs(t, receiver) {
|
||||
return new Promise((resolve) => {
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>DTLS fingerprint validation</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../RTCPeerConnection-helper.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
// Tests that an invalid fingerprint leads to a connectionState 'failed'.
|
||||
promise_test(async t => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
const pc2 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
t.add_cleanup(() => pc2.close());
|
||||
pc1.createDataChannel('datachannel');
|
||||
coupleIceCandidates(pc1, pc2);
|
||||
const offer = await pc1.createOffer();
|
||||
await pc2.setRemoteDescription(offer);
|
||||
await pc1.setLocalDescription(offer);
|
||||
const answer = await pc2.createAnswer();
|
||||
await pc1.setRemoteDescription(new RTCSessionDescription({
|
||||
type: answer.type,
|
||||
sdp: answer.sdp.replace(/a=fingerprint:sha-256 .*/g,
|
||||
'a=fingerprint:sha-256 00:00:00:00:00:00:00:00:00:00:00:00:00:' +
|
||||
'00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00'),
|
||||
}));
|
||||
await pc2.setLocalDescription(answer);
|
||||
|
||||
await waitForConnectionStateChange(pc1, ['failed']);
|
||||
await waitForConnectionStateChange(pc2, ['failed']);
|
||||
}, 'Connection fails if one side provides a wrong DTLS fingerprint');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue