Index: third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-consumed-touchstart-in-slop-region.html |
diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-consumed-touchstart-in-slop-region.html b/third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-consumed-touchstart-in-slop-region.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e76d9075a7a3dc7377872148e45beb9613afcf86 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-consumed-touchstart-in-slop-region.html |
@@ -0,0 +1,69 @@ |
+<!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 touchstartHandler(event) { |
+ event.preventDefault(); |
+} |
+ |
+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, 3); |
+ }); |
+ testTouchMove.done(); |
+} |
+ |
+function testTouchMoveSuppressionInSlopRegion() { |
+ if (window.chrome && chrome.gpuBenchmarking) { |
+ var pointerActions = |
+ [{source: "touch", |
+ actions: [ |
+ { name: "pointerDown", x: x, y: y }, |
+ { 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.
|
+ { name: "pointerMove", x: x, y: y + 20 }, |
+ { name: "pointerMove", x: x, y: y + 30 }]}]; |
+ chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackValidMoveCount); |
+ } |
+} |
+ |
+var testTouchMove = async_test('Tests that the TouchMoves are not suppressed if the touch start is consumed.'); |
+box.addEventListener('touchstart', touchstartHandler); |
+box.addEventListener('touchmove', validTouchMoveResult); |
+box.addEventListener('pointermove', validPointerMoveResult); |
+testTouchMoveSuppressionInSlopRegion(); |
+ |
+</script> |