summaryrefslogtreecommitdiffstats
path: root/dom/media/webvtt/test/reftest
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/webvtt/test/reftest')
-rw-r--r--dom/media/webvtt/test/reftest/black.mp4bin0 -> 15036 bytes
-rw-r--r--dom/media/webvtt/test/reftest/cues_time_overlapping.webvtt7
-rw-r--r--dom/media/webvtt/test/reftest/reftest.list3
-rw-r--r--dom/media/webvtt/test/reftest/vtt_overlapping_time-ref.html29
-rw-r--r--dom/media/webvtt/test/reftest/vtt_overlapping_time.html30
-rw-r--r--dom/media/webvtt/test/reftest/vtt_reflow_display-ref.html28
-rw-r--r--dom/media/webvtt/test/reftest/vtt_reflow_display.css33
-rw-r--r--dom/media/webvtt/test/reftest/vtt_reflow_display.html37
-rw-r--r--dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue.html36
-rw-r--r--dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue_ref.html6
-rw-r--r--dom/media/webvtt/test/reftest/white.webmbin0 -> 10880 bytes
11 files changed, 209 insertions, 0 deletions
diff --git a/dom/media/webvtt/test/reftest/black.mp4 b/dom/media/webvtt/test/reftest/black.mp4
new file mode 100644
index 0000000000..24eb3be139
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/black.mp4
Binary files differ
diff --git a/dom/media/webvtt/test/reftest/cues_time_overlapping.webvtt b/dom/media/webvtt/test/reftest/cues_time_overlapping.webvtt
new file mode 100644
index 0000000000..8ed899a9d8
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/cues_time_overlapping.webvtt
@@ -0,0 +1,7 @@
+WEBVTT FILE
+
+00:00:00.000 --> 00:00:01.000
+First cue
+
+00:00:00.000 --> 00:00:04.000
+Second cue
diff --git a/dom/media/webvtt/test/reftest/reftest.list b/dom/media/webvtt/test/reftest/reftest.list
new file mode 100644
index 0000000000..8311bac10f
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/reftest.list
@@ -0,0 +1,3 @@
+skip-if(Android) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&/^aarch64-msvc/.test(xulRuntime.XPCOMABI),0-136,0-427680) == vtt_update_display_after_removed_cue.html vtt_update_display_after_removed_cue_ref.html
+skip-if(Android) fuzzy-if(winWidget,0-170,0-170) == vtt_overlapping_time.html vtt_overlapping_time-ref.html
+skip-if(Android) != vtt_reflow_display.html vtt_reflow_display-ref.html
diff --git a/dom/media/webvtt/test/reftest/vtt_overlapping_time-ref.html b/dom/media/webvtt/test/reftest/vtt_overlapping_time-ref.html
new file mode 100644
index 0000000000..a44e24678b
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/vtt_overlapping_time-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+</head>
+<body>
+<video id="v1" src="black.mp4" width="320" height="180">
+ <track label="English" src="cues_time_overlapping.webvtt" default>
+</video>
+<script type="text/javascript">
+/**
+ * This test is to ensure that when cues with overlapping times, the one with
+ * earlier end timestamp should disappear when the media time reaches its
+ * end time. This vtt file contains two cues, the first cue is [0,1], the second
+ * cue is [0,4], so if we seek video to 2s, only cue2 should be displayed.
+ */
+async function testTimeOverlappingCues() {
+ const video = document.getElementById("v1");
+ video.currentTime = 2;
+ video.onseeked = () => {
+ video.onseeked = null;
+ document.documentElement.removeAttribute('class');
+ }
+};
+
+window.addEventListener("MozReftestInvalidate",
+ testTimeOverlappingCues);
+</script>
+</body>
+</html>
diff --git a/dom/media/webvtt/test/reftest/vtt_overlapping_time.html b/dom/media/webvtt/test/reftest/vtt_overlapping_time.html
new file mode 100644
index 0000000000..f973b398d5
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/vtt_overlapping_time.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+</head>
+<body>
+<video id="v1" src="black.mp4" autoplay width="320" height="180">
+ <track label="English" src="cues_time_overlapping.webvtt" default>
+</video>
+<script type="text/javascript">
+/**
+ * This test is to ensure that when cues with overlapping times, the one with
+ * earlier end timestamp should disappear when the media time reaches its
+ * end time. This vtt file contains two cues, the first cue is [0,1], the second
+ * cue is [0,4], so after video is playing over 1s, only cue2 should be displayed.
+ */
+async function testTimeOverlappingCues() {
+ const video = document.getElementById("v1");
+ video.ontimeupdate = () => {
+ if (video.currentTime > 1.0) {
+ document.documentElement.removeAttribute('class');
+ video.ontimeupdate = null;
+ }
+ }
+};
+
+window.addEventListener("MozReftestInvalidate",
+ testTimeOverlappingCues);
+</script>
+</body>
+</html>
diff --git a/dom/media/webvtt/test/reftest/vtt_reflow_display-ref.html b/dom/media/webvtt/test/reftest/vtt_reflow_display-ref.html
new file mode 100644
index 0000000000..19f3208e6b
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/vtt_reflow_display-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<link rel="stylesheet" href="vtt_reflow_display.css">
+<body>
+<div class="video-player">
+ <div class="video-layer">
+ <video id="v1" autoplay controls></video>
+ </div>
+</div>
+<script>
+/**
+ * Simply play and pause a video without any cues.
+ */
+async function testDisplayCueDuringFrequentReflowRef() {
+ const video = document.getElementById("v1");
+ video.src = "white.webm";
+ video.onplay = _ => {
+ video.onplay = null;
+ video.pause();
+ document.documentElement.removeAttribute('class');
+ }
+};
+
+window.addEventListener("MozReftestInvalidate",
+ testDisplayCueDuringFrequentReflowRef);
+</script>
+</body>
+</html>
diff --git a/dom/media/webvtt/test/reftest/vtt_reflow_display.css b/dom/media/webvtt/test/reftest/vtt_reflow_display.css
new file mode 100644
index 0000000000..4b66a07bd4
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/vtt_reflow_display.css
@@ -0,0 +1,33 @@
+body {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ max-height: 100%;
+ width: 100vw;
+ height: 100vh;
+}
+.video-player {
+ display: flex;
+ max-height: calc(100% - 400px);
+ flex: 1 1 0;
+ flex-direction: column;
+ position: relative;
+ max-width: 100%;
+ height: 0;
+}
+.video-layer {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+ height: 100%;
+ flex: 1 1 0;
+}
+video {
+ object-fit: contain;
+ display: flex;
+ flex: auto;
+ max-width: 100%;
+ min-height: 0;
+ min-width: 0;
+}
diff --git a/dom/media/webvtt/test/reftest/vtt_reflow_display.html b/dom/media/webvtt/test/reftest/vtt_reflow_display.html
new file mode 100644
index 0000000000..e7ec496bc1
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/vtt_reflow_display.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+</head>
+<link rel="stylesheet" href="vtt_reflow_display.css">
+<body>
+<div class="video-player">
+ <div class="video-layer">
+ <video id="v1" autoplay controls></video>
+ </div>
+</div>
+<script>
+/**
+ * In bug 1733232, setting some CSS properties (from bug 1733232 comment17)
+ * would cause video frame's reflow called very frequently, which crashed the
+ * video control and caused no cue showing. We compare this test with another
+ * white video without any cues, and they should NOT be equal.
+ */
+function testDisplayCueDuringFrequentReflow() {
+ let video = document.getElementById("v1");
+ video.src = "white.webm";
+ let cue = new VTTCue(0, 4, "hello testing");
+ cue.onenter = _ => {
+ cue.onenter = null;
+ video.pause();
+ document.documentElement.removeAttribute('class');
+ }
+ let track = video.addTextTrack("captions");
+ track.mode = "showing";
+ track.addCue(cue);
+};
+
+window.addEventListener("MozReftestInvalidate",
+ testDisplayCueDuringFrequentReflow);
+</script>
+</body>
+</html>
diff --git a/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue.html b/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue.html
new file mode 100644
index 0000000000..4cd5d5bbd2
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+</head>
+<body>
+<video id="v1" autoplay></video>
+<script type="text/javascript">
+
+/**
+ * This test is used to ensure we would update the cue display after removing
+ * cue from the text track, the removed cue should not display on the video's
+ * rendering area.
+ */
+function testUpdateDisplayAfterRemovedCue() {
+ let video = document.getElementById("v1");
+ video.src = "black.mp4";
+ let cue = new VTTCue(0, 4, "hello testing");
+ let track = video.addTextTrack("captions");
+ track.mode = "showing";
+ track.addCue(cue);
+ cue.onenter = () => {
+ cue.onenter = null;
+ track.removeCue(cue);
+ video.pause();
+ video.onpause = () => {
+ video.onpause = null;
+ document.documentElement.removeAttribute('class');
+ }
+ }
+};
+
+window.addEventListener("MozReftestInvalidate",
+ testUpdateDisplayAfterRemovedCue);
+</script>
+</body>
+</html>
diff --git a/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue_ref.html b/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue_ref.html
new file mode 100644
index 0000000000..0b1afdc568
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/vtt_update_display_after_removed_cue_ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<video id="v1" src="black.mp4"></video>
+</body>
+</html>
diff --git a/dom/media/webvtt/test/reftest/white.webm b/dom/media/webvtt/test/reftest/white.webm
new file mode 100644
index 0000000000..bbacad7ffd
--- /dev/null
+++ b/dom/media/webvtt/test/reftest/white.webm
Binary files differ