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

Side by Side Diff: LayoutTests/media/video-controls-drop-order.html

Issue 1156993013: New media playback UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: minor decrufting. Created 5 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Test controls drop order</title>
5 <script src=media-file.js></script>
6 <script src=media-controls.js></script>
7 <script src=video-test.js></script>
8 <script>
9 var numLoaded = 0;
10 var videos = [];
11 var controlNames = [
12 "play-button",
13 "timeline",
14 "mute-button",
15 "volume-slider",
16 "fullscreen-button",
17 "toggle-closed-captions-button",
18 "time-remaining-display",
19 "current-time-display",
20 ];
21
22 function init()
23 {
24 var src = findMediaFile("video", "content/test");
25 videoDiv = document.getElementById("videoDiv");
26 for(var width = 50; width < 550; width += 50) {
27 var video = document.createElement("video");
28 videos.push(video);
29 videoDiv.appendChild(video);
30 video.addTextTrack('captions', 'English', 'en')
31 .addCue(new VTTCue(0.0, 10.0, 'Some random caption text'));
32 video.width = width;
33 video.controls = true;
34
35 // wait for video to load
36 video.addEventListener("canplay",videoLoaded);
37 video.src = src;
38 }
39 }
40
41 function videoLoaded()
42 {
43 // One more video is ready.
44 numLoaded++;
45 if (numLoaded == videos.length) {
46 // All videos are ready.
47 test();
48 }
49 }
50
51 function displayButtonState(video)
52 {
53 var width = video.width;
54
55 for (var controlName of controlNames) {
56 try {
57 var control = mediaControlsButton(video, controlName);
58 var state = (control.style['display'] != 'none') ? "seen" : "gone";
59 //var state = (getComputedStyle(control).display != 'none') ? "seen" : "gone";
60 consoleWrite(width + " " + state + " " + controlName);
61 } catch (exception) {
62 // control is missing
63 consoleWrite("failed for " + width + " " + controlName + " " + exception);
64 }
65 }
66 }
67
68 function test()
69 {
70 for(var videoControl of videos) {
71 displayButtonState(videoControl);
72 }
73 testRunner.notifyDone();
74 }
75 </script>
76 </head>
77 <body onload="init()">
78 Tests that the drop order for controls doesn't change.<br>
79 Output should be [video width in px] [seen or gone] [control name], with
80 one line per control at each width.
81 <div id="videoDiv"></div>
82 </body>
83 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698