blob: e7432e2547e815e56c61dee33bc036f8775b76f0 [file] [log] [blame]
<!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, 7);
});
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 + 1 },
{ name: "pointerMove", x: x, y: y + 10 },
{ name: "pointerMove", x: x, y: y + 20 },
{ name: "pointerMove", x: x, y: y + 10 },
{ name: "pointerUp" },
{ name: "pointerDown", x: x, y: y },
{ name: "pointerMove", x: x, y: y + 1 },
{ name: "pointerMove", x: x, y: y + 10 },
{ name: "pointerMove", x: x, y: y + 20 }]}];
chrome.gpuBenchmarking.pointerActionSequence(pointerActions, callbackValidMoveCount);
}
}
var testTouchMove = async_test('Tests that TouchMoves are suppressed if within the slop suppression region.');
box.addEventListener('touchmove', validTouchMoveResult);
box.addEventListener('pointermove', validPointerMoveResult);
testTouchMoveSuppressionInSlopRegion();
</script>