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 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 10 (Please avoid writing new tests using video-test.js) --> |
9 <script src=video-test.js></script> | 11 <script src=video-test.js></script> |
10 <script src=media-file.js></script> | 12 <script src=media-file.js></script> |
11 <script src=media-controls.js></script> | 13 <script src=media-controls.js></script> |
12 <script> | 14 <script> |
13 | 15 |
14 var controls; | 16 var controls; |
15 | 17 |
16 function dispatchActivateEvent(target) { | 18 function dispatchActivateEvent(target) { |
17 // Create a DOMActivate event and dispatch it | 19 // Create a DOMActivate event and dispatch it |
18 var event = document.createEvent('UIEvents'); | 20 var event = document.createEvent('UIEvents'); |
19 event.initUIEvent('DOMActivate', true, true, window, 1) | 21 event.initUIEvent('DOMActivate', true, true, window, 1) |
20 target.dispatchEvent(event); | 22 target.dispatchEvent(event); |
21 } | 23 } |
22 | 24 |
23 | 25 |
24 function runTest() | 26 function runTest() |
25 { | 27 { |
26 video = document.getElementById("no-video-media"); | 28 video = document.getElementById("no-video-media"); |
27 controls = mediaControlsButton(video, "panel"); | 29 controls = mediaControlsButton(video, "panel"); |
28 | 30 |
29 testExpected("video.paused", true); | 31 testExpected("video.paused", true); |
30 if (!window.testRunner) | 32 if (!window.testRunner) |
31 return; | 33 return; |
32 | 34 |
33 // Click the play button. | 35 // Click the play button. |
34 var playCoords = mediaControlsButtonCoordinates(video, "play-button"); | 36 var playCoords = mediaControlsButtonCoordinates(video, "play-button"); |
35 var clickX = playCoords[0]; | 37 var clickX = playCoords[0]; |
36 var clickY = playCoords[1]; | 38 var clickY = playCoords[1]; |
37 eventSender.gestureTap(clickX, clickY); | 39 eventSender.gestureTap(clickX, clickY); |
38 eventSender.gestureTapDown(clickX, clickY); | 40 eventSender.gestureTapDown(clickX, clickY); |
39 dispatchActivateEvent(controls); | 41 dispatchActivateEvent(controls); |
40 | 42 |
41 testExpected("video.paused", false); | 43 testExpected("video.paused", false); |
42 | 44 |
43 runAfterHideMediaControlsTimerFired(function() | 45 runAfterHideMediaControlsTimerFired(function() |
44 { | 46 { |
45 testExpected("getComputedStyle(controls).opacity", 0); | 47 testExpected("getComputedStyle(controls).opacity", 0); |
46 | 48 |
47 consoleWrite(""); | 49 consoleWrite(""); |
48 endTest(); | 50 endTest(); |
49 }, video); | 51 }, video); |
50 } | 52 } |
51 </script> | 53 </script> |
52 <body> | 54 <body> |
53 <p>Test video control element visibility when play by touch.</p> | 55 <p>Test video control element visibility when play by touch.</p> |
54 <p>This test only runs in DRT!</p> | 56 <p>This test only runs in DRT!</p> |
55 | 57 |
56 <video id="no-video-media" controls loop oncanplaythrough="runTest()"></vide
o> | 58 <video id="no-video-media" controls loop oncanplaythrough="runTest()"></vide
o> |
57 <script> | 59 <script> |
58 setSrcById("no-video-media", findMediaFile("video", "content/test")); | 60 setSrcById("no-video-media", findMediaFile("video", "content/test")); |
59 </script> | 61 </script> |
60 </body> | 62 </body> |
61 </html> | 63 </html> |
OLD | NEW |