| <!DOCTYPE html> |
| <title>This tests that a mouse/keyboard event on the controls will not be seen by the video element.</title> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="media-controls.js"></script> |
| <video controls></video> |
| <script> |
| async_test(function(t) { |
| var video = document.querySelector("video"); |
| |
| video.onclick = t.unreached_func(); |
| video.ondblclick = t.unreached_func(); |
| video.onpointerdown = t.unreached_func(); |
| video.onpointerup = t.unreached_func(); |
| video.onmousedown = t.unreached_func(); |
| video.onmouseup = t.unreached_func(); |
| |
| video.onloadeddata = t.step_func_done(function() { |
| // click the play button. |
| var coords = mediaControlsButtonCoordinates(video, "play-button"); |
| eventSender.mouseMoveTo(coords[0], coords[1]); |
| sendMouseAndKeyEvents(); |
| |
| // Click the current time display, which should not respond to events, |
| // but should still capture them. |
| coords = mediaControlsButtonCoordinates(video, "current-time-display"); |
| eventSender.mouseMoveTo(coords[0], coords[1]); |
| sendMouseAndKeyEvents(); |
| |
| // Click the timeline - this tests that multilevel shadow DOM elements work. |
| coords = mediaControlsButtonCoordinates(video, "timeline"); |
| eventSender.mouseMoveTo(coords[0], coords[1]); |
| sendMouseAndKeyEvents(); |
| |
| // If we're not dragging, then we should get a mousemove. |
| var mouseMoveEventCount = 0; |
| video.onmousemove = t.step_func(function() { |
| mouseMoveEventCount++; |
| }); |
| |
| eventSender.mouseMoveTo(coords[0] + 10, coords[1]); |
| // Expect another as we move back to the slider. |
| eventSender.mouseMoveTo(coords[0], coords[1]); |
| |
| // The above, positioned the slider under the mouse. |
| // Click to begin a drag. |
| eventSender.mouseDown(); |
| video.onmousemove = t.unreached_func(); |
| video.onpointermove = t.unreached_func(); |
| |
| // Check that the timeline also captures mousemove if the |
| // slider is being dragged. |
| eventSender.mouseMoveTo(coords[0] + 10, coords[1] + 10) |
| assert_equals(mouseMoveEventCount, 2); |
| }); |
| |
| function sendMouseAndKeyEvents() { |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| } |
| |
| video.src = "content/test.ogv"; |
| }); |
| </script> |