OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../media-file.js"></script> |
| 3 <!-- TODO(srivats): Convert test to testharness.js. crbug.com/588956 |
| 4 (Please avoid writing new tests using video-test.js) --> |
| 5 <script src="../video-test.js"></script> |
| 6 <script src="../media-controls.js"></script> |
| 7 <script> |
| 8 |
| 9 var trackCueText = "Bonjour"; |
| 10 |
| 11 function selectTrackAdded() |
| 12 { |
| 13 findMediaElement(); |
| 14 testClosedCaptionsButtonVisibility(true); |
| 15 consoleWrite(""); |
| 16 testExpected("video.textTracks.length", 2); |
| 17 testExpected("video.textTracks[0].mode", "showing"); |
| 18 testExpected("video.textTracks[1].mode", "hidden"); |
| 19 |
| 20 consoleWrite(""); |
| 21 consoleWrite("Verify the default track is being displayed"); |
| 22 testExpected("textTrackDisplayElement(video, 'display').innerText", "Lor
em"); |
| 23 |
| 24 consoleWrite(""); |
| 25 consoleWrite("Select the newly added track"); |
| 26 selectTextTrack(video, 1); |
| 27 testExpected("video.textTracks[1].mode", "showing"); |
| 28 testExpected("video.textTracks[0].mode", "disabled"); |
| 29 testExpected("textTrackDisplayElement(video, 'display').innerText", trac
kCueText); |
| 30 endTest(); |
| 31 } |
| 32 |
| 33 function addTextTrack() |
| 34 { |
| 35 track = video.addTextTrack("captions", "French", "fr"); |
| 36 track.addCue(new VTTCue(0.0, 1.0, trackCueText)); |
| 37 selectTrackAdded(); |
| 38 } |
| 39 |
| 40 window.onload = function() |
| 41 { |
| 42 consoleWrite("Test that we can add a track dynamically and it is display
ed on the track selection menu"); |
| 43 findMediaElement(); |
| 44 video.src = findMediaFile("video", "../content/test"); |
| 45 waitForEvent("canplaythrough", addTextTrack); |
| 46 } |
| 47 |
| 48 </script> |
| 49 <video controls> |
| 50 <track src="captions-webvtt/captions.vtt" kind="captions" label="English" sr
clang="en" default> |
| 51 </video> |
OLD | NEW |