Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse.html

Issue 1989623002: Suppressed MEs for gestures from cancelled PEs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse.html b/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse.html
new file mode 100644
index 0000000000000000000000000000000000000000..09d4991d0bc340954eecb7400e11f3abaedece00
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-mouse.html
@@ -0,0 +1,114 @@
+<!DOCTYPE HTML>
+<script src="../../../resources/js-test.js"></script>
+<style>
+div.box {
+ height: 100px;
+ width: 100px;
+ background-color: red;
+}
+</style>
+
+<div class="box" id="target"></div>
+
+<div id="console"></div>
+
+<script>
+description("Verifies that canceling pointerdowns for touches correctly suppresses mouseevents.");
+
+var preventDefaultPrimary = false;
+
+function init() {
+ var events = [
+ "mouseup",
+ "mousedown",
+ "mousemove",
+ "pointerup",
+ "pointerdown",
+ "pointermove",
+ "click",
+ "touchstart",
+ "touchend",
+ "touchmove",
+ ];
+
+ events.forEach(function(event) {
+ document.getElementById("target").addEventListener(event, function(e) {
+ var isPrimary = e.isPrimary;
+ var desc = [];
+ if (e.type.startsWith("pointer") && isPrimary)
+ desc.push("primary");
+ if (e.type == "pointerdown" && preventDefaultPrimary == isPrimary) {
+ e.preventDefault();
+ desc.push("canceled");
+ }
+ debug("Received " + e.type + " " + desc);
+ });
+ });
+}
+
+function testTapWithPairedGE() {
+ var rect = document.getElementById("target").getBoundingClientRect();
+ var x = rect.left + 50;
+ var y = rect.top + 50;
+
+ var uniqueId = 1234;
+ var tapWidth = 30;
+ var tapHeight = 30;
+
+ eventSender.addTouchPoint(x, y);
+ eventSender.touchStart(uniqueId);
+ eventSender.gestureTapDown(x, y, tapWidth, tapHeight, uniqueId);
+
+ eventSender.releaseTouchPoint(0);
+ eventSender.touchEnd();
+ eventSender.gestureTap(x, y);
+}
+
+function testTapWithoutPairedGE() {
+ var rect = document.getElementById("target").getBoundingClientRect();
+ var x = rect.left + 50;
+ var y = rect.top + 50;
+
+ var uniqueId = 1234;
+ var tapWidth = 30;
+ var tapHeight = 30;
+
+ eventSender.addTouchPoint(x, y);
+ eventSender.touchStart(uniqueId);
+ eventSender.releaseTouchPoint(0);
+ eventSender.touchEnd();
+
+ eventSender.addTouchPoint(x, y);
+ eventSender.touchStart(uniqueId+1);
+ eventSender.releaseTouchPoint(0);
+ eventSender.touchEnd();
+
+ eventSender.gestureTapDown(x, y, tapWidth, tapHeight, uniqueId+1);
+ eventSender.gestureTap(x, y);
+
+ eventSender.gestureTapDown(x, y, tapWidth, tapHeight, uniqueId+2);
+ eventSender.gestureTap(x, y);
+}
+
+function runTests() {
+ [false, true, false].forEach(function(boolVal) {
+ debug("=== With primary pointerdown " + (boolVal ? "canceled" : "uncanceled") +" ===");
+ preventDefaultPrimary = boolVal;
+
+ debug("-- Tap with paired GEs --");
+ testTapWithPairedGE();
+
+ debug("-- Tap without paired GEs --");
+ testTapWithoutPairedGE();
+
+ debug("");
+ });
+}
+
+init();
+if (window.eventSender)
+ runTests();
+else
+ debug("This test requires eventSender");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698