Revision 98932eb7420923b691dacea405b3bb4bb105016a authored by Emilio Cobos Álvarez on 10 April 2018, 20:19:22 UTC, committed by moz-wptsync-bot on 10 April 2018, 20:19:22 UTC
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1452640 gecko-commit: 00ac14e011212f55d75afd6043ac8e41636dec5f gecko-integration-branch: central gecko-reviewers: xidorn
1 parent e504871
RTCConfiguration-iceCandidatePoolSize.html
<!doctype html>
<meta charset="utf-8">
<!--
4.2.1 RTCConfiguration Dictionary
The RTCConfiguration defines a set of parameters to configure how the peer to peer communication established via RTCPeerConnection is established or re-established.
...
iceCandidatePoolSize of type octet, defaulting to 0
Size of the prefetched ICE pool as defined in [JSEP] (section 3.5.4. and section 4.1.1.).
-->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
/*
dictionary RTCConfiguration {
...
[EnforceRange]
octet iceCandidatePoolSize = 0;
};
... of type octet
*/
test(() => {
const pc = new RTCPeerConnection();
assert_idl_attribute(pc, "getConfiguration");
assert_equals(pc.getConfiguration().iceCandidatePoolSize, 0);
}, "Initialize a new RTCPeerConnection with no iceCandidatePoolSize");
test(() => {
const pc = new RTCPeerConnection({
iceCandidatePoolSize: 0
});
assert_idl_attribute(pc, "getConfiguration");
assert_equals(pc.getConfiguration().iceCandidatePoolSize, 0);
}, "Initialize a new RTCPeerConnection with iceCandidatePoolSize: 0");
test(() => {
const pc = new RTCPeerConnection({
iceCandidatePoolSize: 255
});
assert_idl_attribute(pc, "getConfiguration");
assert_equals(pc.getConfiguration().iceCandidatePoolSize, 255);
}, "Initialize a new RTCPeerConnection with iceCandidatePoolSize: 255");
test(() => {
assert_throws(new TypeError(), () => {
new RTCPeerConnection({
iceCandidatePoolSize: -1
});
});
}, "Initialize a new RTCPeerConnection with iceCandidatePoolSize: -1 (Out Of Range)");
test(() => {
assert_throws(new TypeError(), () => {
new RTCPeerConnection({
iceCandidatePoolSize: 256
});
});
}, "Initialize a new RTCPeerConnection with iceCandidatePoolSize: 256 (Out Of Range)");
/*
Reconfiguration
*/
test(() => {
const pc = new RTCPeerConnection();
assert_idl_attribute(pc, "getConfiguration");
assert_idl_attribute(pc, "setConfiguration");
pc.setConfiguration({
iceCandidatePoolSize: 0
});
assert_equals(pc.getConfiguration().iceCandidatePoolSize, 0);
}, "Reconfigure RTCPeerConnection instance iceCandidatePoolSize to 0");
test(() => {
const pc = new RTCPeerConnection();
assert_idl_attribute(pc, "getConfiguration");
assert_idl_attribute(pc, "setConfiguration");
pc.setConfiguration({
iceCandidatePoolSize: 255
});
assert_equals(pc.getConfiguration().iceCandidatePoolSize, 255);
}, "Reconfigure RTCPeerConnection instance iceCandidatePoolSize to 255");
/*
The following tests include an explicit assertion for the existence of a
setConfiguration function to prevent the assert_throws from catching the
TypeError object that will be thrown when attempting to call the
non-existent setConfiguration method (in cases where it has not yet
been implemented). Without this check, these tests will pass incorrectly.
*/
test(() => {
const pc = new RTCPeerConnection();
assert_equals(typeof pc.setConfiguration, "function", "RTCPeerConnection.prototype.setConfiguration is not implemented");
assert_throws(new TypeError(), () => {
pc.setConfiguration({
iceCandidatePoolSize: -1
});
});
}, "Reconfigure RTCPeerConnection instance iceCandidatePoolSize to -1 (Out Of Range)");
test(() => {
const pc = new RTCPeerConnection();
assert_equals(typeof pc.setConfiguration, "function", "RTCPeerConnection.prototype.setConfiguration is not implemented");
assert_throws(new TypeError(), () => {
pc.setConfiguration({
iceCandidatePoolSize: 256
});
});
}, "Reconfigure RTCPeerConnection instance iceCandidatePoolSize to 256 (Out Of Range)");
</script>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...