OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <style> | 3 <style> |
4 #no-video-media { | 4 #no-video-media { |
5 width: 320px; | 5 width: 320px; |
6 height: 240px; | 6 height: 240px; |
7 } | 7 } |
8 </style> | 8 </style> |
9 <script src=video-test.js></script> | 9 <script src=video-test.js></script> |
10 <script src=media-file.js></script> | 10 <script src=media-file.js></script> |
11 <script src=media-controls.js></script> | 11 <script src=media-controls.js></script> |
12 <script> | 12 <script> |
| 13 |
13 var controls; | 14 var controls; |
14 | 15 |
| 16 function dispatchActivateEvent(target) { |
| 17 // Create a DOMActivate event and dispatch it |
| 18 var event = document.createEvent('UIEvents'); |
| 19 event.initUIEvent('DOMActivate', true, true, window, 1) |
| 20 target.dispatchEvent(event); |
| 21 } |
| 22 |
| 23 |
15 function runTest() | 24 function runTest() |
16 { | 25 { |
17 video = document.getElementById("no-video-media"); | 26 video = document.getElementById("no-video-media"); |
| 27 controls = mediaControlsButton(video, "panel"); |
18 | 28 |
19 testExpected("video.paused", true); | 29 testExpected("video.paused", true); |
20 if (!window.testRunner) | 30 if (!window.testRunner) |
21 return; | 31 return; |
22 | 32 |
23 // Click the play button. | 33 // Click the play button. |
24 var playCoords = mediaControlsButtonCoordinates(video, "play-button"); | 34 var playCoords = mediaControlsButtonCoordinates(video, "play-button"); |
25 var clickX = playCoords[0]; | 35 var clickX = playCoords[0]; |
26 var clickY = playCoords[1]; | 36 var clickY = playCoords[1]; |
27 eventSender.mouseMoveTo(clickX, clickY); | 37 eventSender.gestureTap(clickX, clickY); |
28 eventSender.mouseDown(); | 38 eventSender.gestureTapDown(clickX, clickY); |
29 eventSender.mouseUp(); | 39 dispatchActivateEvent(controls); |
| 40 |
30 testExpected("video.paused", false); | 41 testExpected("video.paused", false); |
31 | 42 |
32 runAfterHideMediaControlsTimerFired(function() | 43 runAfterHideMediaControlsTimerFired(function() |
33 { | 44 { |
34 controls = mediaControlsButton(video, "panel"); | |
35 testExpected("getComputedStyle(controls).opacity", 0); | 45 testExpected("getComputedStyle(controls).opacity", 0); |
36 | 46 |
37 consoleWrite(""); | 47 consoleWrite(""); |
38 endTest(); | 48 endTest(); |
39 }, video); | 49 }, video); |
40 | |
41 // Move the mouse to the upper-left corner of the video. | |
42 eventSender.mouseMoveTo(video.offsetLeft + 4, video.offsetTop + 4); | |
43 } | 50 } |
44 </script> | 51 </script> |
45 <body> | 52 <body> |
46 <p>Test video element control visibility when mouse is not over element.</p> | 53 <p>Test video control element visibility when play by touch.</p> |
47 <p>This test only runs in DRT!</p> | 54 <p>This test only runs in DRT!</p> |
48 | 55 |
49 <video id="no-video-media" controls loop oncanplaythrough="runTest()"></vide
o> | 56 <video id="no-video-media" controls loop oncanplaythrough="runTest()"></vide
o> |
50 <script> | 57 <script> |
51 setSrcById("no-video-media", findMediaFile("video", "content/test")); | 58 setSrcById("no-video-media", findMediaFile("video", "content/test")); |
52 </script> | 59 </script> |
53 </body> | 60 </body> |
54 </html> | 61 </html> |
OLD | NEW |