Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-in-slop-region.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-in-slop-region.html b/third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-in-slop-region.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7910c19202ec8cf11141eefdd2ce8e78c42dcaf4 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-in-slop-region.html |
| @@ -0,0 +1,75 @@ |
| +<!DOCTYPE html> |
| +<script src='../../../resources/testharness.js'></script> |
| +<script src='../../../resources/testharnessreport.js'></script> |
| +<style type="text/css"> |
| +#box { |
| + width: 600px; |
| + height: 600px; |
| + touch-action: none; |
| +} |
| +</style> |
| +<div id="box" ></div> |
| + |
| +<script type="text/javascript"> |
| + |
| +var touchMoveCount = 0; |
| +var pointerMoveCount = 0; |
| +var box = document.getElementById('box'); |
| +var targetRect = box.getBoundingClientRect(); |
| +var offset = 50; |
| +var x = targetRect.left + offset; |
| +var y = targetRect.top + offset; |
| + |
| +function validTouchMoveResult(event) { |
| + touchMoveCount++; |
| + testTouchMove.step(function () { |
| + assert_equals(event.target.id, "box"); |
| + }); |
| +} |
| + |
| +function validPointerMoveResult(event) { |
| + pointerMoveCount++; |
| + testTouchMove.step(function () { |
| + assert_equals(event.target.id, "box"); |
| + assert_equals(event.pointerType, "touch"); |
| + }); |
| +} |
| + |
| +function callbackValidMoveCount() { |
| + testTouchMove.step(function () { |
| + assert_equals(touchMoveCount, 3); |
| + assert_equals(pointerMoveCount, 5); |
| + }); |
| + testTouchMove.done(); |
| +} |
| + |
| +function testTouchMoveSuppressionInSlopRegion() { |
| + if (window.chrome && chrome.gpuBenchmarking) { |
| + var pointerActions = [{'source': 'touch'}]; |
|
tdresser
2017/02/06 21:49:59
This might as well be a single object literal, ins
Rick Byers
2017/02/07 18:51:43
+1
Also you can make it slightly easier to read b
lanwei
2017/02/21 18:10:28
Done.
|
| + var pointerAction = pointerActions[0]; |
| + pointerAction.actions = []; |
| + pointerAction.actions.push( |
| + {'name': 'pointerDown', 'x': x, 'y': y }); |
| + pointerAction.actions.push( |
| + {'name': 'pointerMove', 'x': x, 'y': y + 10 }); |
| + pointerAction.actions.push( |
| + {'name': 'pointerMove', 'x': x, 'y': y + 20 }); |
| + pointerAction.actions.push( |
| + {'name': 'pointerMove', 'x': x, 'y': y + 10 }); |
| + pointerAction.actions.push({'name': 'pointerUp' }); |
| + pointerAction.actions.push( |
| + {'name': 'pointerDown', 'x': x, 'y': y }); |
| + pointerAction.actions.push( |
| + {'name': 'pointerMove', 'x': x, 'y': y + 10 }); |
| + pointerAction.actions.push( |
| + {'name': 'pointerMove', 'x': x, 'y': y + 20 }); |
| + chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackValidMoveCount); |
| + } |
| +} |
| + |
| +var testTouchMove = async_test('Move in the slop region.'); |
| +box.addEventListener('touchmove', validTouchMoveResult); |
| +box.addEventListener('pointermove', validPointerMoveResult); |
| +testTouchMoveSuppressionInSlopRegion(); |
| + |
| +</script> |