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

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: address nits 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 var panel = mediaControlsButton(video, "panel");
23 { 17 video.onwebkitfullscreenchange = t.step_func(function() {
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) { 18 switch (count) {
55 case 0: 19 case 0:
56 runAfterHideMediaControlsTimerFired(continueTest, video); 20 runAfterHideMediaControlsTimerFired(function() {
57 break; 21 document.webkitExitFullscreen();
58 case 1: 22 }, video);
59 consoleWrite(""); 23 break;
60 consoleWrite("** The controls should be shown after exiting the fullscreen"); 24 case 1:
61 var opacity = getComputedStyle(panel).opacity; 25 // The controls should be shown after exiting fullscreen.
62 if (opacity < 1) 26 assert_equals(getComputedStyle(panel).opacity, "1");
63 failTest("Media control is not opaque."); 27 t.done();
64 else
65 endTest();
66 } 28 }
67 count++; 29 count++;
68 } 30 });
69 31
70 function continueTest() 32 var playButtonCoordinates = mediaControlsButtonCoordinates(video, "play- button");
71 { 33 // Move mouse to the play button and start playing the video.
72 consoleWrite(""); 34 eventSender.mouseMoveTo(playButtonCoordinates[0], playButtonCoordinates[ 1]);
73 run("document.webkitExitFullscreen()"); 35 eventSender.mouseDown();
74 } 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