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

Side by Side Diff: third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-node-remove.html

Issue 2098883002: Make PointerEvent an experimental web platform feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, fixed js path. 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <script src="../../../../../resources/js-test.js"></script>
3 <style>
4 div.box {
5 margin: 5px;
6 padding: 20px;
7 float: left;
8 }
9 #grey {
10 width: 50px;
11 height: 50px;
12 }
13 </style>
14
15 <div id="grey" class="box" style="background-color:grey">
16 </div>
17
18 <div id="console"></div>
19
20 <script>
21 description("Verifies the compatiblity mouse events are sent correctly when the node is deleted on pointer event handler.");
22
23 var eventList = ["mousedown", "mouseup", "mousemove",
24 "pointerdown", "pointerup", "pointermove"];
25
26
27 var removeNodeEvent = "";
28
29 function init() {
30 var targetDiv = document.getElementById("grey");
31 eventList.forEach(function(eventName) {
32 targetDiv.addEventListener(eventName, function(event) {
33 if (event.eventPhase == Event.AT_TARGET) {
34 debug("grey received " + event.type);
35 }
36 });
37 });
38 }
39
40 function createGreenBoxAndAddListeners() {
41 var greenDiv = document.createElement("div");
42 greenDiv.setAttribute("class", "box");
43 greenDiv.id = "green";
44 document.getElementById("grey").appendChild(greenDiv);
45 eventList.forEach(function(eventName) {
46 greenDiv.addEventListener(eventName, function(event) {
47 if (event.eventPhase == Event.AT_TARGET) {
48 debug("green received " + event.type);
49 if (event.type == removeNodeEvent) {
50 greenDiv.parentNode.removeChild(greenDiv);
51 debug(" ==> Green box removed");
52 }
53 }
54 });
55 });
56 }
57
58 function testScenario() {
59 eventSender.mouseMoveTo(0, 0);
60
61 if (document.getElementById('grey').children.length == 0)
62 createGreenBoxAndAddListeners();
63
64 var rect = document.getElementById("green").getBoundingClientRect();
65 var x1 = rect.left + 5;
66 var y1 = rect.top + 5;
67
68 debug(" **** mouse move *****");
69 eventSender.mouseMoveTo(x1, y1);
70
71 debug(" **** mouse down *****");
72 eventSender.mouseDown(1);
73
74 debug(" **** mouse up *****");
75 eventSender.mouseUp(1);
76 }
77
78 function runTests() {
79 debug(" ======= Nothing is removed =======");
80 removeNodeEvent = "";
81 testScenario();
82 debug("");
83
84 debug(" ======= Remove green on pointerdown =======");
85 removeNodeEvent = "pointerdown";
86 testScenario();
87 debug("");
88
89 debug(" ======= Remove green on pointerup =======");
90 removeNodeEvent = "pointerup";
91 testScenario();
92 debug("");
93
94 debug(" ======= Remove green on pointermove =======");
95 removeNodeEvent = "pointermove";
96 testScenario();
97 debug("");
98 }
99
100 init();
101 if (window.eventSender)
102 runTests();
103 else
104 debug("This test requires eventSender");
105
106 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698