mirror of
https://github.com/servo/servo.git
synced 2025-09-03 19:48:21 +01:00
Update web-platform-tests to revision 138d2e938d493a5c8435025162759c2e34b3b1d1
This commit is contained in:
parent
ce37d5ebf2
commit
732399d5d9
1754 changed files with 6528 additions and 3662 deletions
|
@ -245,6 +245,22 @@ async function doSignalingHandshake(localPc, remotePc, options={}) {
|
|||
await remotePc.setLocalDescription(answer);
|
||||
}
|
||||
|
||||
// Returns a promise that resolves when the |transport| gets a
|
||||
// 'statechange' event with the value |state|.
|
||||
// This should work for RTCSctpTransport, RTCDtlsTransport and RTCIceTransport.
|
||||
function waitForState(transport, state) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const eventHandler = () => {
|
||||
if (transport.state == state) {
|
||||
transport.removeEventListener('statechange', eventHandler, false);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
transport.addEventListener('statechange', eventHandler, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Returns a promise that resolves when |pc.iceConnectionState| is 'connected'
|
||||
// or 'completed'.
|
||||
function listenToIceConnected(pc) {
|
||||
|
|
|
@ -41,6 +41,15 @@ for (const kind of ['audio', 'video']) {
|
|||
assert_true(ssrc.timestamp >= startTime);
|
||||
}, '[' + kind + '] RTCRtpSynchronizationSource.timestamp is a number');
|
||||
|
||||
promise_test(async t => {
|
||||
const receiver = await initiateSingleTrackCallAndReturnReceiver(t, kind);
|
||||
const [ssrc] = await listenForSSRCs(t, receiver);
|
||||
assert_equals(typeof ssrc.rtpTimestamp, 'number');
|
||||
assert_greater_than_equal(ssrc.rtpTimestamp, 0);
|
||||
assert_less_than_equal(ssrc.rtpTimestamp, 0xffffffff);
|
||||
}, '[' + kind + '] RTCRtpSynchronizationSource.rtpTimestamp is a number ' +
|
||||
'[0, 2^32-1]');
|
||||
|
||||
promise_test(async t => {
|
||||
const receiver = await initiateSingleTrackCallAndReturnReceiver(t, kind);
|
||||
// Wait for packets to start flowing.
|
||||
|
|
|
@ -7,18 +7,6 @@
|
|||
<script>
|
||||
'use strict';
|
||||
|
||||
function waitForState(transport, state) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const eventHandler = () => {
|
||||
if (transport.state == state) {
|
||||
transport.removeEventListener('statechange', eventHandler, false);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
transport.addEventListener('statechange', eventHandler, false);
|
||||
});
|
||||
}
|
||||
|
||||
promise_test(async t => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>RTCSctpTransport.prototype.maxChannels</title>
|
||||
<link rel="help" href="https://w3c.github.io/webrtc-pc/#rtcsctptransport-interface">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="RTCPeerConnection-helper.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
promise_test(async (t) => {
|
||||
const pc = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc.close());
|
||||
|
||||
assert_equals(pc.sctp, null, 'RTCSctpTransport must be null');
|
||||
pc.createDataChannel('test');
|
||||
const offer = await pc.createOffer();
|
||||
await pc.setRemoteDescription(offer);
|
||||
const answer = await pc.createAnswer();
|
||||
await pc.setLocalDescription(answer);
|
||||
|
||||
assert_not_equals(pc.sctp, null, 'RTCSctpTransport must be available');
|
||||
assert_equals(pc.sctp.maxChannels, null, 'maxChannels must not be set');
|
||||
}, 'An unconnected peerconnection must not have maxChannels set');
|
||||
|
||||
promise_test(async (t) => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
const pc2 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc2.close());
|
||||
coupleIceCandidates(pc1, pc2);
|
||||
pc1.createDataChannel('');
|
||||
const offer = await pc1.createOffer();
|
||||
await pc1.setLocalDescription(offer);
|
||||
const pc1ConnectedWaiter = waitForState(pc1.sctp, 'connected');
|
||||
await pc2.setRemoteDescription(offer);
|
||||
const pc2ConnectedWaiter = waitForState(pc2.sctp, 'connected');
|
||||
const answer = await pc2.createAnswer();
|
||||
await pc2.setLocalDescription(answer);
|
||||
await pc1.setRemoteDescription(answer);
|
||||
assert_equals(null, pc1.sctp.maxChannels);
|
||||
assert_equals(null, pc2.sctp.maxChannels);
|
||||
await pc1ConnectedWaiter;
|
||||
await pc2ConnectedWaiter;
|
||||
assert_not_equals(null, pc1.sctp.maxChannels);
|
||||
assert_not_equals(null, pc2.sctp.maxChannels);
|
||||
assert_equals(pc1.sctp.maxChannels, pc2.sctp.maxChannels);
|
||||
}, 'maxChannels gets instantiated after connecting');
|
||||
</script>
|
|
@ -0,0 +1,96 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Candidate exchange</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../RTCPeerConnection-helper.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
function iceGatheringCompleteWaiter(pc) {
|
||||
const waiter = new Promise((resolve) => {
|
||||
const eventHandler = () => {
|
||||
if (pc.iceGatheringState == 'complete') {
|
||||
pc.removeEventListener('icegatheringstatechange', eventHandler, false);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
if (pc.iceGatheringState == 'complete') {
|
||||
resolve();
|
||||
} else {
|
||||
pc.addEventListener('icegatheringstatechange', eventHandler, false);
|
||||
}
|
||||
});
|
||||
return waiter;
|
||||
}
|
||||
|
||||
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);
|
||||
await doSignalingHandshake(pc1, pc2);
|
||||
await waitForIceStateChange(pc1, ['connected', 'completed']);
|
||||
}, 'Two way ICE exchange works');
|
||||
|
||||
promise_test(async t => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
const pc2 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
t.add_cleanup(() => pc2.close());
|
||||
let candidates = [];
|
||||
pc1.createDataChannel('datachannel');
|
||||
pc1.onicecandidate = e => {
|
||||
candidates.push(e.candidate);
|
||||
}
|
||||
// Candidates from PC2 are not delivered to pc1, so pc1 will use
|
||||
// peer-reflexive candidates.
|
||||
await doSignalingHandshake(pc1, pc2);
|
||||
const waiter = iceGatheringCompleteWaiter(pc1);
|
||||
await waiter;
|
||||
for (const candidate of candidates) {
|
||||
if (candidate) {
|
||||
pc2.addIceCandidate(candidate);
|
||||
}
|
||||
}
|
||||
await Promise.all([waitForIceStateChange(pc1, ['connected', 'completed']),
|
||||
waitForIceStateChange(pc2, ['connected', 'completed'])]);
|
||||
const candidate_pair = pc1.sctp.transport.iceTransport.getSelectedCandidatePair();
|
||||
assert_equals(candidate_pair.local.type, 'host');
|
||||
assert_equals(candidate_pair.remote.type, 'prflx');
|
||||
}, 'Adding only caller -> callee candidates gives a connection');
|
||||
|
||||
promise_test(async t => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
const pc2 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
t.add_cleanup(() => pc2.close());
|
||||
let candidates = [];
|
||||
pc1.createDataChannel('datachannel');
|
||||
pc2.onicecandidate = e => {
|
||||
candidates.push(e.candidate);
|
||||
}
|
||||
// Candidates from pc1 are not delivered to pc2. so pc2 will use
|
||||
// peer-reflexive candidates.
|
||||
await doSignalingHandshake(pc1, pc2);
|
||||
const waiter = iceGatheringCompleteWaiter(pc2);
|
||||
await waiter;
|
||||
for (const candidate of candidates) {
|
||||
if (candidate) {
|
||||
pc1.addIceCandidate(candidate);
|
||||
}
|
||||
}
|
||||
await Promise.all([waitForIceStateChange(pc1, ['connected', 'completed']),
|
||||
waitForIceStateChange(pc2, ['connected', 'completed'])]);
|
||||
const candidate_pair = pc2.sctp.transport.iceTransport.getSelectedCandidatePair();
|
||||
assert_equals(candidate_pair.local.type, 'host');
|
||||
assert_equals(candidate_pair.remote.type, 'prflx');
|
||||
}, 'Adding only callee -> caller candidates gives a connection');
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -94,8 +94,8 @@ promise_test(async t => {
|
|||
const sender = pc1.addTrack(track);
|
||||
exchangeIceCandidates(pc1, pc2);
|
||||
await doSignalingHandshake(pc1, pc2);
|
||||
await waitForIceStateChange(pc1, ['connected']);
|
||||
}, 'PC should enter connected state when candidates are sent');
|
||||
await waitForIceStateChange(pc1, ['connected', 'completed']);
|
||||
}, 'PC should enter connected (or completed) state when candidates are sent');
|
||||
|
||||
promise_test(async t => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue