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 var controls; | 15 var controls; |
14 | 16 |
15 function runTest() | 17 function runTest() |
16 { | 18 { |
17 video = document.getElementById("no-video-media"); | 19 video = document.getElementById("no-video-media"); |
18 | 20 |
19 testExpected("video.paused", true); | 21 testExpected("video.paused", true); |
20 if (!window.testRunner) | 22 if (!window.testRunner) |
21 return; | 23 return; |
22 | 24 |
23 if (!window.internals || !window.internals.setIsCursorVisible) { | 25 if (!window.internals || !window.internals.setIsCursorVisible) { |
24 debug("window.internals.setIsCursorVisible is required to run this test.
"); | 26 debug("window.internals.setIsCursorVisible is required to run this test.
"); |
25 return; | 27 return; |
26 } | 28 } |
27 | 29 |
28 // Hover the control with the mouse. | 30 // Hover the control with the mouse. |
29 var coords = mediaControlsButtonCoordinates(video, "play-button"); | 31 var coords = mediaControlsButtonCoordinates(video, "play-button"); |
30 eventSender.mouseMoveTo(coords[0], coords[1]); | 32 eventSender.mouseMoveTo(coords[0], coords[1]); |
31 | 33 |
32 // And then tap (touch input) the play button. | 34 // And then tap (touch input) the play button. |
33 eventSender.gestureTapDown(coords[0], coords[1]); | 35 eventSender.gestureTapDown(coords[0], coords[1]); |
34 eventSender.gestureShowPress(coords[0], coords[1]); | 36 eventSender.gestureShowPress(coords[0], coords[1]); |
35 eventSender.gestureTap(coords[0], coords[1]); | 37 eventSender.gestureTap(coords[0], coords[1]); |
36 testExpected("video.paused", false); | 38 testExpected("video.paused", false); |
37 | 39 |
38 // In the real world Chromium hides the cursor after a tap, | 40 // In the real world Chromium hides the cursor after a tap, |
39 // so hide it manually here. This is required to hit the | 41 // so hide it manually here. This is required to hit the |
40 // early out from EventHandler::fakeMouseMoveEventTimerFired when | 42 // early out from EventHandler::fakeMouseMoveEventTimerFired when |
41 // isCursorVisible is false. | 43 // isCursorVisible is false. |
42 internals.setIsCursorVisible(document, false); | 44 internals.setIsCursorVisible(document, false); |
43 | 45 |
44 // And the controls should hide after a timeout. | 46 // And the controls should hide after a timeout. |
45 runAfterHideMediaControlsTimerFired(function() | 47 runAfterHideMediaControlsTimerFired(function() |
46 { | 48 { |
47 controls = mediaControlsButton(video, "panel"); | 49 controls = mediaControlsButton(video, "panel"); |
48 testExpected("getComputedStyle(controls).opacity", 0); | 50 testExpected("getComputedStyle(controls).opacity", 0); |
49 endTest(); | 51 endTest(); |
50 }, video); | 52 }, video); |
51 | 53 |
52 } | 54 } |
53 </script> | 55 </script> |
54 <body> | 56 <body> |
55 <p>Test video element control visibility with multimodal input. The controls | 57 <p>Test video element control visibility with multimodal input. The controls |
56 should hide after a timeout if the last input event was a tap.</p> | 58 should hide after a timeout if the last input event was a tap.</p> |
57 <p>This test only runs in DRT!</p> | 59 <p>This test only runs in DRT!</p> |
58 | 60 |
59 <video id="no-video-media" controls loop oncanplaythrough="runTest()"></vide
o> | 61 <video id="no-video-media" controls loop oncanplaythrough="runTest()"></vide
o> |
60 <script> | 62 <script> |
61 setSrcById("no-video-media", findMediaFile("video", "content/test")); | 63 setSrcById("no-video-media", findMediaFile("video", "content/test")); |
62 </script> | 64 </script> |
63 </body> | 65 </body> |
64 </html> | 66 </html> |
OLD | NEW |