summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_seek_duration.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/media/test/test_seek_duration.html
parentInitial commit. (diff)
downloadfirefox-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_seek_duration.html')
-rw-r--r--dom/media/test/test_seek_duration.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/dom/media/test/test_seek_duration.html b/dom/media/test/test_seek_duration.html
new file mode 100644
index 0000000000..11ee4cb534
--- /dev/null
+++ b/dom/media/test/test_seek_duration.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Media test: seek tests</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>
+ <script type="text/javascript" src="seek_support.js"></script>
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/**
+ * This test is used to make sure video's duration won't be changed when it
+ * reachs to the end after seeking to position where the time is very close to
+ * video's end time.
+ */
+
+SimpleTest.waitForExplicitFinish();
+
+(async function startTest()
+{
+ const video = document.createElement('video');
+ video.src = "bunny.webm";
+ document.body.appendChild(video);
+
+ const loadedMetadata = once(video, "loadedmetadata");
+ const canplay = once(video, "canplay");
+ const end = once(video, "ended");
+
+ info(`- wait for video loading metadata -`);
+ await loadedMetadata;
+ const originalDuration = video.duration;
+
+ info(`- seek video to the position which is close to end time -`);
+ // video's duration is 2.1 and the last key frame is in 2.0, we want to seek
+ // to that keyframe.
+ video.currentTime = originalDuration - 0.1;
+
+ info(`- play video until it ends -`);
+ await canplay;
+ await video.play();
+ await end;
+
+ ok(video.duration === originalDuration, `Duration shouldn't change`);
+ removeNodeAndSource(video);
+
+ SimpleTest.finish();
+})();
+
+</script>
+</pre>
+</body>
+</html>