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

Side by Side Diff: chrome/test/data/devtools/touch_emulation.html

Issue 249613002: [DevTools] Interactive test for DevTools touch emulation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Close devtools Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <head>
2 <style>
3 div {
4 width: 400px;
5 height: 400px;
6 }
7 </style>
8 </head>
9
10 <body>
11 <div></div>
12 <script>
13 var events = [];
14 var expectedEventsCount = null;
15 // Prevent default to disable gestures.
16 var preventDefault = true;
17
18 function maybeSendEvents() {
19 if (expectedEventsCount === null)
20 return;
21 if (events.length < expectedEventsCount)
22 return;
23
24 var result = events.join(" ");
25 events = [];
26 expectedEventsCount = null;
27 window.domAutomationController.send(result);
28 }
29
30 function getEventNames(count) {
31 expectedEventsCount = count;
32 maybeSendEvents();
33 }
34
35 function onEvent(name, event) {
36 events.push(name);
37 if (preventDefault)
38 event.preventDefault();
39 setTimeout(maybeSendEvents, 0);
40 }
41
42 var names = [
43 "touchstart",
44 "touchmove",
45 "touchend",
46 "touchcancel",
47 "mouseover",
48 "mouseout",
49 "mouseleave",
50 "mouseenter",
51 "mousedown",
52 "mouseup",
53 "mousemove",
54 "click"
55 ];
56
57 for (var i = 0; i < names.length; ++i) {
58 document.querySelector("div").addEventListener(
59 names[i],
60 onEvent.bind(null, names[i]),
61 false);
62 }
63 </script>
64 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698