| 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 assert_false(isClosedCaptionsButtonVisible(video)); |
| 24 |
| 25 setTimeout(t.step_func_done(_ => { |
| 26 assert_true(isClosedCaptionsButtonVisible(video)); |
| 27 |
| 28 // The captions track should be listed in textTracks, but not yet loaded. |
| 29 assert_equals(video.textTracks.length, 2); |
| 30 assert_equals(video.textTracks[0].mode, 'hidden'); |
| 31 assert_equals(video.textTracks[1].mode, 'hidden'); |
| 32 checkCaptionsHidden(video); |
| 33 |
| 34 // Captions track should become visible after the track is selected. |
| 35 clickTextTrackAtIndex(video, 0); |
| 36 checkCaptionsVisible(video, captions); |
| 37 |
| 38 // Captions should not be visible after they're turned off through the men
u. |
| 39 turnClosedCaptionsOff(video); |
| 40 checkCaptionsHidden(video); |
| 41 |
| 42 // Captions track should become visible after the track is selected again. |
| 43 clickTextTrackAtIndex(video, 0); |
| 44 checkCaptionsVisible(video, captions); |
| 45 })); |
| 46 }); |
| 47 |
| 48 video.src = findMediaFile('video', '../content/counting'); |
| 49 }); |
| 50 </script> |
| OLD | NEW |