| 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(function(t) { | |
| 10 var captions = ["First", "Second", "Third"]; | |
| 11 var video = document.querySelector("video"); | |
| 12 | |
| 13 video.oncanplaythrough = t.step_func_done(function() { | |
| 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 assert_true(isClosedCaptionsButtonVisible(video)); | |
| 22 | |
| 23 // The captions track should be listed in textTracks, but not yet loaded
. | |
| 24 assert_equals(video.textTracks.length, 2); | |
| 25 assert_equals(video.textTracks[0].mode, "hidden"); | |
| 26 checkCaptionsHidden(video); | |
| 27 | |
| 28 // Captions track should become visible after the track is selected. | |
| 29 clickTextTrackAtIndex(video, 0); | |
| 30 checkCaptionsVisible(video, captions); | |
| 31 | |
| 32 // Captions should not be visible after they're turned off through the m
enu. | |
| 33 turnClosedCaptionsOff(video); | |
| 34 checkCaptionsHidden(video); | |
| 35 | |
| 36 // Captions track should become visible after the track is selected agai
n. | |
| 37 clickTextTrackAtIndex(video, 0); | |
| 38 checkCaptionsVisible(video, captions); | |
| 39 }); | |
| 40 | |
| 41 video.src = findMediaFile("video", "content/counting"); | |
| 42 }); | |
| 43 </script> | |
| OLD | NEW |