Bug 1943761 - Add class alignment to the mozsearch analysis file. r=asuth
[gecko.git] / dom / media / webvtt / test / mochitest / test_trackelementsrc.html
blob7bbd8937fd4483375fd6cfec8eaa61ac4ce56b39
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>Test for Bug 1281418 - Change the src attribue for TrackElement.</title>
6 <script src="/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
8 </head>
9 <body>
10 <p id="display"></p>
11 <div id="content" style="display: none">
12 </div>
13 <pre id="test">
14 <script class="testbody" type="text/javascript">
15 SimpleTest.waitForExplicitFinish();
17 var video = document.createElement("video");
18 video.src = "seek.webm";
19 video.preload = "metadata";
20 var trackElement = document.createElement("track");
21 trackElement.src = "basic.vtt";
22 trackElement.default = true;
24 document.getElementById("content").appendChild(video);
25 video.appendChild(trackElement);
27 video.addEventListener("loadedmetadata", function metadata() {
28 if (trackElement.readyState <= 1) {
29 setTimeout(metadata, 0);
30 return;
32 is(video.textTracks.length, 1, "Length should be 1.");
33 is(video.textTracks[0].cues.length, 6, "Cue length should be 6.");
35 trackElement.src = "sequential.vtt";
36 trackElement.track.mode = "showing";
37 video.play();
38 });
40 video.addEventListener("ended", function end() {
41 is(trackElement.readyState, 2, "readyState should be 2.")
42 is(video.textTracks.length, 1, "Length should be 1.");
43 is(video.textTracks[0].cues.length, 3, "Cue length should be 3.");
44 SimpleTest.finish();
45 });
46 </script>
47 </pre>
48 </body>
49 </html>