Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <title>Test that touch events on the controls will not be seen by the video elem ent.</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 coords; | |
| 11 var video = document.querySelector("video"); | |
| 4 | 12 |
| 5 </head> | 13 video.onclick = t.unreached_func(); |
| 6 <body> | 14 video.ondblclick = t.unreached_func(); |
| 7 <video controls></video> | 15 video.ontouchstart = t.unreached_func(); |
| 8 <p>This tests that touch events on the controls will not be seen by the vide o element.</p> | 16 video.ontouchend = t.unreached_func(); |
| 9 <script src=media-file.js></script> | 17 video.ontouchmove = t.unreached_func(); |
| 10 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
| 11 (Please avoid writing new tests using video-test.js) --> | |
| 12 <script src=video-test.js></script> | |
| 13 <script src=media-controls.js></script> | |
| 14 <script> | |
| 15 waitForEventAndFail("click"); | |
| 16 waitForEventAndFail("dblclick"); | |
| 17 waitForEventAndFail("touchstart"); | |
| 18 waitForEventAndFail("touchend"); | |
| 19 waitForEventAndFail("touchmove"); | |
| 20 | 18 |
| 21 waitForEventAndEnd("loadeddata", function() | 19 video.onloadeddata = t.step_func_done(function() { |
| 22 { | 20 // click the play button. |
| 23 if (window.eventSender) { | 21 touchMediaControl("play-button"); |
| 24 // click the play button | |
| 25 var coords = mediaControlsButtonCoordinates(video, "play-button" ); | |
| 26 eventSender.addTouchPoint(coords[0], coords[1]); | |
| 27 | 22 |
| 28 eventSender.touchStart(); | 23 // Click the current time display, which should not respond to events, |
| 29 eventSender.leapForward(100); | 24 // but should still capture them. |
| 30 eventSender.touchEnd(); | 25 touchMediaControl("current-time-display"); |
| 31 eventSender.cancelTouchPoint(0); | |
| 32 | 26 |
| 33 // Click the current time display, which should not respond to e vents, but | 27 // Click the timeline - this tests that multilevel shadow DOM elements w ork. |
| 34 // should still capture them | 28 touchMediaControl("timeline"); |
|
fs
2016/07/01 19:17:28
This part did not cancel the touch previously. The
Srirama
2016/07/02 03:48:36
Done. :)
| |
| 35 coords = mediaControlsButtonCoordinates(video, "current-time-dis play"); | |
| 36 eventSender.addTouchPoint(coords[0], coords[1]); | |
| 37 | 29 |
| 38 eventSender.touchStart(); | 30 // Check that the timeline also captures moves. |
| 39 eventSender.leapForward(100); | 31 eventSender.updateTouchPoint(0, coords[0] + 10, coords[1] + 10) |
| 40 eventSender.touchEnd(); | 32 eventSender.touchMove(); |
| 41 eventSender.cancelTouchPoint(0); | 33 eventSender.cancelTouchPoint(0); |
| 34 }); | |
| 42 | 35 |
| 36 function touchMediaControl(controlId) { | |
| 37 coords = mediaControlsButtonCoordinates(video, controlId); | |
| 38 eventSender.addTouchPoint(coords[0], coords[1]); | |
| 39 eventSender.touchStart(); | |
| 40 eventSender.leapForward(100); | |
| 41 eventSender.touchEnd(); | |
| 42 eventSender.cancelTouchPoint(0); | |
| 43 } | |
| 43 | 44 |
| 44 // Click the timeline - this tests that multilevel shadow DOM el ements work | 45 video.src = findMediaFile("video", "content/test"); |
| 45 coords = mediaControlsButtonCoordinates(video, "timeline"); | 46 }); |
| 46 eventSender.addTouchPoint(coords[0], coords[1]); | 47 </script> |
| 47 | |
| 48 eventSender.touchStart(); | |
| 49 eventSender.leapForward(100); | |
| 50 eventSender.touchEnd(); | |
| 51 | |
| 52 // Check that the timeline also captures moves | |
| 53 eventSender.updateTouchPoint(0, coords[0]+10, coords[1]+10) | |
| 54 eventSender.touchMove(); | |
| 55 eventSender.cancelTouchPoint(0); | |
| 56 | |
| 57 } | |
| 58 }); | |
| 59 video.src = findMediaFile("video", "content/test"); | |
| 60 </script> | |
| 61 </body> | |
| 62 </html> | |
| OLD | NEW |