diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/media/test/test_seamless_looping_duration.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/test/test_seamless_looping_duration.html')
-rw-r--r-- | dom/media/test/test_seamless_looping_duration.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/dom/media/test/test_seamless_looping_duration.html b/dom/media/test/test_seamless_looping_duration.html new file mode 100644 index 0000000000..4a64a81759 --- /dev/null +++ b/dom/media/test/test_seamless_looping_duration.html @@ -0,0 +1,63 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>Seamless looping test duration</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +<script type="text/javascript" src="manifest.js"></script> +</head> +<script type="application/javascript"> + +/** + * This test aims to check that the media duration shouldn't be changed during + * seamless looping. + */ +add_task(async function testSeamlessLoopingDuration() { + info(`create video and play it`); + let video = document.createElement('video'); + video.loop = true; + video.src = "gizmo-short.mp4"; + document.body.appendChild(video); + await video.play(); + + video.ondurationchange = + _ => ok(false, "shouldn't change duration during looping!"); + + info(`test seamless looping multiples times`); + let MAX_LOOPING_COUNT = 10; + for (let count = 0; count < MAX_LOOPING_COUNT; count++) { + await once(video, "seeking"); + await once(video, "seeked"); + ok(true, `the round ${count} of the seamless looping succeeds`); + } +}); + +// This one tests the situation where both tracks reached EOS before entering +// looping state. +add_task(async function testSeamlessLoopingDuration2() { + info(`create video and play it to the end`); + let video = document.createElement('video'); + video.src = "gizmo-short.mp4"; + document.body.appendChild(video); + await video.play(); + await once(video, "ended"); + + info(`play video again`); + video.ondurationchange = + _ => ok(false, "shouldn't change duration during looping!"); + video.loop = true; + await video.play(); + + info(`test seamless looping multiples times`); + let MAX_LOOPING_COUNT = 10; + for (let count = 0; count < MAX_LOOPING_COUNT; count++) { + await once(video, "seeking"); + await once(video, "seeked"); + ok(true, `the round ${count} of the seamless looping succeeds`); + } +}); + +</script> +<body> +</body> +</html> |