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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-controls-captions.html

Issue 2456993003: Improve caption button behavior for video player. (Closed)
Patch Set: Addresss feedback Created 4 years, 1 month 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
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 <track src="track/captions-webvtt/captions-rtl.vtt" kind="captions">
9 </video> 10 </video>
10 <script> 11 <script>
11 async_test(function(t) { 12 async_test(function(t) {
12 var video = document.querySelector("video"); 13 var video = document.querySelector("video");
13 14
14 video.oncanplaythrough = t.step_func(function() { 15 video.oncanplaythrough = t.step_func(function() {
15 assert_true(isClosedCaptionsButtonVisible(video)); 16 assert_true(isClosedCaptionsButtonVisible(video));
16 17
17 // The captions track should be listed in textTracks, but not yet loaded . 18 // The captions track should be listed in textTracks, but not yet loaded .
18 assert_equals(video.textTracks.length, 1); 19 assert_equals(video.textTracks.length, 2);
19 assert_equals(video.textTracks[0].mode, "disabled"); 20 assert_equals(video.textTracks[0].mode, "disabled");
20 assert_equals(textTrackContainerElement(video), null); 21 assert_equals(textTrackContainerElement(video), null);
21 22
22 var track = document.querySelector("track"); 23 var tracks = document.querySelectorAll("track");
23 track.onload = t.step_func(function() { 24 tracks[0].onload = t.step_func(function() {
24 assert_equals(textTrackDisplayElement(video).innerText, "Lorem"); 25 assert_equals(textTrackDisplayElement(video).innerText, "Lorem");
25 26
26 // Captions should not be visible after Off is clicked. 27 // Captions should not be visible after Off is clicked.
27 turnClosedCaptionsOff(video); 28 turnClosedCaptionsOff(video);
28 assert_equals(textTrackDisplayElement(video), null); 29 assert_equals(textTrackDisplayElement(video), null);
29 30
30 // Remove DOM node representing the track element. 31 // Remove DOM node representing the track element.
31 track.remove(); 32 tracks[1].remove();
33 tracks[0].remove();
32 assert_false(isClosedCaptionsButtonVisible(video)); 34 assert_false(isClosedCaptionsButtonVisible(video));
33 35
34 addUnloadableHTMLTrackElement(); 36 addUnloadableHTMLTrackElement();
35 assert_true(isClosedCaptionsButtonVisible(video)); 37 assert_true(isClosedCaptionsButtonVisible(video));
36 38
37 clickTextTrackAtIndex(video, 0); 39 clickTextTrackAtIndex(video, 0);
38 }); 40 });
39 41
40 // Captions track should load and captions should become visible after a track is selected. 42 // Captions track should load and captions should become visible after a track is selected.
41 clickTextTrackAtIndex(video, 0); 43 clickTextTrackAtIndex(video, 0);
(...skipping 16 matching lines...) Expand all
58 60
59 video.appendChild(track); 61 video.appendChild(track);
60 assert_equals(track.readyState, HTMLTrackElement.NONE); 62 assert_equals(track.readyState, HTMLTrackElement.NONE);
61 assert_equals(track.track.mode, "disabled"); 63 assert_equals(track.track.mode, "disabled");
62 assert_equals(video.textTracks.length, 1); 64 assert_equals(video.textTracks.length, 1);
63 } 65 }
64 66
65 video.src = findMediaFile("video", "content/counting"); 67 video.src = findMediaFile("video", "content/counting");
66 }); 68 });
67 </script> 69 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698