summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_seekable1.html
blob: f63e0a63473cb15aeebaca68b3d366cd672ced9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE HTML>
<html>
<head>
<title>Test seekable member for media elements</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<pre id='test'>
<script class="testbody" type='application/javascript;version=1.8'>

let manager = new MediaTestManager;

function finish_test(element) {
  if (element.parentNode)
    element.parentNode.removeChild(element);
  element.src="";
  manager.finished(element.token);
}

var tests = [
// Test using a finite media stream, and a server supporting range requests
{
setup : function(element) {
          is(element.seekable.length, 0, "seekable.length should be initialy 0.");
          element.addEventListener("loadedmetadata", function() {
              is(element.seekable.length, 1, "seekable.length should be 1 for a server supporting range requests.");

              is(element.seekable.start(0), 0.0, "The start of the first range should be the initialTime.");
              is(element.seekable.end(0), element.duration, "The end of the first range should be the duration.")
              finish_test(element);
              }, false);
        }
}
];

function createTestArray() {
  var A = [];
    for (var k=0; k < gProgressTests.length; k++) {
      var t = new Object();
      t.setup = tests[0].setup;
      t.name = gProgressTests[k].name;
      t.type = gProgressTests[k].type;
      A.push(t);
    }
  return A;
}

function startTest(test, token) {
  var elemType = getMajorMimeType(test.type);
  var element = document.createElement(elemType);
  element.preload = "auto";
  element.src = test.name;
  element.token = token;
  test.setup(element);
  manager.started(token);
}

manager.runTests(createTestArray(), startTest);

</script>
</pre>
</body>
</html>