| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | |
| 4 <script> | |
| 5 | |
| 6 window.addEventListener("touchstart", logEvent); | |
| 7 window.addEventListener("touchend", logEvent); | |
| 8 window.addEventListener("touchmove", logEvent); | |
| 9 | |
| 10 function logEvent(event) | |
| 11 { | |
| 12 log("-----Event-----"); | |
| 13 log("type: " + event.type); | |
| 14 if (event.shiftKey) | |
| 15 log("shiftKey"); | |
| 16 log("----Touches----"); | |
| 17 for (var i = 0; i < event.touches.length; i++) { | |
| 18 var touch = event.touches[i]; | |
| 19 log("id: " + i); | |
| 20 log("pageX: " + touch.pageX); | |
| 21 log("pageY: " + touch.pageY); | |
| 22 log("radiusX: " + touch.radiusX); | |
| 23 log("radiusY: " + touch.radiusY); | |
| 24 log("rotationAngle: " + touch.rotationAngle); | |
| 25 log("force: " + touch.force); | |
| 26 } | |
| 27 } | |
| 28 | |
| 29 function test() | |
| 30 { | |
| 31 var events = [ | |
| 32 { | |
| 33 "type": "touchStart", | |
| 34 "touchPoints": [ | |
| 35 { | |
| 36 "state": "touchPressed", | |
| 37 "x": 100, | |
| 38 "y": 200 | |
| 39 } | |
| 40 ] | |
| 41 }, | |
| 42 { | |
| 43 "type": "touchMove", | |
| 44 "touchPoints": [ | |
| 45 { | |
| 46 "state": "touchMoved", | |
| 47 "x": 100, | |
| 48 "y": 200 | |
| 49 } | |
| 50 ] | |
| 51 }, | |
| 52 { | |
| 53 "type": "touchEnd", | |
| 54 "touchPoints": [ | |
| 55 { | |
| 56 "state": "touchReleased", | |
| 57 "x": 100, | |
| 58 "y": 200 | |
| 59 } | |
| 60 ] | |
| 61 }, | |
| 62 { | |
| 63 "type": "touchStart", | |
| 64 "touchPoints": [ | |
| 65 { | |
| 66 "state": "touchPressed", | |
| 67 "x": 20, | |
| 68 "y": 30, | |
| 69 "id": 0 | |
| 70 }, | |
| 71 { | |
| 72 "state": "touchPressed", | |
| 73 "x": 100, | |
| 74 "y": 200, | |
| 75 "radiusX": 5, | |
| 76 "radiusY": 6, | |
| 77 "rotationAngle": 1.0, | |
| 78 "force": 0.0, | |
| 79 "id": 1 | |
| 80 } | |
| 81 ], | |
| 82 "modifiers": 8 // shift | |
| 83 }, | |
| 84 { | |
| 85 "type": "touchEnd", | |
| 86 "touchPoints": [ | |
| 87 { | |
| 88 "state": "touchReleased", | |
| 89 "x": 100, | |
| 90 "y": 100, | |
| 91 "id": 0 | |
| 92 }, | |
| 93 { | |
| 94 "state": "touchReleased", | |
| 95 "x": 100, | |
| 96 "y": 200, | |
| 97 "id": 1 | |
| 98 } | |
| 99 ] | |
| 100 } | |
| 101 ]; | |
| 102 | |
| 103 for (var i = 0; i < events.length; i++) | |
| 104 InspectorTest.sendCommand("Input.dispatchTouchEvent", events[i], checkRe
sponse.bind(undefined, i == events.length - 1)); | |
| 105 | |
| 106 function checkResponse(isLastCommand, msg) | |
| 107 { | |
| 108 if (msg.error) | |
| 109 InspectorTest.log("Error: " + msg.error.message); | |
| 110 if (isLastCommand) | |
| 111 InspectorTest.completeTest(); | |
| 112 } | |
| 113 } | |
| 114 | |
| 115 </script> | |
| 116 </head> | |
| 117 <body onload="runTest()"> | |
| 118 </body> | |
| 119 </html> | |
| OLD | NEW |