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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
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 <script>
8
9 var trackCueText = "Bonjour";
10
11 function selectTrackAdded()
12 {
13 findMediaElement();
14 testClosedCaptionsButtonVisibility(true);
15 consoleWrite("");
16 testExpected("video.textTracks.length", 2);
17 testExpected("video.textTracks[0].mode", "showing");
18 testExpected("video.textTracks[1].mode", "hidden");
19
20 consoleWrite("");
21 consoleWrite("Verify the default track is being displayed");
22 testExpected("textTrackDisplayElement(video, 'display').innerText", "Lor em");
23
24 consoleWrite("");
25 consoleWrite("Select the newly added track");
26 selectTextTrack(video, 1);
27 testExpected("video.textTracks[1].mode", "showing");
28 testExpected("video.textTracks[0].mode", "disabled");
29 testExpected("textTrackDisplayElement(video, 'display').innerText", trac kCueText);
30 endTest();
31 }
32
33 function addTextTrack()
34 {
35 track = video.addTextTrack("captions", "French", "fr");
36 track.addCue(new VTTCue(0.0, 1.0, trackCueText));
37 selectTrackAdded();
38 }
39
40 window.onload = function()
41 {
42 consoleWrite("Test that we can add a track dynamically and it is display ed on the track selection menu");
43 findMediaElement();
44 video.src = findMediaFile("video", "../content/test");
45 waitForEvent("canplaythrough", addTextTrack);
46 }
47
48 </script>
49 <video controls> 7 <video controls>
50 <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>
51 </video> 9 </video>
10 <script>
11 async_test(function(t) {
12 var trackCueText = "Bonjour";
13 var video = document.querySelector("video");
14
15 video.oncanplaythrough = t.step_func_done(function() {
16 var track = video.addTextTrack("captions", "French", "fr");
17 track.addCue(new VTTCue(0, 1, trackCueText));
18 assert_true(isClosedCaptionsButtonVisible(video));
19 assert_equals(video.textTracks.length, 2);
20 assert_equals(video.textTracks[0].mode, "showing");
21 assert_equals(video.textTracks[1].mode, "hidden");
22
23 // Verify the default track is being displayed.
24 assert_equals(textTrackCueDisplayElement(video).innerText, "Lorem");
25
26 // Click the newly added track.
27 clickTextTrackAtIndex(video, 1);
28 assert_equals(video.textTracks[1].mode, "showing");
29 assert_equals(video.textTracks[0].mode, "disabled");
30 assert_equals(textTrackCueDisplayElement(video).innerText, trackCueText) ;
31 });
32
33 video.src = findMediaFile("video", "../content/test");
34 })
35 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698