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/seek_support.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/test/seek_support.js')
-rw-r--r-- | dom/media/test/seek_support.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/dom/media/test/seek_support.js b/dom/media/test/seek_support.js new file mode 100644 index 0000000000..ca6d563f1a --- /dev/null +++ b/dom/media/test/seek_support.js @@ -0,0 +1,61 @@ +// This file expects manifest.js to be included in the same scope. +/* import-globals-from manifest.js */ +// This file expects SEEK_TEST_NUMBER to be defined by the test. +/* global SEEK_TEST_NUMBER */ +var manager = new MediaTestManager(); + +function createTestArray() { + var tests = []; + var tmpVid = document.createElement("video"); + + for (var testNum = 0; testNum < gSeekTests.length; testNum++) { + var test = gSeekTests[testNum]; + if (!tmpVid.canPlayType(test.type)) { + continue; + } + + var t = {}; + t.name = test.name; + t.type = test.type; + t.duration = test.duration; + t.number = SEEK_TEST_NUMBER; + tests.push(t); + } + return tests; +} + +function startTest(test, token) { + var video = document.createElement("video"); + video.token = token += "-seek" + test.number + ".js"; + manager.started(video.token); + video.src = test.name; + video.preload = "metadata"; + document.body.appendChild(video); + var name = test.name + " seek test " + test.number; + var localIs = (function (n) { + return function (a, b, msg) { + is(a, b, n + ": " + msg); + }; + })(name); + var localOk = (function (n) { + return function (a, msg) { + ok(a, n + ": " + msg); + }; + })(name); + var localFinish = (function (v, m) { + return function () { + v.onerror = null; + removeNodeAndSource(v); + dump("SEEK-TEST: Finished " + name + " token: " + v.token + "\n"); + m.finished(v.token); + }; + })(video, manager); + dump("SEEK-TEST: Started " + name + "\n"); + window["test_seek" + test.number]( + video, + test.duration / 2, + localIs, + localOk, + localFinish + ); +} |