content/media/test/seek10.js

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

michael@0 1 function test_seek10(v, seekTime, is, ok, finish) {
michael@0 2
michael@0 3 // Test bug 523335 - ensure that if we close a stream while seeking, we
michael@0 4 // don't hang during shutdown. This test won't "fail" per se if it's regressed,
michael@0 5 // it will instead start to cause random hangs in the mochitest harness on
michael@0 6 // shutdown.
michael@0 7
michael@0 8 function startTest() {
michael@0 9 // Must be duration*0.9 rather than seekTime, else we don't hit that problem.
michael@0 10 // This is probably due to the seek bisection finishing too quickly, before
michael@0 11 // we can close the stream.
michael@0 12 v.currentTime = v.duration * 0.9;
michael@0 13 }
michael@0 14
michael@0 15 function done(evt) {
michael@0 16 ok(true, "We don't acutally test anything...");
michael@0 17 finish();
michael@0 18 }
michael@0 19
michael@0 20 function seeking() {
michael@0 21 ok(v.currentTime >= seekTime - 0.1, "Video currentTime should be around " + seekTime + ": " + v.currentTime);
michael@0 22 v.onerror = done;
michael@0 23 v.src = "not a valid video file.";
michael@0 24 v.load(); // Cause the existing stream to close.
michael@0 25 }
michael@0 26
michael@0 27 v.addEventListener("loadeddata", startTest, false);
michael@0 28 v.addEventListener("seeking", seeking, false);
michael@0 29
michael@0 30 }

mercurial