content/media/test/seek7.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/test/seek7.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +function test_seek7(v, seekTime, is, ok, finish) {
     1.5 +
     1.6 +// If a NaN is passed to currentTime, make sure this is caught
     1.7 +// otherwise an infinite loop in the Ogg backend occurs.
     1.8 +var completed = false;
     1.9 +var thrown1 = false;
    1.10 +var thrown2 = false;
    1.11 +var thrown3 = false;
    1.12 +
    1.13 +function startTest() {
    1.14 +  if (completed)
    1.15 +    return;
    1.16 +
    1.17 +  try {
    1.18 +    v.currentTime = NaN;
    1.19 +  } catch(e) {
    1.20 +    thrown1 = true;
    1.21 +  }
    1.22 +
    1.23 +  try {
    1.24 +    v.currentTime = Math.random;
    1.25 +  } catch(e) {
    1.26 +    thrown3 = true;
    1.27 +  }
    1.28 +
    1.29 +  completed = true;
    1.30 +  ok(thrown1, "Setting currentTime to invalid value of NaN");
    1.31 +  ok(thrown3, "Setting currentTime to invalid value of a function");
    1.32 +  finish();
    1.33 +}
    1.34 +
    1.35 +v.addEventListener("loadedmetadata", startTest, false);
    1.36 +
    1.37 +}

mercurial