| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Tests that the closed captions button enables track switching.</title> | 2 <title>Tests that the closed captions button enables track switching.</title> |
| 3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> | 5 <script src="media-file.js"></script> |
| 6 <script src="media-controls.js"></script> | 6 <script src="media-controls.js"></script> |
| 7 <video controls> | 7 <video controls> |
| 8 <track src="track/captions-webvtt/captions-fast.vtt" kind="captions"> | 8 <track src="track/captions-webvtt/captions-fast.vtt" kind="captions"> |
| 9 </video> | 9 </video> |
| 10 <script> | 10 <script> |
| 11 async_test(function(t) { | 11 async_test(function(t) { |
| 12 var video = document.querySelector("video"); | 12 var video = document.querySelector("video"); |
| 13 | 13 |
| 14 video.oncanplaythrough = t.step_func(function() { | 14 video.oncanplaythrough = t.step_func(function() { |
| 15 assert_true(isClosedCaptionsButtonVisible(video)); | 15 assert_true(isClosedCaptionsButtonVisible(video)); |
| 16 | 16 |
| 17 // The captions track should be listed in textTracks, but not yet loaded
. | 17 // The captions track should be listed in textTracks, but not yet loaded
. |
| 18 assert_equals(video.textTracks.length, 1); | 18 assert_equals(video.textTracks.length, 1); |
| 19 assert_equals(video.textTracks[0].mode, "disabled"); | 19 assert_equals(video.textTracks[0].mode, "disabled"); |
| 20 assert_equals(textTrackContainerElement(video), null); | 20 assert_equals(textTrackContainerElement(video), null); |
| 21 | 21 |
| 22 var track = document.querySelector("track"); | 22 var track = document.querySelector("track"); |
| 23 track.onload = t.step_func(function() { | 23 track.onload = t.step_func(function() { |
| 24 assert_equals(textTrackCueElementByIndex(video, 0).innerText, "Lorem
"); | 24 assert_equals(textTrackDisplayElement(video).innerText, "Lorem"); |
| 25 | 25 |
| 26 // Captions should not be visible after Off is clicked. | 26 // Captions should not be visible after Off is clicked. |
| 27 turnClosedCaptionsOff(video); | 27 turnClosedCaptionsOff(video); |
| 28 assert_equals(textTrackCueDisplayElement(video), null); | 28 assert_equals(textTrackDisplayElement(video), null); |
| 29 | 29 |
| 30 // Remove DOM node representing the track element. | 30 // Remove DOM node representing the track element. |
| 31 track.remove(); | 31 track.remove(); |
| 32 assert_false(isClosedCaptionsButtonVisible(video)); | 32 assert_false(isClosedCaptionsButtonVisible(video)); |
| 33 | 33 |
| 34 addUnloadableHTMLTrackElement(); | 34 addUnloadableHTMLTrackElement(); |
| 35 assert_true(isClosedCaptionsButtonVisible(video)); | 35 assert_true(isClosedCaptionsButtonVisible(video)); |
| 36 | 36 |
| 37 clickTextTrackAtIndex(video, 0); | 37 clickTextTrackAtIndex(video, 0); |
| 38 }); | 38 }); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 58 | 58 |
| 59 video.appendChild(track); | 59 video.appendChild(track); |
| 60 assert_equals(track.readyState, HTMLTrackElement.NONE); | 60 assert_equals(track.readyState, HTMLTrackElement.NONE); |
| 61 assert_equals(track.track.mode, "disabled"); | 61 assert_equals(track.track.mode, "disabled"); |
| 62 assert_equals(video.textTracks.length, 1); | 62 assert_equals(video.textTracks.length, 1); |
| 63 } | 63 } |
| 64 | 64 |
| 65 video.src = findMediaFile("video", "content/counting"); | 65 video.src = findMediaFile("video", "content/counting"); |
| 66 }); | 66 }); |
| 67 </script> | 67 </script> |
| OLD | NEW |