diff options
Diffstat (limited to 'testing/web-platform/tests/webrtc-priority')
3 files changed, 111 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webrtc-priority/META.yml b/testing/web-platform/tests/webrtc-priority/META.yml new file mode 100644 index 0000000000..a422e81447 --- /dev/null +++ b/testing/web-platform/tests/webrtc-priority/META.yml @@ -0,0 +1 @@ +spec: https://w3c.github.io/webrtc-priority/ diff --git a/testing/web-platform/tests/webrtc-priority/RTCPeerConnection-ondatachannel.html b/testing/web-platform/tests/webrtc-priority/RTCPeerConnection-ondatachannel.html new file mode 100644 index 0000000000..e4b1e8d58a --- /dev/null +++ b/testing/web-platform/tests/webrtc-priority/RTCPeerConnection-ondatachannel.html @@ -0,0 +1,66 @@ +<!doctype html> +<meta charset=utf-8> +<title>RTCPeerConnection.prototype.ondatachannel</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../webrtc/RTCPeerConnection-helper.js"></script> +<script> +'use strict'; + +promise_test(async (t) => { + const resolver = new Resolver(); + const pc1 = new RTCPeerConnection(); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + t.add_cleanup(() => pc2.close()); + + const dc1 = pc1.createDataChannel('test', { + ordered: false, + maxRetransmits: 1, + protocol: 'custom', + priority: 'high' + }); + + assert_equals(dc1.priority, 'high'); + + pc2.ondatachannel = t.step_func((event) => { + const dc2 = event.channel; + + assert_equals(dc2.priority, 'high'); + + resolver.resolve(); + }); + + exchangeIceCandidates(pc1, pc2); + await exchangeOfferAnswer(pc1, pc2); + + await resolver; +}, 'In-band negotiated channel created on remote peer should match the same configuration as local ' + + 'peer'); + +promise_test(async (t) => { + const resolver = new Resolver(); + const pc1 = new RTCPeerConnection(); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + t.add_cleanup(() => pc2.close()); + + const dc1 = pc1.createDataChannel(''); + + assert_equals(dc1.priority, 'low'); + + pc2.ondatachannel = t.step_func((event) => { + const dc2 = event.channel; + assert_equals(dc2.priority, 'low'); + + resolver.resolve(); + }); + + exchangeIceCandidates(pc1, pc2); + await exchangeOfferAnswer(pc1, pc2); + + await resolver; +}, 'In-band negotiated channel created on remote peer should match the same (default) ' + + 'configuration as local peer'); + +</script> diff --git a/testing/web-platform/tests/webrtc-priority/RTCRtpParameters-encodings.html b/testing/web-platform/tests/webrtc-priority/RTCRtpParameters-encodings.html new file mode 100644 index 0000000000..1519ee84f7 --- /dev/null +++ b/testing/web-platform/tests/webrtc-priority/RTCRtpParameters-encodings.html @@ -0,0 +1,44 @@ +<!doctype html> +<meta charset=utf-8> +<title>RTCRtpParameters encodings</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../webrtc/dictionary-helper.js"></script> +<script src="../webrtc/RTCRtpParameters-helper.js"></script> +<script> + 'use strict'; + + promise_test(async t => { + const pc = new RTCPeerConnection(); + t.add_cleanup(() => pc.close()); + const { sender } = pc.addTransceiver('video', { + sendEncodings: [{ + active: false, + priority: 'low', + networkPriority: 'low', + maxBitrate: 8, + maxFramerate: 25, + rid: 'foo' + }] + }); + await doOfferAnswerExchange(t, pc); + + const param = sender.getParameters(); + validateSenderRtpParameters(param); + const encoding = param.encodings[0]; + + assert_equals(encoding.active, false); + assert_equals(encoding.priority, 'low'); + assert_equals(encoding.networkPriority, 'low'); + }, `sender.getParameters() should return sendEncodings set by addTransceiver()`); + + test_modified_encoding('audio', 'active', false, true, + 'setParameters() with modified encoding.active should succeed'); + + test_modified_encoding('audio', 'priority', 'very-low', 'high', + 'setParameters() with modified encoding.priority should succeed'); + + test_modified_encoding('audio', 'networkPriority', 'very-low', 'high', + 'setParameters() with modified encoding.networkPriority should succeed'); + +</script> |