| Index: chrome/test/data/devtools/touch_emulation.html
|
| diff --git a/chrome/test/data/devtools/touch_emulation.html b/chrome/test/data/devtools/touch_emulation.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8789b368fcd59b5170dfab81b6ce179684ca84c3
|
| --- /dev/null
|
| +++ b/chrome/test/data/devtools/touch_emulation.html
|
| @@ -0,0 +1,64 @@
|
| +<head>
|
| +<style>
|
| +div {
|
| + width: 400px;
|
| + height: 400px;
|
| +}
|
| +</style>
|
| +</head>
|
| +
|
| +<body>
|
| +<div></div>
|
| +<script>
|
| +var events = [];
|
| +var expectedEventsCount = null;
|
| +// Prevent default to disable gestures.
|
| +var preventDefault = true;
|
| +
|
| +function maybeSendEvents() {
|
| + if (expectedEventsCount === null)
|
| + return;
|
| + if (events.length < expectedEventsCount)
|
| + return;
|
| +
|
| + var result = events.join(" ");
|
| + events = [];
|
| + expectedEventsCount = null;
|
| + window.domAutomationController.send(result);
|
| +}
|
| +
|
| +function getEventNames(count) {
|
| + expectedEventsCount = count;
|
| + maybeSendEvents();
|
| +}
|
| +
|
| +function onEvent(name, event) {
|
| + events.push(name);
|
| + if (preventDefault)
|
| + event.preventDefault();
|
| + setTimeout(maybeSendEvents, 0);
|
| +}
|
| +
|
| +var names = [
|
| + "touchstart",
|
| + "touchmove",
|
| + "touchend",
|
| + "touchcancel",
|
| + "mouseover",
|
| + "mouseout",
|
| + "mouseleave",
|
| + "mouseenter",
|
| + "mousedown",
|
| + "mouseup",
|
| + "mousemove",
|
| + "click"
|
| +];
|
| +
|
| +for (var i = 0; i < names.length; ++i) {
|
| + document.querySelector("div").addEventListener(
|
| + names[i],
|
| + onEvent.bind(null, names[i]),
|
| + false);
|
| +}
|
| +</script>
|
| +</body>
|
|
|