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

Unified Diff: third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture.html

Issue 1838973003: Send lostpointercapture on touch capturing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture.html
diff --git a/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture.html b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture.html
new file mode 100644
index 0000000000000000000000000000000000000000..1cef6e09d8fab2205c0727719d94f7d400a708b3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture.html
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML>
+<script src="../../../../../resources/js-test.js"></script>
+<style>
+div.box {
+ margin: 5px;
+ padding: 20px;
+ float: left;
+}
+#grey {
+ width: 50px;
+ height: 50px;
+}
+</style>
+
+<div id="grey" class="box" style="background-color:grey">
+ <div id="green" class="box" style="background-color:green;">
+ </div>
+</div>
+<div id="blue" class="box" style="background-color:blue;">
+</div>
+
+<div id="console"></div>
+
+<script>
+description("Verifies that pointer capture works for touch.");
+
+var rect = document.getElementById("green").getBoundingClientRect();
+var x1 = rect.left + 5;
+var y1 = rect.top + 5;
+
+var rect = document.getElementById("blue").getBoundingClientRect();
+var x2 = rect.left + 5;
+var y2 = rect.top + 5;
+
+function init() {
+ var eventList = ["touchstart", "touchmove", "touchend", "touchcancel",
+ "pointerenter", "pointerleave", "pointerover", "pointerout", "pointermove", "pointerdown", "pointerup", "pointercancel",
+ "gotpointercapture", "lostpointercapture"];
+
+ document.addEventListener("lostpointercapture", function(event) {
+ if (event.eventPhase == Event.AT_TARGET) {
+ debug("document received " + event.type + " " + event.pointerId);
+ }
+ });
+ ["grey", "green", "blue"].forEach(function(id) {
+ var targetDiv = document.getElementById(id);
+ eventList.forEach(function(eventName) {
+ targetDiv.addEventListener(eventName, function(event) {
+ if (event.eventPhase == Event.AT_TARGET) {
+ if (event.type.includes("pointer"))
+ debug(id + " received " + event.type + " " + event.pointerId);
+ else
+ debug(id + " received " + event.type);
+ }
+ });
+ });
+ });
+}
+
+function singleTouchTestScenario(touchCancel) {
+ debug(" **** First touch on green box & jiggle ****");
+ eventSender.addTouchPoint(x1, y1)
+ eventSender.touchStart();
+ eventSender.updateTouchPoint(0, x1+1, y1+1);
+ eventSender.touchMove();
+
+ debug(" **** Move to blue box & jiggle ****");
+ eventSender.updateTouchPoint(0, x2, y2);
+ eventSender.touchMove();
+ eventSender.updateTouchPoint(0, x2+1, y2+1);
+ eventSender.touchMove();
+
+ if (touchCancel) {
+ debug(" **** Cancel touch ****");
+ eventSender.cancelTouchPoint(0);
+ eventSender.touchCancel();
+ } else {
+ debug(" **** Release touch ****");
+ eventSender.releaseTouchPoint(0);
+ eventSender.touchEnd();
+ }
+
+ debug("");
+}
+
+
+function multiTouchTestScenario(touchCancel) {
+ debug(" **** First touch on green & second touch on blue & jiggle ****");
+ eventSender.addTouchPoint(x1, y1)
+ eventSender.touchStart();
+ eventSender.addTouchPoint(x2, y2)
+ eventSender.touchStart();
+ eventSender.updateTouchPoint(0, x1+1, y1+1);
+ eventSender.touchMove();
+ eventSender.updateTouchPoint(1, x2+1, y2+1);
+ eventSender.touchMove();
+
+ debug(" **** Move first touch to blue & second touch to green ****");
+ eventSender.updateTouchPoint(0, x2, y2);
+ eventSender.touchMove();
+ eventSender.updateTouchPoint(1, x1, y1);
+ eventSender.touchMove();
+
+ if (touchCancel) {
+ debug(" **** Cancel first touch ****");
+ eventSender.cancelTouchPoint(0);
+ eventSender.touchCancel();
+ } else {
+ debug(" **** Release first touch ****");
+ eventSender.releaseTouchPoint(0);
+ eventSender.touchEnd();
+ }
+
+ debug(" **** Jiggle second touch on green ****");
+ eventSender.updateTouchPoint(0, x1+1, y1+1);
+ eventSender.touchMove();
+
+ if (touchCancel) {
+ debug(" **** Cancel second touch ****");
+ eventSender.cancelTouchPoint(0);
+ eventSender.touchCancel();
+ } else {
+ debug(" **** Release second touch ****");
+ eventSender.releaseTouchPoint(0);
+ eventSender.touchEnd();
+ }
+
+ debug("");
+}
+
+function runTests() {
+ debug(" ======= Touch and release =======");
+ singleTouchTestScenario(false);
+
+ debug(" ======= Touch and cancel =======");
+ singleTouchTestScenario(true);
+
+ debug(" ======= Multitouch and release =======");
+ multiTouchTestScenario(false);
+
+ debug(" ======= Multitouch and cancel =======");
+ multiTouchTestScenario(true);
+
+}
+
+init();
+if (window.eventSender)
+ runTests();
+else
+ debug("This test requires eventSender");
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698