summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html')
-rw-r--r--testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html113
1 files changed, 113 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html b/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html
new file mode 100644
index 0000000000..29dfc19a6b
--- /dev/null
+++ b/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html
@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Tests for RTCRtpReceiver-playoutDelayHint attribute</title>
+<link rel="help" href="https://henbos.github.io/webrtc-extensions/#dom-rtcrtpreceiver-playoutdelayhint">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+'use strict'
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('audio', {direction:'recvonly'});
+ assert_equals(receiver.playoutDelayHint, null);
+}, 'audio playoutDelayHint is null by default');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('audio', {direction:'recvonly'});
+ receiver.playoutDelayHint = 0.5;
+ assert_equals(receiver.playoutDelayHint, 0.5);
+}, 'audio playoutDelayHint accepts posititve values');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('audio', {direction:'recvonly'});
+ receiver.playoutDelayHint = 20.5;
+ assert_equals(receiver.playoutDelayHint, 20.5);
+}, 'audio playoutDelayHint accepts large positive values');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('audio', {direction:'recvonly'});
+ receiver.playoutDelayHint = 0.7
+ assert_throws_js(TypeError, () => {
+ receiver.playoutDelayHint = -0.5;
+ }, 'audio playoutDelayHint doesn\'t accept negative values');
+ assert_equals(receiver.playoutDelayHint, 0.7);
+}, 'audio playoutDelayHint returns last valid value on throw');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('audio', {direction:'recvonly'});
+ receiver.playoutDelayHint = 0.0;
+ assert_equals(receiver.playoutDelayHint, 0.0);
+}, 'audio playoutDelayHint allows zero value');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('audio', {direction:'recvonly'});
+ receiver.playoutDelayHint = 0.5;
+ receiver.playoutDelayHint = null;
+ assert_equals(receiver.playoutDelayHint, null);
+}, 'audio playoutDelayHint allows to reset value to null');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('video', {direction:'recvonly'});
+ assert_equals(receiver.playoutDelayHint, null);
+}, 'video playoutDelayHint is null by default');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('video', {direction:'recvonly'});
+ receiver.playoutDelayHint = 0.5;
+ assert_equals(receiver.playoutDelayHint, 0.5);
+}, 'video playoutDelayHint accepts posititve values');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('video', {direction:'recvonly'});
+ receiver.playoutDelayHint = 20.5;
+ assert_equals(receiver.playoutDelayHint, 20.5);
+}, 'video playoutDelayHint accepts large posititve values');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('video', {direction:'recvonly'});
+ receiver.playoutDelayHint = 0.7
+ assert_throws_js(TypeError, () => {
+ receiver.playoutDelayHint = -0.5;
+ }, 'video playoutDelayHint doesn\'t accept negative values');
+ assert_equals(receiver.playoutDelayHint, 0.7);
+}, 'video playoutDelayHint returns last valid value');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('video', {direction:'recvonly'});
+ receiver.playoutDelayHint = 0.0;
+ assert_equals(receiver.playoutDelayHint, 0.0);
+}, 'video playoutDelayHint allows zero value');
+
+test(t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {receiver} = pc.addTransceiver('video', {direction:'recvonly'});
+ receiver.playoutDelayHint = 0.5;
+ receiver.playoutDelayHint = null;
+ assert_equals(receiver.playoutDelayHint, null);
+}, 'video playoutDelayHint allows to reset value to null');
+</script>
+</body>