| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <title>This tests that a mouse/keyboard event on the controls will not be seen b
y the video element.</title> |
| 3 <head> | 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> |
| 6 <script src="media-controls.js"></script> |
| 7 <video controls></video> |
| 8 <script> |
| 9 async_test(function(t) { |
| 10 var video = document.querySelector("video"); |
| 4 | 11 |
| 5 </head> | 12 video.onclick = t.unreached_func(); |
| 6 <body> | 13 video.ondblclick = t.unreached_func(); |
| 7 <video controls></video> | 14 video.onmousedown = t.unreached_func(); |
| 8 <p>This tests that a mouse events on the controls will not be seen by the vi
deo element.</p> | 15 video.onmouseup = t.unreached_func(); |
| 9 <p>Also tests keyboard input.</p> | 16 video.onkeydown = t.unreached_func(); |
| 10 <script src=media-file.js></script> | |
| 11 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
| 12 (Please avoid writing new tests using video-test.js) --> | |
| 13 <script src=video-test.js></script> | |
| 14 <script src=media-controls.js></script> | |
| 15 <script> | |
| 16 waitForEventAndFail("click"); | |
| 17 waitForEventAndFail("dblclick"); | |
| 18 waitForEventAndFail("mousedown"); | |
| 19 waitForEventAndFail("mouseup"); | |
| 20 waitForEventAndFail("keydown"); | |
| 21 | 17 |
| 22 waitForEventAndEnd("loadeddata", function() | 18 video.onloadeddata = t.step_func_done(function() { |
| 23 { | 19 // click the play button. |
| 24 if (window.eventSender) { | 20 var coords = mediaControlsButtonCoordinates(video, "play-button"); |
| 25 // click the play button | 21 eventSender.mouseMoveTo(coords[0], coords[1]); |
| 26 var coords = mediaControlsButtonCoordinates(video, "play-button"
); | 22 sendMouseAndKeyEvents(); |
| 27 eventSender.mouseMoveTo(coords[0], coords[1]); | |
| 28 | 23 |
| 29 eventSender.mouseDown(); | 24 // Click the current time display, which should not respond to events, |
| 30 eventSender.mouseUp(); | 25 // but should still capture them. |
| 31 eventSender.keyDown('A'); | 26 coords = mediaControlsButtonCoordinates(video, "current-time-display"); |
| 27 eventSender.mouseMoveTo(coords[0], coords[1]); |
| 28 sendMouseAndKeyEvents(); |
| 32 | 29 |
| 33 // Click the current time display, which should not respond to e
vents, but | 30 // Click the timeline - this tests that multilevel shadow DOM elements w
ork. |
| 34 // should still capture them | 31 coords = mediaControlsButtonCoordinates(video, "timeline"); |
| 35 coords = mediaControlsButtonCoordinates(video, "current-time-dis
play"); | 32 eventSender.mouseMoveTo(coords[0], coords[1]); |
| 36 eventSender.mouseMoveTo(coords[0], coords[1]); | 33 sendMouseAndKeyEvents(); |
| 37 | 34 |
| 38 eventSender.mouseDown(); | 35 // If we're not dragging, then we should get a mousemove. |
| 39 eventSender.mouseUp(); | 36 var mouseMoveEventCount = 0; |
| 40 eventSender.keyDown('A'); | 37 video.onmousemove = t.step_func(function() { |
| 38 mouseMoveEventCount++; |
| 39 }); |
| 41 | 40 |
| 42 // Click the timeline - this tests that multilevel shadow DOM el
ements work | 41 eventSender.mouseMoveTo(coords[0] + 10, coords[1] + 10); |
| 43 coords = mediaControlsButtonCoordinates(video, "timeline"); | 42 // Expect another as we move back to the slider. |
| 44 eventSender.mouseMoveTo(coords[0], coords[1]); | 43 eventSender.mouseMoveTo(coords[0], coords[1]); |
| 45 | 44 |
| 46 eventSender.mouseDown(); | 45 // The above, positioned the slider under the mouse. |
| 47 eventSender.mouseUp(); | 46 // Click to begin a drag. |
| 48 eventSender.keyDown('A'); | 47 eventSender.mouseDown(); |
| 48 video.onmousemove = t.unreached_func(); |
| 49 | 49 |
| 50 // If we're not dragging, then we should get a mousemove. | 50 // Check that the timeline also captures mousemove if the |
| 51 waitForEventOnce("mousemove"); | 51 // slider is being dragged. |
| 52 eventSender.mouseMoveTo(coords[0]+10, coords[1]+10); | 52 eventSender.mouseMoveTo(coords[0] + 10, coords[1] + 10) |
| 53 // Expect another as we move back to the slider. | 53 assert_equals(mouseMoveEventCount, 2); |
| 54 waitForEventOnce("mousemove"); | 54 }); |
| 55 eventSender.mouseMoveTo(coords[0], coords[1]); | |
| 56 | 55 |
| 57 // The above positioned the slider under the mouse. Click | 56 function sendMouseAndKeyEvents() { |
| 58 // to begin a drag. | 57 eventSender.mouseDown(); |
| 59 eventSender.mouseDown(); | 58 eventSender.mouseUp(); |
| 59 eventSender.keyDown('A'); |
| 60 } |
| 60 | 61 |
| 61 waitForEventAndFail("mousemove") | 62 video.src = findMediaFile("video", "content/test"); |
| 62 | 63 }); |
| 63 // Check that the timeline also captures mousemove if the | 64 </script> |
| 64 // slider is being dragged. | |
| 65 eventSender.mouseMoveTo(coords[0]+10, coords[1]+10) | |
| 66 } | |
| 67 }); | |
| 68 video.src = findMediaFile("video", "content/test"); | |
| 69 </script> | |
| 70 </body> | |
| 71 </html> | |
| OLD | NEW |