diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/media/test/test_streams_element_capture_playback.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/test/test_streams_element_capture_playback.html')
-rw-r--r-- | dom/media/test/test_streams_element_capture_playback.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dom/media/test/test_streams_element_capture_playback.html b/dom/media/test/test_streams_element_capture_playback.html new file mode 100644 index 0000000000..ce083069ef --- /dev/null +++ b/dom/media/test/test_streams_element_capture_playback.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test that capturing a stream doesn't stop the underlying element from firing events</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> +</head> +<body> +<audio id="a"></audio> +<pre id="test"> +<script class="testbody" type="text/javascript"> +SimpleTest.waitForExplicitFinish(); + +var a = document.getElementById('a'); +var validTimeUpdate = false; + +function startTest() { + a.src = "big.wav"; + var context = new AudioContext(); + var node = context.createMediaElementSource(a); + node.connect(context.destination); + a.addEventListener("timeupdate", function() { + if (a.currentTime > 0.0 && a.currentTime < 5.0 && !validTimeUpdate) { + validTimeUpdate = true; + ok(true, "Received reasonable currentTime in a timeupdate"); + SimpleTest.finish(); + } + }); + a.addEventListener("ended", function() { + if (!validTimeUpdate) { + ok(false, "Received reasonable currentTime in a timeupdate"); + SimpleTest.finish(); + } + }); + a.play(); +} + +if (a.canPlayType("audio/wave")) { + startTest(); +} else { + todo(false, "No playable audio"); +} +</script> +</pre> +</body> +</html> |