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"/>
11 <div id=
"content" style=
"display: none">
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);
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";
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.");