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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html

Issue 2268923003: Clean up textTrackDisplayElement utility function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 3 months 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>Test that we can add a track dynamically and it is displayed on the track selection menu.</title> 2 <title>Test that we can add a track dynamically and it is displayed on the track selection menu.</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="captions-webvtt/captions.vtt" kind="captions" label="English" sr clang="en" default> 8 <track src="captions-webvtt/captions.vtt" kind="captions" label="English" sr clang="en" default>
9 </video> 9 </video>
10 <script> 10 <script>
11 async_test(function(t) { 11 async_test(function(t) {
12 var trackCueText = "Bonjour"; 12 var trackCueText = "Bonjour";
13 var video = document.querySelector("video"); 13 var video = document.querySelector("video");
14 14
15 video.oncanplaythrough = t.step_func_done(function() { 15 video.oncanplaythrough = t.step_func_done(function() {
16 var track = video.addTextTrack("captions", "French", "fr"); 16 var track = video.addTextTrack("captions", "French", "fr");
17 track.addCue(new VTTCue(0, 1, trackCueText)); 17 track.addCue(new VTTCue(0, 1, trackCueText));
18 assert_true(isClosedCaptionsButtonVisible(video)); 18 assert_true(isClosedCaptionsButtonVisible(video));
19 assert_equals(video.textTracks.length, 2); 19 assert_equals(video.textTracks.length, 2);
20 assert_equals(video.textTracks[0].mode, "showing"); 20 assert_equals(video.textTracks[0].mode, "showing");
21 assert_equals(video.textTracks[1].mode, "hidden"); 21 assert_equals(video.textTracks[1].mode, "hidden");
22 22
23 // Verify the default track is being displayed. 23 // Verify the default track is being displayed.
24 assert_equals(textTrackCueDisplayElement(video).innerText, "Lorem"); 24 assert_equals(textTrackDisplayElement(video).innerText, "Lorem");
25 25
26 // Click the newly added track. 26 // Click the newly added track.
27 clickTextTrackAtIndex(video, 1); 27 clickTextTrackAtIndex(video, 1);
28 assert_equals(video.textTracks[1].mode, "showing"); 28 assert_equals(video.textTracks[1].mode, "showing");
29 assert_equals(video.textTracks[0].mode, "disabled"); 29 assert_equals(video.textTracks[0].mode, "disabled");
30 assert_equals(textTrackCueDisplayElement(video).innerText, trackCueText) ; 30 assert_equals(textTrackDisplayElement(video).innerText, trackCueText);
31 }); 31 });
32 32
33 video.src = findMediaFile("video", "../content/test"); 33 video.src = findMediaFile("video", "../content/test");
34 }) 34 })
35 </script> 35 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698