blob: 1490edb94b5b9646ac583753b916d7f87b6c40e6 [file] [log] [blame]
Tests that the closed captions button, when toggled, updates the text track display area.
Set the user language preference so that the track will be chosen when the CC button is clicked.
RUN(internals.setUserPreferredLanguages(['en']))
EVENT(canplaythrough)
** Caption button should be visible and enabled because we have a captions track.
EXPECTED (captionsButtonCoordinates[0] > '0') OK
EXPECTED (captionsButtonCoordinates[1] > '0') OK
EXPECTED (captionsButtonElement.disabled == 'false') OK
** The captions track should be listed in textTracks, but not yet loaded. **
EXPECTED (video.textTracks.length == '1') OK
EXPECTED (video.textTracks[0].mode == 'disabled') OK
No text track cue with display id '-webkit-media-text-track-display' is currently visible
** Captions track should load and captions should become visible after button is clicked **
*** Click the CC button.
EXPECTED (textTrackDisplayElement(video, 'display').innerText == 'Lorem') OK
** Captions should not be visible after button is clicked again **
*** Click the CC button.
No text track cue with display id '-webkit-media-text-track-display' is currently visible
** Remove DOM node representing the track element **
** Caption button should not be visible as there are no caption tracks.
EXPECTED (captionsButtonCoordinates[0] <= '0') OK
EXPECTED (captionsButtonCoordinates[1] <= '0') OK
** Add non-default text track through HTML with unloadable URI **
EXPECTED (track.readyState == '0') OK
EXPECTED (track.track.mode == 'disabled') OK
EXPECTED (video.textTracks.length == '1') OK
** Caption button should be visible and enabled because we have a captions track.
EXPECTED (captionsButtonCoordinates[0] > '0') OK
EXPECTED (captionsButtonCoordinates[1] > '0') OK
EXPECTED (captionsButtonElement.disabled == 'false') OK
*** Click the CC button.
** Track failed to load **
** Caption button should not be visible as there are no caption tracks.
EXPECTED (captionsButtonCoordinates[0] <= '0') OK
EXPECTED (captionsButtonCoordinates[1] <= '0') OK
** Add a text track through JS to the video element **
** Caption button should be visible and enabled because we have a captions track.
EXPECTED (captionsButtonCoordinates[0] > '0') OK
EXPECTED (captionsButtonCoordinates[1] > '0') OK
EXPECTED (captionsButtonElement.disabled == 'false') OK
END OF TEST