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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-controls-visible-exiting-fullscreen.html

Issue 2118453002: Convert video-controls-visibility* 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 <html> 1 <!DOCTYPE html>
2 <head> 2 <title>Tests that video controls are shown after exiting fullscreen.</title>
3 <title>Test rendering of video control after exiting fullscreen</title> 3 <script src="../fullscreen/full-screen-test.js"></script>
4 <script src=media-file.js></script> 4 <script src="../resources/testharness.js"></script>
5 <script src=media-controls.js></script> 5 <script src="../resources/testharnessreport.js"></script>
6 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 6 <script src="media-file.js"></script>
7 (Please avoid writing new tests using video-test.js) --> 7 <script src="media-controls.js"></script>
8 <script src=video-test.js></script> 8 <video controls></video>
9 <script src=../fullscreen/full-screen-test.js></script> 9 <script>
10 <script> 10 async_test(function(t) {
11 var panel; 11 var count = 0;
12 var playButtonCoordinates; 12 var video = document.querySelector("video");
13 var count = 0;
14 13
15 function init() 14 video.oncanplaythrough = t.step_func(function() {
16 {
17 findMediaElement();
18 waitForEvent(video, 'canplaythrough', oncanplaythrough);
19 video.src = findMediaFile('video', 'content/test');
20 }
21 15
22 function oncanplaythrough() 16 video.onwebkitfullscreenchange = t.step_func(function() {
23 {
24 waitForEvent(video, 'webkitfullscreenchange', onfullscreenchange);
25
26 panel = mediaControlsButton(video, "panel");
27 if (window.eventSender) {
28 try {
29 playButtonCoordinates = mediaControlsButtonCoordinates(video , "play-button");
30 } catch (exception) {
31 testRunner.notifyDone();
32 return;
33 }
34 var x = playButtonCoordinates[0];
35 var y = playButtonCoordinates[1];
36
37 consoleWrite("** Move mouse to the play button and start playing the video **");
38 eventSender.mouseMoveTo(x, y);
39 eventSender.mouseDown();
40 eventSender.mouseUp();
41 consoleWrite("");
42 }
43
44 consoleWrite("** Test that controls are shown when controls attribut e is present **");
45 var opacity = getComputedStyle(panel).opacity;
46 if (opacity < 1)
47 failTest("Media control is not opaque.");
48 else
49 runWithKeyDown(function(){ video.webkitRequestFullscreen(); });
50 }
51
52 function onfullscreenchange()
53 {
54 switch (count) { 17 switch (count) {
55 case 0: 18 case 0:
56 runAfterHideMediaControlsTimerFired(continueTest, video); 19 runAfterHideMediaControlsTimerFired(function() {
57 break; 20 document.webkitExitFullscreen();
58 case 1: 21 }, video);
59 consoleWrite(""); 22 break;
60 consoleWrite("** The controls should be shown after exiting the fullscreen"); 23 case 1:
61 var opacity = getComputedStyle(panel).opacity; 24 // The controls should be shown after exiting the fullscreen.
fs 2016/06/30 13:43:58 Nit: drop "the" before "fullscreen".
Srirama 2016/06/30 13:58:04 Done.
62 if (opacity < 1) 25 assert_equals(getComputedStyle(panel).opacity, "1");
63 failTest("Media control is not opaque."); 26 t.done();
64 else
65 endTest();
66 } 27 }
67 count++; 28 count++;
68 } 29 });
69 30
70 function continueTest() 31 var panel = mediaControlsButton(video, "panel");
foolip 2016/06/30 13:53:15 Maybe hoist this to the top since it's used above?
Srirama 2016/06/30 13:58:04 Done.
71 { 32 var playButtonCoordinates = mediaControlsButtonCoordinates(video, "play- button");
72 consoleWrite(""); 33 // Move mouse to the play button and start playing the video.
73 run("document.webkitExitFullscreen()"); 34 eventSender.mouseMoveTo(playButtonCoordinates[0], playButtonCoordinates[ 1]);
74 } 35 eventSender.mouseDown();
36 eventSender.mouseUp();
75 37
76 </script> 38 // Test that controls are shown when controls attribute is present.
77 </head> 39 assert_equals(getComputedStyle(panel).opacity, "1");
78 <body onload="init()"> 40 runWithKeyDown(function() { video.webkitRequestFullscreen(); });
79 Tests that video controls are shwon after exiting fullscreen<br> 41 });
80 <video controls></video> 42
81 </body> 43 video.src = findMediaFile("video", "content/test");
82 </html> 44 });
45 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698