diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/media/autoplay/test/mochitest/file_autoplay_policy_unmute_pauses.html | |
parent | Initial commit. (diff) | |
download | firefox-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 'dom/media/autoplay/test/mochitest/file_autoplay_policy_unmute_pauses.html')
-rw-r--r-- | dom/media/autoplay/test/mochitest/file_autoplay_policy_unmute_pauses.html | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/dom/media/autoplay/test/mochitest/file_autoplay_policy_unmute_pauses.html b/dom/media/autoplay/test/mochitest/file_autoplay_policy_unmute_pauses.html new file mode 100644 index 0000000000..125ee156b6 --- /dev/null +++ b/dom/media/autoplay/test/mochitest/file_autoplay_policy_unmute_pauses.html @@ -0,0 +1,65 @@ +<!DOCTYPE HTML> +<html> + +<head> + <title>Autoplay policy window</title> + <style> + video { + width: 50%; + height: 50%; + } + </style> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/EventUtils.js"></script> + <script type="text/javascript" src="manifest.js"></script> + <script type="text/javascript" src="AutoplayTestUtils.js"></script> +</head> + +<body> + <pre id="test"> + <script> + + window.is = window.opener.is; + window.info = window.opener.info; + + function testAutoplayUnmutePauses(testCase, parent_window) { + return new Promise(function (resolve, reject) { + + info("testAutoplayUnmutePauses: " + testCase.property); + + let element = document.createElement("video"); + element.preload = "auto"; + + // Make inaudible. + element[testCase.property] = testCase.inaudible; + + // Once we've loaded, play, then make audible. + // Assert that the media is paused when we make it audible. + element.addEventListener("loadeddata", () => { + info("loadeddata"); + element.play(); + is(element.paused, false, testCase.property + "=" + testCase.inaudible + " - should be playing"); + element[testCase.property] = testCase.audible; + is(element.paused, true, testCase.property + "=" + testCase.audible + " - should be paused."); + resolve(); + }); + + element.src = "short.mp4"; + element.id = "video"; + document.body.appendChild(element); + }); + } + + nextWindowMessage().then( + (event) => { + testAutoplayUnmutePauses(event.data, event.source) + .then(() => { + event.source.postMessage("done", "*"); + }); + }); + + </script> + </pre> +</body> + +</html> |