diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/html/semantics/embedded-content/the-video-element | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/semantics/embedded-content/the-video-element')
16 files changed, 315 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/intrinsic_sizes.htm b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/intrinsic_sizes.htm new file mode 100644 index 0000000000..7819ee1c18 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/intrinsic_sizes.htm @@ -0,0 +1,75 @@ +<!doctype html> +<html> +<head> +<title>video element - intrinsic sizes</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/media.js"></script> +</head> +<body> +<p><a href="https://html.spec.whatwg.org/multipage/#the-video-element">spec reference</a></p> +<video id="v1"></video> +<video id="v2" width="400"></video> +<video id="v3" height="100"></video> +<video id="v4"></video> +<video id="v5" poster="/media/poster.png"></video> +<div id="log"></div> +<script> +test(function() { + var s = getComputedStyle(document.getElementById("v1")); + assert_equals(s.width, "300px"); + assert_equals(s.height, "150px"); +}, "default object size is 300x150"); + +test(function() { + var s = getComputedStyle(document.getElementById("v2")); + assert_equals(s.width, "400px"); + assert_equals(s.height, "200px"); +}, "default height is half the width"); + +test(function() { + var s = getComputedStyle(document.getElementById("v3")); + assert_equals(s.width, "200px"); + assert_equals(s.height, "100px"); +}, "default width is twice the height"); + +async_test(function(t) { + var v = document.getElementById("v4"); + var s = getComputedStyle(v); + v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random(); + v.onerror = t.unreached_func(); + v.onloadedmetadata = t.step_func(function() { + assert_equals(s.width, '320px'); + assert_equals(s.height, '240px'); + v.removeAttribute("src"); + v.load(); + // Dimensions should be updated only on next layout. + assert_equals(s.width, '320px'); + assert_equals(s.height, '240px'); + requestAnimationFrame(t.step_func_done(function() { + assert_equals(s.width, "300px"); + assert_equals(s.height, "150px"); + })); + }); +}, "default object size after src is removed"); + +async_test(function(t) { + var v = document.getElementById("v5"); + var s = getComputedStyle(v); + v.onerror = t.unreached_func(); + onload = t.step_func(function() { + assert_equals(s.width, '102px'); + assert_equals(s.height, '77px'); + v.removeAttribute("poster"); + // Dimensions should be updated only on next layout. + assert_equals(s.width, '102px'); + assert_equals(s.height, '77px'); + requestAnimationFrame(t.step_func_done(function() { + assert_equals(s.width, "300px"); + assert_equals(s.height, "150px"); + })); + }); +}, "default object size after poster is removed"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/resize-during-playback.html b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/resize-during-playback.html new file mode 100644 index 0000000000..1b057bbeac --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/resize-during-playback.html @@ -0,0 +1,39 @@ +<!doctype html> +<html> +<head> +<title>video element resizing during playback</title> +<link rel="help" href="https://html.spec.whatwg.org/multipage/media.html#concept-video-intrinsic-width"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +for (const format of ['mp4', 'webm']) { + promise_test(async (t) => { + const video = document.createElement('video'); + assert_implements_optional(video.canPlayType(`video/${format}`), `${format} supported`); + + // Load the video and wait for initial resize event. + video.src = `/media/400x300-red-resize-200x150-green.${format}`; + video.muted = true; + video.preload = 'auto'; + document.body.appendChild(video); + const eventWatcher = new EventWatcher(t, video, ['resize', 'playing', 'error', 'ended']); + await eventWatcher.wait_for(['resize']); + assert_equals(video.videoWidth, 400, 'width after first resize event'); + assert_equals(video.videoHeight, 300, 'height after first resize event'); + + // Now play and wait for a second resize event. + const playPromise = video.play(); + if (playPromise) { + playPromise.catch(t.unreached_func("play rejected")); + } + await eventWatcher.wait_for(['playing', 'resize']); + assert_equals(video.videoWidth, 200, 'width after second resize event'); + assert_equals(video.videoHeight, 150, 'height after second resize event'); + }, `${format} video`); +} +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-import-to-inactive-document-crash.html b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-import-to-inactive-document-crash.html new file mode 100644 index 0000000000..1e14388efd --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-import-to-inactive-document-crash.html @@ -0,0 +1,7 @@ +<iframe id="i"></iframe> +<video id="v"></video> +<script> +var doc = i.contentDocument; +i.remove(); +doc.importNode(v); +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-poster-shown-preload-auto-ref.html b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-poster-shown-preload-auto-ref.html new file mode 100644 index 0000000000..efa75bb20a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-poster-shown-preload-auto-ref.html @@ -0,0 +1,5 @@ +<!DOCTYPE html> +<html> + <title>Verifies that video poster is shown even if video element has 'preload="auto"' attribute</title> + <video preload="none" poster="/media/poster.png" src="/media/video.ogv" width="100" height="100"></video> +</html> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-poster-shown-preload-auto.html b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-poster-shown-preload-auto.html new file mode 100644 index 0000000000..243924628c --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-poster-shown-preload-auto.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html class="reftest-wait"> + <title>Verifies that video poster is shown even if video element has 'preload="auto"' attribute</title> + <link rel="match" href="video-poster-shown-preload-auto-ref.html"> + <video preload="auto" poster="/media/poster.png" src="/media/video.ogv" width="100" height="100"></video> + <script> + const video = document.querySelector("video"); + video.oncanplaythrough = () => document.documentElement.classList.remove("reftest-wait"); + </script> +</html> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-tabindex.html b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-tabindex.html new file mode 100644 index 0000000000..3044874789 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video-tabindex.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>tabindex on video elements</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#video"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<div id="test"> +<video></video> +</div> +<script> +var t = async_test("Attributes shouldn't magically appear"); +on_event(window, "load", t.step_func(function() { + var el = document.getElementById("test").getElementsByTagName("video")[0]; + assert_equals(el.hasAttribute("tabindex"), false); + t.done() +})) +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_content-ref.htm b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_content-ref.htm new file mode 100644 index 0000000000..c02abb1236 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_content-ref.htm @@ -0,0 +1,12 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>HTML5 Media Elements: Content inside the 'video' element is not shown to the user.</title> + <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + </head> + <body> + <div id='testcontent'> + </div> +</body> +</html> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_content_image.htm b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_content_image.htm new file mode 100644 index 0000000000..0808d894aa --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_content_image.htm @@ -0,0 +1,16 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>HTML5 Media Elements: Content inside the 'video' element is not shown to the user.</title> + <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + <link rel="help" href="https://html.spec.whatwg.org/multipage/#video" /> + <link rel="match" href="video_content-ref.htm" /> + <meta name="assert" content="Content inside the 'video' element is not shown to the user (image)." /> + </head> + <body> + <div id='testcontent'> + <video><img src="../../../../images/fail.gif" /></video> + </div> +</body> +</html> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_content_text.htm b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_content_text.htm new file mode 100644 index 0000000000..639fb73f8f --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_content_text.htm @@ -0,0 +1,16 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>HTML5 Media Elements: Content inside the 'video' element is not shown to the user.</title> + <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + <link rel="help" href="https://html.spec.whatwg.org/multipage/#video" /> + <link rel="match" href="video_content-ref.htm" /> + <meta name="assert" content="Content inside the 'video' element is not shown to the user." /> + </head> + <body> + <div id='testcontent'> + <video><p style="color: red;">FAIL</p></video> + </div> +</body> +</html> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_crash_empty_src.html b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_crash_empty_src.html new file mode 100644 index 0000000000..3aecb4e1eb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_crash_empty_src.html @@ -0,0 +1,29 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>HTML5 Media Elements: An empty src should not crash the player.</title> + <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> + <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> +</head> +<body> +<script> + function makeCrashTest(src) { + async_test((test) => { + const video = document.createElement("video"); + video.src = src; + video.controls = true; + video.addEventListener("error", () => { + document.body.removeChild(video); + test.done(); + }); + document.body.appendChild(video); + }, `src="${src}" does not crash.`); + } + + makeCrashTest("about:blank"); + makeCrashTest(""); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_dynamic_poster-ref.htm b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_dynamic_poster-ref.htm new file mode 100644 index 0000000000..78c03626e1 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_dynamic_poster-ref.htm @@ -0,0 +1,5 @@ +<!DOCTYPE HTML> +<meta charset=UTF-8> +<title>Reference for poster tests</title> +<link rel="author" title="Microsoft" href="http://www.microsoft.com/"> +<img src="/media/poster.png"> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_dynamic_poster_absolute.htm b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_dynamic_poster_absolute.htm new file mode 100644 index 0000000000..bec2b0fba7 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_dynamic_poster_absolute.htm @@ -0,0 +1,12 @@ +<!DOCTYPE HTML> +<meta charset=UTF-8> +<title>The 'HTMLVideoElement' interface supports setting 'poster' to an absolute URL</title> +<link rel="author" title="Microsoft" href="http://www.microsoft.com/"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-video-poster"> +<link rel="match" href="video_dynamic_poster-ref.htm"> +<meta name="assert" content="The 'HTMLVideoElement' interface supports setting 'poster' to an absolute URL"> +<video id="video0">Your browser does not support video.</video> +<script> +var testElem = document.getElementById("video0"); +testElem.poster = "/media/poster.png"; +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_dynamic_poster_relative.htm b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_dynamic_poster_relative.htm new file mode 100644 index 0000000000..4faca61c40 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_dynamic_poster_relative.htm @@ -0,0 +1,12 @@ +<!DOCTYPE HTML> +<meta charset=UTF-8> +<title>The 'HTMLVideoElement' interface supports setting 'poster' to a relative URL</title> +<link rel="author" title="Microsoft" href="http://www.microsoft.com/"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-video-poster"> +<link rel="match" href="video_dynamic_poster-ref.htm"> +<meta name="assert" content="The 'HTMLVideoElement' interface supports setting 'poster' to a relative URL"> +<video id="video0">Your browser does not support video.</video> +<script> +var testElem = document.getElementById("video0"); +testElem.poster = "../../../../media/poster.png"; +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_initially_paused-ref.html b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_initially_paused-ref.html new file mode 100644 index 0000000000..8556aabf23 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_initially_paused-ref.html @@ -0,0 +1,8 @@ +<!DOCTYPE HTML> +<meta charset=UTF-8> +<title>Video elements should initially be paused</title> +<link rel="author" title="Microsoft" href="http://www.microsoft.com/"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-media-paused"> +<script src="/common/media.js"></script> +<p>The following video element should be paused. (All clocks at zero).</p> +<img src='/images/movie_300_frame_0.png'> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_initially_paused.html b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_initially_paused.html new file mode 100644 index 0000000000..b2725b04aa --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_initially_paused.html @@ -0,0 +1,21 @@ +<!DOCTYPE HTML> +<meta charset=UTF-8> +<title>Video elements should initially be paused</title> +<link rel="match" href="video_initially_paused-ref.html"> +<link rel="author" title="Microsoft" href="http://www.microsoft.com/"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-media-paused"> +<script src="/common/media.js"></script> +<style> +div#video { + padding: 6px 3px; +} +</style> +<p>The following video element should be paused. (All clocks at zero).</p> +<div id=video> +<script> +document.write( + "<video src='"+ getVideoURI('/media/movie_300') + "' >" + + "Your browser does not support the video element." + + "<\/video>"); +</script> +</div> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_size_preserved_after_ended.html b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_size_preserved_after_ended.html new file mode 100644 index 0000000000..9b2783c930 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-video-element/video_size_preserved_after_ended.html @@ -0,0 +1,30 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>HTML5 Media Elements: The size of the video shouldn't be lost after an 'ended' event.</title> + <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> + <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> +</head> +<body> +<video id="video"> + <source src="/media/test-1s.mp4" type="video/mp4"> + <source src="/media/test-1s.webm" type="video/webm"> +</video> +<script> + promise_test(async (test) => { + const eventWatcher = new EventWatcher(test, video, ["loadedmetadata", "ended"]); + await eventWatcher.wait_for("loadedmetadata"); + assert_equals(video.videoWidth, 320, "width when the video is loaded"); + assert_equals(video.videoHeight, 240, "height when the video is loaded"); + video.play(); + await eventWatcher.wait_for(["ended"]); + assert_equals(video.videoWidth, 320, "width after playback"); + assert_equals(video.videoHeight, 240, "height after playback"); + if (video.videoTracks) + assert_equals(video.videoTracks.length, 1); + }, "Video dimensions are preserved at the end of the video."); +</script> +</body> +</html> |