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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/media/video-controls-drop-order.html
diff --git a/LayoutTests/media/video-controls-drop-order.html b/LayoutTests/media/video-controls-drop-order.html
new file mode 100644
index 0000000000000000000000000000000000000000..d7af1db2dcffb2982da9839510945ddade8bab0d
--- /dev/null
+++ b/LayoutTests/media/video-controls-drop-order.html
@@ -0,0 +1,84 @@
+<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.
+<head>
+ <title>Test controls drop order</title>
+ <script src=media-file.js></script>
+ <script src=media-controls.js></script>
+ <script src=video-test.js></script>
+ <script>
+ var numLoaded = 0;
+ var videos = [];
+ var controlNames = [
+ "play-button",
+ "timeline",
+ "mute-button",
+ "volume-slider",
+ "fullscreen-button",
+ "toggle-closed-captions-button",
+ "time-remaining-display",
+ "current-time-display",
+ ];
+
+ function init()
+ {
+ var src = findMediaFile("video", "content/test");
+ 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.
+ videoDiv = document.getElementById("videoDiv");
+ 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.
+ var video = document.createElement("video");
+ videos.push(video);
+ videoDiv.appendChild(video);
+ video.addTextTrack('captions', 'English', 'en')
+ .addCue(new VTTCue(0.0, 10.0, 'Some random caption text'));
+ video.width = width;
+ video.controls = true;
+
+ // wait for video to load
+ video.addEventListener("canplay",videoLoaded);
+ video.src = src;
+ }
+ }
+
+ function videoLoaded()
+ {
+ // One more video is ready.
+ numLoaded++;
+ if (numLoaded == videos.length) {
+ // All videos are ready.
+ test();
+ }
+ }
+
+ function displayButtonState(video)
+ {
+ var width = video.width;
+
+ 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.
+ var controlName = controlNames[idx];
+ try {
+ var control = mediaControlsButton(video, controlName);
+ 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.
+ consoleWrite(width + " " + state + " " + controlName);
+ } catch (exception) {
+ // control is missing
+ consoleWrite("failed for " + width + " " + controlName + " " + exception);
+ 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.
+ }
+ }
+ }
+
+ function test()
+ {
+ for(var idx in videos) {
+ displayButtonState(videos[idx]);
+ }
+ testRunner.notifyDone();
+ }
+ </script>
+</head>
+<body onload="init()">
+ Tests that the drop order for controls doesn't change.<br>
+ Output should be [video width in px] [seen or gone] [control name], with
+ one line per control at each width.
+ <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.
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698