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

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

Issue 2123003003: Convert text-track-selection* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 multiple tracks and select between them from the tra ck selection menu.</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
2 <script src="../media-file.js"></script> 5 <script src="../media-file.js"></script>
3 <!-- TODO(srivats): Convert test to testharness.js. crbug.com/588956
4 (Please avoid writing new tests using video-test.js) -->
5 <script src="../video-test.js"></script>
6 <script src="../media-controls.js"></script> 6 <script src="../media-controls.js"></script>
7 <video controls></video>
7 <script> 8 <script>
8 9 async_test(function(t) {
10 var video = document.querySelector("video");
9 var trackLanguages = ["en", "ru", "fr", "jp", "de"]; 11 var trackLanguages = ["en", "ru", "fr", "jp", "de"];
10 var trackCueText = ["English", "Russian", "French", "Japanese", "German"]; 12 var trackCueText = ["English", "Russian", "French", "Japanese", "German"];
11 13
12 function startTest() 14 video.oncanplaythrough = t.step_func_done(function() {
13 { 15 for (var i = 0; i < trackLanguages.length; i++) {
14 findMediaElement(); 16 var track = video.addTextTrack("captions", trackCueText[i], trackLan guages[i]);
15 testClosedCaptionsButtonVisibility(true); 17 track.addCue(new VTTCue(0, 1, trackCueText[i]));
16 consoleWrite(""); 18 track.mode = "disabled";
17 testExpected("video.textTracks.length", trackLanguages.length); 19 }
18 consoleWrite(""); 20 assert_true(isClosedCaptionsButtonVisible(video));
21 assert_equals(video.textTracks.length, trackLanguages.length);
19 22
20 for (var i = 0; i < trackLanguages.length; i++) { 23 for (var i = 0; i < trackLanguages.length; i++) {
21 consoleWrite("Select track at index " + i); 24 clickTextTrackAtIndex(video, i);
22 selectTextTrack(video, i); 25 assert_equals(video.textTracks[i].mode, "showing");
23 testExpected("video.textTracks[" + i + "].mode", "showing"); 26 assert_equals(textTrackCueDisplayElement(video).innerText, trackCueT ext[i]);
24 testExpected("textTrackDisplayElement(video, 'display').innerText", trackCueText[i]);
25 for (var j = 0; j < trackLanguages.length; j++) { 27 for (var j = 0; j < trackLanguages.length; j++) {
26 if (j != i) 28 if (j != i)
27 testExpected("video.textTracks[" + j + "].mode", "disabled") ; 29 assert_equals(video.textTracks[j].mode, "disabled");
28 } 30 }
29 consoleWrite("");
30 } 31 }
31 endTest(); 32 });
32 }
33 33
34 function addTextTracks() 34 video.src = findMediaFile("video", "../content/test");
35 { 35 });
36 for (var i = 0; i < trackLanguages.length; i++) { 36 </script>
37 var track = video.addTextTrack("captions", trackCueText[i], trackLan guages[i]);
38 track.addCue(new VTTCue(0.0, 1.0, trackCueText[i]));
39 track.mode = "disabled";
40 }
41 startTest();
42 }
43
44 window.onload = function()
45 {
46 consoleWrite("Test that we can add multiple tracks and select between th em from the track selection menu");
47 findMediaElement();
48 video.src = findMediaFile("video", "../content/test");
49 waitForEvent("canplaythrough", addTextTracks);
50 }
51
52 </script>
53 <video controls></video>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698