mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Update web-platform-tests to revision 122a4672fa0dc554a6e7528fa3487fd907c792ee
This commit is contained in:
parent
fb1123495f
commit
93d826f7ba
301 changed files with 4775 additions and 1769 deletions
|
@ -5,85 +5,121 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="RTCPeerConnection-helper.js"></script>
|
||||
<script>
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
// Test is based on the following editor draft:
|
||||
// https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html
|
||||
// Test is based on the following revision:
|
||||
// https://rawgit.com/w3c/webrtc-pc/1cc5bfc3ff18741033d804c4a71f7891242fb5b3/webrtc.html
|
||||
|
||||
// The following helper functions are called from RTCPeerConnection-helper.js:
|
||||
// generateDataChannelOffer()
|
||||
// generateAnswer()
|
||||
// The following helper functions are called from RTCPeerConnection-helper.js:
|
||||
// generateDataChannelOffer()
|
||||
// generateAnswer()
|
||||
|
||||
/*
|
||||
6.1. RTCPeerConnection Interface Extensions
|
||||
partial interface RTCPeerConnection {
|
||||
readonly attribute RTCSctpTransport? sctp;
|
||||
...
|
||||
};
|
||||
/*
|
||||
6.1.
|
||||
|
||||
1.1. RTCSctpTransport Interface
|
||||
interface RTCSctpTransport {
|
||||
readonly attribute RTCDtlsTransport transport;
|
||||
readonly attribute unsigned long maxMessageSize;
|
||||
};
|
||||
partial interface RTCPeerConnection {
|
||||
readonly attribute RTCSctpTransport? sctp;
|
||||
...
|
||||
};
|
||||
|
||||
4.4.1.1. Constructor
|
||||
8. Let connection have an [[sctpTransport]] internal slot, initialized to null.
|
||||
6.1.1.
|
||||
|
||||
4.3.1.6. Set the RTCSessionSessionDescription
|
||||
2.2.6. If description is of type "answer" or "pranswer", then run the
|
||||
following steps:
|
||||
1. If description initiates the establishment of a new SCTP association,
|
||||
as defined in [SCTP-SDP], Sections 10.3 and 10.4, set the value of
|
||||
connection's [[SctpTransport]] internal slot to a newly created
|
||||
RTCSctpTransport.
|
||||
*/
|
||||
interface RTCSctpTransport {
|
||||
readonly attribute RTCDtlsTransport transport;
|
||||
readonly attribute RTCSctpTransportState state;
|
||||
readonly attribute unrestricted double maxMessageSize;
|
||||
attribute EventHandler onstatechange;
|
||||
};
|
||||
|
||||
promise_test(t => {
|
||||
const pc = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc.close());
|
||||
assert_equals(pc.sctp, null);
|
||||
pc.createDataChannel('test');
|
||||
4.4.1.1. Constructor
|
||||
9. Let connection have an [[SctpTransport]] internal slot, initialized to null.
|
||||
|
||||
return pc.createOffer()
|
||||
.then(offer =>
|
||||
pc.setLocalDescription(offer)
|
||||
.then(() => generateAnswer(offer)))
|
||||
.then(answer => pc.setRemoteDescription(answer))
|
||||
.then(() => {
|
||||
const { sctp } = pc;
|
||||
assert_not_equals(sctp, null);
|
||||
assert_true(sctp instanceof RTCSctpTransport,
|
||||
'Expect pc.sctp to be instance of RTCSctpTransport');
|
||||
4.4.1.6. Set the RTCSessionSessionDescription
|
||||
2.2.6. If description is of type "answer" or "pranswer", then run the
|
||||
following steps:
|
||||
1. If description initiates the establishment of a new SCTP association, as defined in
|
||||
[SCTP-SDP], Sections 10.3 and 10.4, create an RTCSctpTransport with an initial state
|
||||
of "connecting" and assign the result to the [[SctpTransport]] slot.
|
||||
*/
|
||||
|
||||
assert_true(sctp.transport instanceof RTCDtlsTransport,
|
||||
'Expect sctp.transport to be instance of RTCDtlsTransport');
|
||||
promise_test(async (t) => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
const pc2 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
t.add_cleanup(() => pc2.close());
|
||||
|
||||
assert_true(typeof sctp.maxMessageSize == 'number',
|
||||
'Expect sctp.maxMessageSize to be a number');
|
||||
});
|
||||
}, 'setRemoteDescription() with answer containing data media should initialize pc.sctp');
|
||||
assert_equals(pc1.sctp, null, 'RTCSctpTransport must be null');
|
||||
|
||||
promise_test(t => {
|
||||
const pc = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc.close());
|
||||
assert_equals(pc.sctp, null);
|
||||
const offer = await generateOffer({ pc: pc1, audio: true });
|
||||
await Promise.all([pc1.setLocalDescription(offer), pc2.setRemoteDescription(offer)]);
|
||||
const answer = await pc2.createAnswer();
|
||||
await pc1.setRemoteDescription(answer);
|
||||
|
||||
return generateDataChannelOffer(pc)
|
||||
.then(offer => pc.setRemoteDescription(offer))
|
||||
.then(() => pc.createAnswer())
|
||||
.then(answer => pc.setLocalDescription(answer))
|
||||
.then(() => {
|
||||
const { sctp } = pc;
|
||||
assert_not_equals(sctp, null);
|
||||
assert_true(sctp instanceof RTCSctpTransport,
|
||||
'Expect pc.sctp to be instance of RTCSctpTransport');
|
||||
assert_equals(pc1.sctp, null, 'RTCSctpTransport must remain null');
|
||||
}, 'setRemoteDescription() with answer not containing data media should not initialize pc.sctp');
|
||||
|
||||
assert_true(sctp.transport instanceof RTCDtlsTransport,
|
||||
'Expect sctp.transport to be instance of RTCDtlsTransport');
|
||||
promise_test(async (t) => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
const pc2 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
t.add_cleanup(() => pc2.close());
|
||||
|
||||
assert_equals(pc1.sctp, null, 'RTCSctpTransport must be null');
|
||||
|
||||
const offer = await generateOffer({ pc: pc2, audio: true });
|
||||
await Promise.all([pc2.setLocalDescription(offer), pc1.setRemoteDescription(offer)]);
|
||||
const answer = await pc1.createAnswer();
|
||||
await pc1.setLocalDescription(answer);
|
||||
|
||||
assert_equals(pc1.sctp, null, 'RTCSctpTransport must remain null');
|
||||
}, 'setLocalDescription() with answer not containing data media should not initialize pc.sctp');
|
||||
|
||||
function validateSctpTransport(sctp) {
|
||||
assert_not_equals(sctp, null, 'RTCSctpTransport must be available');
|
||||
|
||||
assert_true(sctp instanceof RTCSctpTransport,
|
||||
'Expect pc.sctp to be instance of RTCSctpTransport');
|
||||
|
||||
assert_true(sctp.transport instanceof RTCDtlsTransport,
|
||||
'Expect sctp.transport to be instance of RTCDtlsTransport');
|
||||
|
||||
assert_equals(sctp.state, 'connecting', 'RTCSctpTransport should be in the connecting state');
|
||||
|
||||
// Note: Yes, Number.POSITIVE_INFINITY is also a 'number'
|
||||
assert_true(typeof sctp.maxMessageSize === 'number',
|
||||
'Expect sctp.maxMessageSize to be a number');
|
||||
}
|
||||
|
||||
promise_test(async (t) => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
const pc2 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
t.add_cleanup(() => pc2.close());
|
||||
|
||||
assert_equals(pc1.sctp, null, 'RTCSctpTransport must be null');
|
||||
|
||||
const offer = await generateDataChannelOffer(pc1);
|
||||
await Promise.all([pc1.setLocalDescription(offer), pc2.setRemoteDescription(offer)]);
|
||||
const answer = await pc2.createAnswer();
|
||||
await pc1.setRemoteDescription(answer);
|
||||
|
||||
validateSctpTransport(pc1.sctp);
|
||||
}, 'setRemoteDescription() with answer containing data media should initialize pc.sctp');
|
||||
|
||||
promise_test(async (t) => {
|
||||
const pc1 = new RTCPeerConnection();
|
||||
const pc2 = new RTCPeerConnection();
|
||||
t.add_cleanup(() => pc1.close());
|
||||
t.add_cleanup(() => pc2.close());
|
||||
|
||||
assert_equals(pc1.sctp, null, 'RTCSctpTransport must be null');
|
||||
|
||||
const offer = await generateDataChannelOffer(pc2);
|
||||
await Promise.all([pc2.setLocalDescription(offer), pc1.setRemoteDescription(offer)]);
|
||||
const answer = await pc1.createAnswer();
|
||||
await pc1.setLocalDescription(answer);
|
||||
|
||||
validateSctpTransport(pc1.sctp);
|
||||
}, 'setLocalDescription() with answer containing data media should initialize pc.sctp');
|
||||
|
||||
assert_true(typeof sctp.maxMessageSize == 'number',
|
||||
'Expect sctp.maxMessageSize to be a number');
|
||||
});
|
||||
}, 'setLocalDescription() with answer containing data media should initialize pc.sctp');
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue