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

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, 9 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/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..ad0f4daa0495c51f9f720953fbf4b38a3348fd20
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/touch-capture.html
@@ -0,0 +1,111 @@
+<!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 touchCancel = false;
+
+var rect = document.getElementById("green").getBoundingClientRect();
+var x1 = rect.left + 5;
+var y1 = rect.top + 5;
+
+var rect = document.getElementById("grey").getBoundingClientRect();
+var x2 = rect.left + 5;
+var y2 = rect.top + 5;
+
+var rect = document.getElementById("blue").getBoundingClientRect();
+var x3 = rect.left + 5;
+var y3 = rect.top + 5;
+
+function init() {
+ var eventList = ["pointerenter", "pointerleave", "pointerover", "pointerout", "pointermove", "pointerdown", "pointerup", "pointercancel",
mustaq 2016/03/30 21:21:54 Please add touchstart/end/move in this list.
Navid Zolghadr 2016/03/31 16:22:25 Done.
+ "gotpointercapture", "lostpointercapture"];
+
+ document.addEventListener("lostpointercapture", function(event) {
+ if (event.eventPhase == Event.AT_TARGET) {
+ debug("document received " + event.type);
+ }
+ });
+ ["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) {
+ debug(id + " received " + event.type);
+ }
+ });
+ });
+ });
+}
+
+function testScenario() {
+ 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 grey box & jiggle ***** ");
mustaq 2016/03/30 21:21:54 The "grey" touch activity doesn't add any value I
Navid Zolghadr 2016/03/31 16:22:25 Done.
+ eventSender.updateTouchPoint(0, x2, y2);
+ eventSender.touchMove();
+ eventSender.updateTouchPoint(0, x2+1, y2+1);
+ eventSender.touchMove();
+
+ debug(" **** Move to blue box & jiggle ****");
+ eventSender.updateTouchPoint(0, x3, y3);
+ eventSender.touchMove();
+ eventSender.updateTouchPoint(0, x3+1, y3+1);
+ eventSender.touchMove();
+
+ if (touchCancel) {
+ debug(" **** Cancel touch ***** ");
+ eventSender.cancelTouchPoint(0);
+ eventSender.touchCancel();
+ } else {
+ debug(" **** Release touch ***** ");
+ eventSender.releaseTouchPoint(0);
+ eventSender.touchEnd();
+ }
+
+ debug("");
+}
+
+function runTests() {
+ debug(" ======= Touch and release =======");
+ testScenario();
+
+ touchCancel = true
+ debug(" ======= Touch and cancel =======");
+ testScenario();
+ touchCancel = false;
+
mustaq 2016/03/30 21:21:54 Please add a multitouch case: touch+drag on G & B,
Navid Zolghadr 2016/03/31 16:22:25 Is this what you meant?
+}
+
+init();
+if (window.eventSender)
+ runTests();
+else
+ debug("This test requires eventSender");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698