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

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

Issue 2141993003: PointerEvents for long-press: fix double firing & canceling MEs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed formats. Created 4 years, 5 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-long-press.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-long-press.html b/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-long-press.html
new file mode 100644
index 0000000000000000000000000000000000000000..0d641f2a9c6e2f3a42a1dba0325ca0338981e3fc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/pointerevents/touch-pointer-long-press.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+
+<style>
+div.box {
+ margin: 10px;
+ padding: 50px;
+ float: left;
+}
+</style>
+
+<h1>PointerEvent: Verifies that long press doesn't fire redundant pointer events</h1>
+
+<div id="target" class="box" style="background-color:red"></div>
+
+<div id="log"></div>
+
+<script>
+var receivedEvents = [];
+
+function testReceivedEvents(expectedEvents, testLabel) {
+ test(function() {
+ assert_array_equals(receivedEvents, expectedEvents);
+ }, testLabel);
+ receivedEvents = [];
+}
+
+function init() {
+ var targetDiv = document.getElementById("target");
+ targetEvents = ["mousedown", "mouseup", "mousemove", "contextmenu",
+ "mouseenter", "mouseleave", "mouseover", "mouseout",
+ "pointerdown", "pointerup", "pointermove", "pointercancel",
+ "pointerenter", "pointerleave", "pointerover", "pointerout"];
+
+ targetEvents.forEach(function(eventName) {
+ targetDiv.addEventListener(eventName, function(event) {
+ receivedEvents.push(event.type);
+ });
+ });
+}
+
+function runTests() {
+ var rect = document.getElementById("target").getBoundingClientRect();
+ eventSender.gestureLongPress(rect.left + 5, rect.top + 5);
+ testReceivedEvents([
+ "mouseover", "mouseenter", "mousemove", "mousedown", "contextmenu"
+ ], "Long press events");
+
+}
+
+test(function() {
+ if (!window.eventSender)
+ assert_true(true, "No eventSender, skipped tests");
+ else if (!window.PointerEvent)
+ assert_true(true, "No PointerEvent, skipped tests");
+ else {
+ init();
+ runTests();
+ }
+}, "PointerEvent: Verifies that long press doesn't fire redundant pointer events");
+</script>

Powered by Google App Engine
This is Rietveld 408576698