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

Unified Diff: LayoutTests/fast/events/touch/gesture/gesture-tap-div-removed.html

Issue 353893002: Remove mouse-related hit tests during a GestureTap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Improve focus test Created 6 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: LayoutTests/fast/events/touch/gesture/gesture-tap-div-removed.html
diff --git a/LayoutTests/fast/events/touch/gesture/gesture-tap-div-removed.html b/LayoutTests/fast/events/touch/gesture/gesture-tap-div-removed.html
new file mode 100644
index 0000000000000000000000000000000000000000..2a1d646cd5dde3511d43a139b84a428342b3735f
--- /dev/null
+++ b/LayoutTests/fast/events/touch/gesture/gesture-tap-div-removed.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML>
+<script src="../../../../resources/js-test.js"></script>
+<style>
+#target {
+ position: absolute;
+ right: 10px;
+ top: 10px;
+ border: 1px solid blue;
+}
+</style>
+<div id=target>
+ Tap me
+</div>
+<script>
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+function eventLogger(e) {
+ debug("Received " + e.type + " on " + (e.currentTarget.id || e.currentTarget.nodeName));
+}
+
+function logAndRemove(e) {
+ eventLogger(e);
+ e.currentTarget.parentNode.removeChild(e.currentTarget);
+ debug("Removed element");
+ e = null;
+ gc();
+}
+
+function logAndFail(e) {
+ eventLogger(e);
+ testFailed("Received unexpected event.");
+}
+
+function getTargetPoint() {
+ // Note that we don't want any reference to the node to escape this function
+ // so that it's elligble for garbage collection.
+ var target = document.getElementById('target');
+ target.addEventListener('mousemove', logAndRemove);
+ target.addEventListener('mousedown', eventLogger);
+ target.addEventListener('mouseup', eventLogger);
+ target.addEventListener('click', eventLogger);
+ document.addEventListener('mousemove', eventLogger);
+ document.addEventListener('mousedown', logAndFail);
+ document.addEventListener('mouseup', logAndFail);
+ document.addEventListener('click', logAndFail);
+
+ var rect = target.getBoundingClientRect();
+ return {
+ x: rect.left + rect.width / 2,
+ y: rect.top + rect.height / 2
+ };
+}
+
+onload = function() {
+ description("Verifies that deleting the element being tapped during the event sequence doesn't cause any problems. Succeeds if the expected events are delivered to the div, events after removal don't bubble up, and we don't crash.");
+
+ var point = getTargetPoint();
+
+ if (!window.eventSender) {
+ debug("This test requires eventSender");
+ return;
+ }
+
+ debug("Sending GestureTapDown");
+ eventSender.gestureTapDown(point.x, point.y);
+
+ debug("Sending GestureShowPress");
+ eventSender.gestureShowPress(point.x, point.y);
+
+ debug("Sending GestureTap");
+ eventSender.gestureTap(point.x, point.y);
+}
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698