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_duration_after_error.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_duration_after_error.html')
-rw-r--r-- | dom/media/test/test_duration_after_error.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/dom/media/test/test_duration_after_error.html b/dom/media/test/test_duration_after_error.html new file mode 100644 index 0000000000..ad6bbe414f --- /dev/null +++ b/dom/media/test/test_duration_after_error.html @@ -0,0 +1,54 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test playback of media files that should have errors</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> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +var manager = new MediaTestManager; + +function checkDuration(name, e, test) { + if (test.duration) { + ok(Math.abs(e.duration - test.duration) < 0.1, + name + " duration (" + e.duration + ") should be around " + test.duration); + } else { + ok(false, "Test doesn't include the duration field!") + } +} + +function startTest(test, token) { + manager.started(token); + + let v = document.createElement('video'); + v._loadedMetadata = false; + let name = test.name; + + v.onloadedmetadata = function() { + v.onloadedmetadata = null; + v._loadedMetadata = true; + ok(v._loadedMetadata , name + " has loaded metadata."); + } + + v.onerror = function() { + v.onerror = null; + ok(v._loadedMetadata , name + " should load metadata before getting error."); + checkDuration(name, v, test); + manager.finished(token); + } + + v.src = name; + document.body.appendChild(v); + v.play(); +} + +manager.runTests(gDurationTests, startTest); + +</script> +</pre> +</body> +</html> |