diff options
Diffstat (limited to 'dom/media/test/seek_support.js')
-rw-r--r-- | dom/media/test/seek_support.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/dom/media/test/seek_support.js b/dom/media/test/seek_support.js new file mode 100644 index 000000000..b193fb60a --- /dev/null +++ b/dom/media/test/seek_support.js @@ -0,0 +1,55 @@ +SimpleTest.requestLongerTimeout(3); +var manager = new MediaTestManager; + +// https://bugzilla.mozilla.org/show_bug.cgi?id=634747 +if (navigator.platform.startsWith("Win")) { + SimpleTest.expectAssertions(0, 5); +} else { + // This is "###!!! ASSERTION: Page read cursor should be inside range: 'mPageOffset <= endOffset'" + // https://bugzilla.mozilla.org/show_bug.cgi?id=846769 + SimpleTest.expectAssertions(0, 5); +} + +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 = new Object; + 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 v = document.createElement('video'); + v.token = token += "-seek" + test.number + ".js"; + manager.started(v.token); + v.src = test.name; + v.preload = "metadata"; + document.body.appendChild(v); + var name = test.name + " seek test " + test.number; + var localIs = function(name) { return function(a, b, msg) { + is(a, b, name + ": " + msg); + }}(name); + var localOk = function(name) { return function(a, msg) { + ok(a, name + ": " + msg); + }}(name); + var localFinish = function(v, manager) { return function() { + v.onerror = null; + removeNodeAndSource(v); + dump("SEEK-TEST: Finished " + name + " token: " + v.token + "\n"); + manager.finished(v.token); + }}(v, manager); + dump("SEEK-TEST: Started " + name + "\n"); + window['test_seek' + test.number](v, test.duration/2, localIs, localOk, localFinish); +} |