diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/mediasession/positionstate.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/mediasession/positionstate.html')
-rw-r--r-- | testing/web-platform/tests/mediasession/positionstate.html | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/testing/web-platform/tests/mediasession/positionstate.html b/testing/web-platform/tests/mediasession/positionstate.html new file mode 100644 index 0000000000..9141091a90 --- /dev/null +++ b/testing/web-platform/tests/mediasession/positionstate.html @@ -0,0 +1,106 @@ +<!DOCTYPE html> +<title>MediaSession.setPositionState</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script> +test(() => { + window.navigator.mediaSession.setPositionState(null); +}, 'Test setPositionState with a null value'); + +test(() => { + window.navigator.mediaSession.setPositionState({ + duration: 60.9, + position: 10.1, + playbackRate: 1.5 + }); +}, 'Test setPositionState with a valid value for forward playback'); + +test(() => { + window.navigator.mediaSession.setPositionState({ + duration: 60.9, + playbackRate: 1.0 + }); +}, 'Test setPositionState with optional position'); + +test(() => { + window.navigator.mediaSession.setPositionState({ + duration: 60.9, + position: 10.1 + }); +}, 'Test setPositionState with optional playback rate'); + +test(() => { + window.navigator.mediaSession.setPositionState({ + duration: 60.9 + }); +}, 'Test setPositionState with only duration'); + +test(() => { + window.navigator.mediaSession.setPositionState({ + duration: 0 + }); +}, 'Test setPositionState with zero duration'); + +test(() => { + window.navigator.mediaSession.setPositionState({ + duration: 60.9, + position: 10.1, + playbackRate: -2.0 + }); +}, 'Test setPositionState with negative playback rate'); + +test(() => { + assert_throws_js( + TypeError, + _ => { + window.navigator.mediaSession.setPositionState({ + duration: -1 + }); + }); +}, 'Test setPositionState throws a TypeError if duration is negative'); + +test(() => { + assert_throws_js( + TypeError, + _ => { + window.navigator.mediaSession.setPositionState({ + duration: 10, + position: -1 + }); + }); +}, 'Test setPositionState throws a TypeError if position is negative'); + +test(() => { + assert_throws_js( + TypeError, + _ => { + window.navigator.mediaSession.setPositionState({ + duration: 10, + position: 20 + }); + }); +}, 'Test setPositionState throws a TypeError if duration is less than position'); + +test(() => { + assert_throws_js( + TypeError, + _ => { + window.navigator.mediaSession.setPositionState({ + duration: 60.9, + position: 10.1, + playbackRate: 0.0 + }); + }); +}, 'Test setPositionState throws a TypeError if playback rate is zero'); + +test(() => { + assert_throws_js( + TypeError, + _ => { + window.navigator.mediaSession.setPositionState({ + position: 10.1, + playbackRate: 1.0 + }); + }); +}, 'Test setPositionState throws a TypeError if duration is not specified'); +</script> |