Old subtitle track is not deleted on 'src' attribute change event
[WebKit-https.git] / LayoutTests / media / track / text-track-src-change.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
6         <script src=../media-file.js></script>
7         <script src=../video-test.js></script>
8         <script>
9             var stage = 0; 
10
11             function trackLoaded()
12             {
13                 var testTrack = document.getElementById('testTrack');
14                 switch (stage) {
15                     case 0:
16                         consoleWrite("<br>*** Testing Track 'src' changing");
17                         cues = testTrack.track.cues;
18                         testExpected("cues.length", 4);
19                         consoleWrite("<br>*** Changing 'src' attribute...");
20                         ++stage;
21                         testTrack.src = "captions-webvtt/captions-long.vtt";
22                         break;
23                     case 1:
24                         cues = testTrack.track.cues;
25                         testExpected("cues.length", 100);
26                         consoleWrite("<br>*** Changing back 'src' attribute...");
27                         ++stage;
28                         testTrack.src = "captions-webvtt/tc013-settings.vtt";
29                         break;
30                     case 2:
31                         cues = testTrack.track.cues;
32                         testExpected("cues.length", 4);
33                         endTest();
34                         break;
35                 }
36             }
37
38             setCaptionDisplayMode('Automatic');
39         </script>
40     </head>
41     <body>
42         <p>Tests Track 'src' changing handling</p>
43         <video>
44             <track id="testTrack" src="captions-webvtt/tc013-settings.vtt" kind="captions" onload="trackLoaded()" default>
45         </video>
46     </body>
47 </html>