| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>A single track should not show overflow on caption button-press, instead
just toggle.</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 = ["Caption"]; |
| 11 var video = document.querySelector("video"); |
| 12 |
| 13 video.oncanplaythrough = t.step_func(_ => { |
| 14 var track1 = video.addTextTrack("captions"); |
| 15 |
| 16 for (var i = 0; i < captions.length; ++i) |
| 17 track1.addCue(new VTTCue(0, 120, captions[i])); |
| 18 |
| 19 // The controls are updated asynchronously. |
| 20 assert_false(isClosedCaptionsButtonVisible(video)); |
| 21 |
| 22 setTimeout(t.step_func_done(_ => { |
| 23 assert_true(isClosedCaptionsButtonVisible(video)); |
| 24 |
| 25 // The captions track should be listed in textTracks, but not yet loaded. |
| 26 assert_equals(video.textTracks.length, 1); |
| 27 assert_equals(video.textTracks[0].mode, "hidden"); |
| 28 checkCaptionsHidden(video); |
| 29 |
| 30 // Get the menu that displays the list of text tracks. |
| 31 var captionsList = mediaControlsElement(internals.shadowRoot(video).firstC
hild, |
| 32 "-internal-media-controls-text-track-list"); |
| 33 |
| 34 clickCaptionButton(video); |
| 35 assert_equals(getComputedStyle(captionsList).display, "none"); |
| 36 |
| 37 // Captions track should become visible after the closed caption button is
pressed. |
| 38 checkCaptionsVisible(video, captions); |
| 39 |
| 40 // Click the closed captions button again and make sure the menu does not
appear. |
| 41 clickCaptionButton(video); |
| 42 assert_equals(getComputedStyle(captionsList).display, "none"); |
| 43 |
| 44 // Captions track should become invisible after the closed caption button
is pressed. |
| 45 checkCaptionsHidden(video); |
| 46 })); |
| 47 }); |
| 48 |
| 49 video.src = findMediaFile("video", "../content/counting"); |
| 50 }); |
| 51 </script> |
| OLD | NEW |