Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/controls/closed-captions-on-off.html |
| diff --git a/third_party/WebKit/LayoutTests/media/controls/closed-captions-on-off.html b/third_party/WebKit/LayoutTests/media/controls/closed-captions-on-off.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5be08709452bd69886003a564d0416aff193b13c |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/media/controls/closed-captions-on-off.html |
| @@ -0,0 +1,47 @@ |
| +<!DOCTYPE html> |
| +<title>Tests that tracks can be turned on and off through the track selection menu.</title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="../media-controls.js"></script> |
| +<script src="../media-file.js"></script> |
| +<video controls></video> |
| +<script> |
| +async_test(t => { |
| + var captions = ["First", "Second", "Third"]; |
| + var video = document.querySelector("video"); |
| + |
| + video.oncanplaythrough = t.step_func(_ => { |
| + var track1 = video.addTextTrack("captions"); |
| + var track2 = video.addTextTrack("captions"); |
| + |
| + for (var i = 0; i < captions.length; i++) { |
|
foolip
2016/12/02 11:29:17
for (var caption of captions) would work.
mlamouri (slow - plz ping)
2016/12/05 15:17:56
It doesn't :(
|
| + track1.addCue(new VTTCue(0, 120, captions[i])); |
| + track2.addCue(new VTTCue(0, 120, captions[i])); |
| + } |
| + |
| + // The controls are updated asynchronously. |
|
foolip
2016/12/02 11:29:17
Maybe after each of these comments, update that it
mlamouri (slow - plz ping)
2016/12/05 15:17:56
Sure.
|
| + setTimeout(t.step_func_done(_ => { |
| + assert_true(isClosedCaptionsButtonVisible(video)); |
| + |
| + // The captions track should be listed in textTracks, but not yet loaded. |
| + assert_equals(video.textTracks.length, 2); |
| + assert_equals(video.textTracks[0].mode, "hidden"); |
|
foolip
2016/12/02 11:29:17
and video.textTracks[1].mode?
mlamouri (slow - plz ping)
2016/12/05 15:17:56
Done.
|
| + checkCaptionsHidden(video); |
| + |
| + // Captions track should become visible after the track is selected. |
| + clickTextTrackAtIndex(video, 0); |
| + checkCaptionsVisible(video, captions); |
| + |
| + // Captions should not be visible after they're turned off through the menu. |
| + turnClosedCaptionsOff(video); |
| + checkCaptionsHidden(video); |
| + |
| + // Captions track should become visible after the track is selected again. |
| + clickTextTrackAtIndex(video, 0); |
| + checkCaptionsVisible(video, captions); |
| + })); |
| + }); |
| + |
| + video.src = findMediaFile("video", "../content/counting"); |
| +}); |
| +</script> |