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