content/media/test/seek10.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/test/seek10.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +function test_seek10(v, seekTime, is, ok, finish) {
     1.5 +
     1.6 +// Test bug 523335 - ensure that if we close a stream while seeking, we
     1.7 +// don't hang during shutdown. This test won't "fail" per se if it's regressed,
     1.8 +// it will instead start to cause random hangs in the mochitest harness on
     1.9 +// shutdown.
    1.10 +
    1.11 +function startTest() {
    1.12 +  // Must be duration*0.9 rather than seekTime, else we don't hit that problem.
    1.13 +  // This is probably due to the seek bisection finishing too quickly, before
    1.14 +  // we can close the stream.
    1.15 +  v.currentTime = v.duration * 0.9;
    1.16 +}
    1.17 +
    1.18 +function done(evt) {
    1.19 +  ok(true, "We don't acutally test anything...");
    1.20 +  finish();
    1.21 +}
    1.22 +
    1.23 +function seeking() {
    1.24 +  ok(v.currentTime >= seekTime - 0.1, "Video currentTime should be around " + seekTime + ": " + v.currentTime);
    1.25 +  v.onerror = done;
    1.26 +  v.src = "not a valid video file.";
    1.27 +  v.load(); // Cause the existing stream to close.
    1.28 +}
    1.29 +
    1.30 +v.addEventListener("loadeddata", startTest, false);
    1.31 +v.addEventListener("seeking", seeking, false);
    1.32 +
    1.33 +}

mercurial