Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-controls-touch-events-captured.html

Issue 2116013002: Convert video-controls* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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", true);
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", true);
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");
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, cancelTouchPoint) {
37 coords = mediaControlsButtonCoordinates(video, controlId);
38 eventSender.addTouchPoint(coords[0], coords[1]);
39 eventSender.touchStart();
40 eventSender.leapForward(100);
41 eventSender.touchEnd();
42 if (cancelTouchPoint)
43 eventSender.cancelTouchPoint(0);
44 }
43 45
44 // Click the timeline - this tests that multilevel shadow DOM el ements work 46 video.src = findMediaFile("video", "content/test");
45 coords = mediaControlsButtonCoordinates(video, "timeline"); 47 });
46 eventSender.addTouchPoint(coords[0], coords[1]); 48 </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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698