OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test video controls visibility when mouse is not over controls.</title> |
3 <style> | 3 <script src="../resources/testharness.js"></script> |
4 #no-video-media { | 4 <script src="../resources/testharnessreport.js"></script> |
5 width: 320px; | 5 <script src="media-file.js"></script> |
6 height: 240px; | 6 <script src="media-controls.js"></script> |
7 } | 7 <video controls loop></video> |
8 </style> | |
9 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
10 (Please avoid writing new tests using video-test.js) --> | |
11 <script src=video-test.js></script> | |
12 <script src=media-file.js></script> | |
13 <script src=media-controls.js></script> | |
14 <script> | 8 <script> |
15 var controls; | 9 async_test(function(t) { |
| 10 var video = document.querySelector("video"); |
16 | 11 |
17 function runTest() | 12 video.oncanplaythrough = t.step_func(function() { |
18 { | 13 assert_true(video.paused); |
19 video = document.getElementById("no-video-media"); | |
20 | 14 |
21 testExpected("video.paused", true); | 15 // Click the play button. |
22 if (!window.testRunner) | 16 var coords = mediaControlsButtonCoordinates(video, "play-button"); |
23 return; | 17 eventSender.mouseMoveTo(coords[0], coords[1]); |
| 18 eventSender.mouseDown(); |
| 19 eventSender.mouseUp(); |
| 20 assert_false(video.paused); |
24 | 21 |
25 // Click the play button. | 22 runAfterHideMediaControlsTimerFired(t.step_func_done(function() { |
26 var playCoords = mediaControlsButtonCoordinates(video, "play-button"); | 23 var controls = mediaControlsButton(video, "panel"); |
27 var clickX = playCoords[0]; | 24 assert_equals(getComputedStyle(controls).opacity, "0"); |
28 var clickY = playCoords[1]; | 25 }), video); |
29 eventSender.mouseMoveTo(clickX, clickY); | |
30 eventSender.mouseDown(); | |
31 eventSender.mouseUp(); | |
32 testExpected("video.paused", false); | |
33 | 26 |
34 runAfterHideMediaControlsTimerFired(function() | 27 // Move the mouse to the upper-left corner of the video. |
35 { | 28 eventSender.mouseMoveTo(video.offsetLeft + 4, video.offsetTop + 4); |
36 controls = mediaControlsButton(video, "panel"); | 29 }); |
37 testExpected("getComputedStyle(controls).opacity", 0); | |
38 | 30 |
39 consoleWrite(""); | 31 video.src = findMediaFile("video", "content/test"); |
40 endTest(); | 32 }); |
41 }, video); | 33 </script> |
42 | |
43 // Move the mouse to the upper-left corner of the video. | |
44 eventSender.mouseMoveTo(video.offsetLeft + 4, video.offsetTop + 4); | |
45 } | |
46 </script> | |
47 <body> | |
48 <p>Test video element control visibility when mouse is not over element.</p> | |
49 <p>This test only runs in DRT!</p> | |
50 | |
51 <video id="no-video-media" controls loop oncanplaythrough="runTest()"></vide
o> | |
52 <script> | |
53 setSrcById("no-video-media", findMediaFile("video", "content/test")); | |
54 </script> | |
55 </body> | |
56 </html> | |
OLD | NEW |