summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/media-source/mediasource-replay.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/media-source/mediasource-replay.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/media-source/mediasource-replay.html')
-rw-r--r--testing/web-platform/tests/media-source/mediasource-replay.html41
1 files changed, 41 insertions, 0 deletions
diff --git a/testing/web-platform/tests/media-source/mediasource-replay.html b/testing/web-platform/tests/media-source/mediasource-replay.html
new file mode 100644
index 0000000000..05a8c0a918
--- /dev/null
+++ b/testing/web-platform/tests/media-source/mediasource-replay.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<!-- Copyright © 2019 Igalia S.L -->
+<html>
+<head>
+ <title>MediaSource replay test case.</title>
+ <meta name="timeout" content="long">
+ <meta charset="utf-8">
+ <link rel="author" title="Alicia Boya García" href="mailto:aboya@igalia.com">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="mediasource-util.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+ mediasource_testafterdataloaded(function (test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) {
+ mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
+
+ test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
+
+ sourceBuffer.appendBuffer(mediaData);
+
+ test.waitForExpectedEvents(function () {
+ mediaSource.endOfStream();
+
+ // Start playing near the end.
+ mediaElement.currentTime = 6.2;
+ mediaElement.play();
+ test.expectEvent(mediaElement, 'ended', 'mediaElement');
+ });
+
+ test.waitForExpectedEvents(function () {
+ mediaElement.play();
+ assert_equals(mediaElement.currentTime, 0, "currentTime");
+ // If currentTime is able to advance, the player did not get stuck and it's a pass.
+ test.waitForCurrentTimeChange(mediaElement, test.step_func_done());
+ });
+ }, "Test replaying video after 'ended'");
+</script>
+</body>
+</html>