Source/WebCore:
[WebKit-https.git] / LayoutTests / media / track / track-in-band-metadata-display-order.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <title>track-in-band-metadata-display-order</title>
5     <script src="../video-test.js"></script>
6     <script src="../media-file.js"></script>
7     <script src="../media-controls.js"></script>
8     <script>
9         window.addEventListener('load', async event => {
10             window.video = document.querySelector('video');
11             run('video.src = findMediaFile("video", "../content/test")');
12
13             await waitFor(video, 'canplaythrough');
14
15             run('captionTrack = video.addTextTrack("captions")');
16             run('captionTrack.mode = "showing"');
17             run('metadataTrack = video.addTextTrack("metadata")');
18             run('metadataTrack.mode = "hidden"');
19             run('cue = internals.createGenericCue(2, 4, "I am earlier")')
20             run('cue.line = 40');
21             run('captionTrack.addCue(cue)');
22             run('cue = internals.createGenericCue(2.5, 4.5, "I am later")');
23             run('cue.line = 80');
24             run('captionTrack.addCue(cue)');
25             run('metadataTrack.addCue(new DataCue(2.25, video.duration, "first data cue"))')
26             run('metadataTrack.addCue(new DataCue(2.25, video.duration, "second data cue"))')
27
28             run('video.currentTime = 3');
29             await waitFor(video, 'seeked');
30
31             testExpected('textTrackDisplayElement(video, "display", 0).textContent', 'I am later');
32             testExpected('textTrackDisplayElement(video, "display", 1).textContent', 'I am earlier');
33
34             endTest();
35         });
36     </script>
37 </head>
38 <body>
39     <video controls></video>
40 </body>
41 </html>