Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Side by Side Diff: third_party/WebKit/LayoutTests/media/controls/closed-captions-on-off.html

Issue 2539023002: Media Controls: Use events to update controls for closed captions. (Closed)
Patch Set: zqzhang review comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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(t => {
10 var captions = ["First", "Second", "Third"];
11 var video = document.querySelector("video");
12
13 video.oncanplaythrough = t.step_func(_ => {
14 var track1 = video.addTextTrack("captions");
15 var track2 = video.addTextTrack("captions");
16
17 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 :(
18 track1.addCue(new VTTCue(0, 120, captions[i]));
19 track2.addCue(new VTTCue(0, 120, captions[i]));
20 }
21
22 // 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.
23 setTimeout(t.step_func_done(_ => {
24 assert_true(isClosedCaptionsButtonVisible(video));
25
26 // The captions track should be listed in textTracks, but not yet loaded.
27 assert_equals(video.textTracks.length, 2);
28 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.
29 checkCaptionsHidden(video);
30
31 // Captions track should become visible after the track is selected.
32 clickTextTrackAtIndex(video, 0);
33 checkCaptionsVisible(video, captions);
34
35 // Captions should not be visible after they're turned off through the men u.
36 turnClosedCaptionsOff(video);
37 checkCaptionsHidden(video);
38
39 // Captions track should become visible after the track is selected again.
40 clickTextTrackAtIndex(video, 0);
41 checkCaptionsVisible(video, captions);
42 }));
43 });
44
45 video.src = findMediaFile("video", "../content/counting");
46 });
47 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698