| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Tests that tracks can be turned on and off through the track selection me
nu.</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="../media-controls.js"></script> |
| 6 <script src="../media-file.js"></script> |
| 7 <video controls></video> |
| 8 <script> |
| 9 async_test(t => { |
| 10 var captions = ["First", "Second", "Third"]; |
| 11 var video = document.querySelector("video"); |
| 12 |
| 13 video.oncanplaythrough = t.step_func(_ => { |
| 14 var track1 = video.addTextTrack("captions"); |
| 15 var track2 = video.addTextTrack("captions"); |
| 16 |
| 17 for (var i = 0; i < captions.length; i++) { |
| 18 track1.addCue(new VTTCue(0, 120, captions[i])); |
| 19 track2.addCue(new VTTCue(0, 120, captions[i])); |
| 20 } |
| 21 |
| 22 // The controls are updated asynchronously. |
| 23 setTimeout(t.step_func_done(_ => { |
| 24 assert_true(isClosedCaptionsButtonVisible(video)); |
| 25 |
| 26 // The captions track should be listed in textTracks, but not yet loaded. |
| 27 assert_equals(video.textTracks.length, 2); |
| 28 assert_equals(video.textTracks[0].mode, "hidden"); |
| 29 checkCaptionsHidden(video); |
| 30 |
| 31 // Captions track should become visible after the track is selected. |
| 32 clickTextTrackAtIndex(video, 0); |
| 33 checkCaptionsVisible(video, captions); |
| 34 |
| 35 // Captions should not be visible after they're turned off through the men
u. |
| 36 turnClosedCaptionsOff(video); |
| 37 checkCaptionsHidden(video); |
| 38 |
| 39 // Captions track should become visible after the track is selected again. |
| 40 clickTextTrackAtIndex(video, 0); |
| 41 checkCaptionsVisible(video, captions); |
| 42 })); |
| 43 }); |
| 44 |
| 45 video.src = findMediaFile("video", "../content/counting"); |
| 46 }); |
| 47 </script> |
| OLD | NEW |