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

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: manual rebaseline. 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 <html>
philipj_slow 2015/07/08 14:37:34 https://www.chromium.org/blink/coding-style/layout
liberato (no reviews please) 2015/07/09 12:10:53 Acknowledged.
2 <head>
3 <title>Test controls drop order</title>
4 <script src=media-file.js></script>
5 <script src=media-controls.js></script>
6 <script src=video-test.js></script>
7 <script>
8 var numLoaded = 0;
9 var videos = [];
10 var controlNames = [
11 "play-button",
12 "timeline",
13 "mute-button",
14 "volume-slider",
15 "fullscreen-button",
16 "toggle-closed-captions-button",
17 "time-remaining-display",
18 "current-time-display",
19 ];
20
21 function init()
22 {
23 var src = findMediaFile("video", "content/test");
24 videos=[];
philipj_slow 2015/07/08 14:37:34 videos is already set to []
liberato (no reviews please) 2015/07/09 12:10:54 Done.
25 videoDiv = document.getElementById("videoDiv");
26 for(var width = 50; width < 550; width+=50) {
philipj_slow 2015/07/08 14:37:34 Spaces around operators.
philipj_slow 2015/07/08 14:37:34 This will load quite a few videos in parallel. Can
liberato (no reviews please) 2015/07/09 12:10:53 Done.
liberato (no reviews please) 2015/07/09 12:10:53 Done.
liberato (no reviews please) 2015/07/09 12:10:54 Done.
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 idx in controlNames) {
philipj_slow 2015/07/08 14:37:34 Since these are plain arrays you could use "for (x
liberato (no reviews please) 2015/07/09 12:10:53 Done.
56 var controlName = controlNames[idx];
57 try {
58 var control = mediaControlsButton(video, controlName);
59 var state = (control.style['display'] != 'none') ? "seen" : "gone";
philipj_slow 2015/07/08 14:37:34 Just control.style.display would be be idiomatic,
liberato (no reviews please) 2015/07/09 12:10:55 Done.
60 consoleWrite(width + " " + state + " " + controlName);
61 } catch (exception) {
62 // control is missing
63 consoleWrite("failed for " + width + " " + controlName + " " + exception);
64 testRunner.notifyDone();
philipj_slow 2015/07/08 14:37:34 Seems just as well to let the test finish running,
liberato (no reviews please) 2015/07/09 12:10:56 Done.
65 }
66 }
67 }
68
69 function test()
70 {
71 for(var idx in videos) {
72 displayButtonState(videos[idx]);
73 }
74 testRunner.notifyDone();
75 }
76 </script>
77 </head>
78 <body onload="init()">
79 Tests that the drop order for controls doesn't change.<br>
80 Output should be [video width in px] [seen or gone] [control name], with
81 one line per control at each width.
82 <div id="videoDiv"/>
philipj_slow 2015/07/08 14:37:34 </div> if you want to close the div here, or someo
liberato (no reviews please) 2015/07/09 12:10:53 Done.
83 </body>
84 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698