Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src='../../../resources/testharness.js'></script> | |
| 3 <script src='../../../resources/testharnessreport.js'></script> | |
| 4 <style type="text/css"> | |
| 5 #box { | |
| 6 width: 600px; | |
| 7 height: 600px; | |
| 8 touch-action: none; | |
| 9 } | |
| 10 </style> | |
| 11 <div id="box" ></div> | |
| 12 | |
| 13 <script type="text/javascript"> | |
| 14 | |
| 15 var touchMoveCount = 0; | |
| 16 var pointerMoveCount = 0; | |
| 17 var box = document.getElementById("box"); | |
| 18 var targetRect = box.getBoundingClientRect(); | |
| 19 var offset = 50; | |
| 20 var x = targetRect.left + offset; | |
| 21 var y = targetRect.top + offset; | |
| 22 | |
| 23 function touchstartHandler(event) { | |
| 24 event.preventDefault(); | |
| 25 } | |
| 26 | |
| 27 function validTouchMoveResult(event) { | |
| 28 touchMoveCount++; | |
| 29 testTouchMove.step(function () { | |
| 30 assert_equals(event.target.id, "box"); | |
| 31 }); | |
| 32 } | |
| 33 | |
| 34 function validPointerMoveResult(event) { | |
| 35 pointerMoveCount++; | |
| 36 testTouchMove.step(function () { | |
| 37 assert_equals(event.target.id, "box"); | |
| 38 assert_equals(event.pointerType, "touch"); | |
| 39 }); | |
| 40 } | |
| 41 | |
| 42 function callbackValidMoveCount() { | |
| 43 testTouchMove.step(function () { | |
| 44 assert_equals(touchMoveCount, 3); | |
| 45 assert_equals(pointerMoveCount, 3); | |
| 46 }); | |
| 47 testTouchMove.done(); | |
| 48 } | |
| 49 | |
| 50 function testTouchMoveSuppressionInSlopRegion() { | |
| 51 if (window.chrome && chrome.gpuBenchmarking) { | |
| 52 var pointerActions = | |
| 53 [{source: "touch", | |
| 54 actions: [ | |
| 55 { name: "pointerDown", x: x, y: y }, | |
| 56 { name: "pointerMove", x: x, y: y + 10 }, | |
|
mustaq
2017/02/16 17:06:26
Please add a single pixel drag to make sure that e
lanwei
2017/02/16 19:48:58
Done.
| |
| 57 { name: "pointerMove", x: x, y: y + 20 }, | |
| 58 { name: "pointerMove", x: x, y: y + 30 }]}]; | |
| 59 chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackVal idMoveCount); | |
| 60 } | |
| 61 } | |
| 62 | |
| 63 var testTouchMove = async_test('Tests that the TouchMoves are not suppressed if the touch start is consumed.'); | |
| 64 box.addEventListener('touchstart', touchstartHandler); | |
| 65 box.addEventListener('touchmove', validTouchMoveResult); | |
| 66 box.addEventListener('pointermove', validPointerMoveResult); | |
| 67 testTouchMoveSuppressionInSlopRegion(); | |
| 68 | |
| 69 </script> | |
| OLD | NEW |