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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/mouse-event-buttons-attribute.html

Issue 1775613004: Fix mouse-event-buttons-attribute flakiness (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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <style> 2 <style>
3 #target { 3 #target {
4 width: 100px; 4 width: 100px;
5 height: 100px; 5 height: 100px;
6 background: blue; 6 background: blue;
7 position: absolute; 7 position: absolute;
8 left: 0px; 8 left: 0px;
9 top: 0px; 9 top: 0px;
10 } 10 }
11 #drag{ 11 #drag{
12 position: absolute; 12 position: absolute;
13 left: 0px; 13 left: 0px;
14 top: 100px; 14 top: 100px;
15 } 15 }
16 </style> 16 </style>
17
18 <div id="target"></div> 17 <div id="target"></div>
19 <img id="drag" src="resources/greenbox30.png" draggable> 18 <img id="drag" src="resources/greenbox30.png" draggable>
19
20 <script src="../../resources/js-test.js"></script> 20 <script src="../../resources/js-test.js"></script>
21 <script> 21 <script>
22 22
23 const L = 'leftButton'; 23 const L = 'leftButton';
24 const R = 'rightButton'; 24 const R = 'rightButton';
25 const M = 'middleButton'; 25 const M = 'middleButton';
26 26
27 var targetDiv = document.getElementById('target');
28 var dragImg = document.getElementById('drag');
29 var seqNo = 0; 27 var seqNo = 0;
30 var testSet = [ 28 var testSet = [
31 { initialButtons: [], action: doubleClickAction }, 29 { initialButtons: [], action: doubleClickAction },
32 { initialButtons: [R], action: clickAction }, 30 { initialButtons: [R], action: clickAction },
33 { initialButtons: [M, R], action: clickAction }, 31 { initialButtons: [M, R], action: clickAction },
34 { initialButtons: [L, M, R], action: moveAction }, 32 { initialButtons: [L, M, R], action: moveAction },
35 { initialButtons: [], action: rightClickAction, showContextMenuOnMouseU p: false }, 33 { initialButtons: [], action: rightClickAction, showContextMenuOnMouseU p: false },
36 { initialButtons: [], action: rightClickAction, showContextMenuOnMouseU p: true }, 34 { initialButtons: [], action: rightClickAction, showContextMenuOnMouseU p: true },
37 { initialButtons: [L, R], action: wheelAction }, 35 { initialButtons: [L, R], action: wheelAction },
38 { initialButtons: [], action: doubleTapAction }, 36 { initialButtons: [], action: doubleTapAction },
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 var showContextMenuOnMouseUp = ""; 116 var showContextMenuOnMouseUp = "";
119 if (testItem.showContextMenuOnMouseUp != undefined) 117 if (testItem.showContextMenuOnMouseUp != undefined)
120 showContextMenuOnMouseUp = "and showContextMenuOnMouseUp=" + 118 showContextMenuOnMouseUp = "and showContextMenuOnMouseUp=" +
121 testItem.showContextMenuOnMouseUp + " "; 119 testItem.showContextMenuOnMouseUp + " ";
122 120
123 debug('===== ' + testItem.action.name + ' with initial state=[' + testItem.ini tialButtons + '] ' 121 debug('===== ' + testItem.action.name + ' with initial state=[' + testItem.ini tialButtons + '] '
124 + showContextMenuOnMouseUp + '====='); 122 + showContextMenuOnMouseUp + '=====');
125 } 123 }
126 124
127 function init() { 125 function init() {
126 var targetDiv = document.getElementById('target');
127 var dragImg = document.getElementById('drag');
128 var eventList = ['dblclick', 'click', 'mousedown', 'mouseup', 'mousemove', 'mo useenter', 'mouseleave', 'mouseover', 'mouseout', 'mousewheel', 'dragstart', 'dr agend', 'dragenter', 'dragleave', 'dragover', 'drag', 'contextmenu']; 128 var eventList = ['dblclick', 'click', 'mousedown', 'mouseup', 'mousemove', 'mo useenter', 'mouseleave', 'mouseover', 'mouseout', 'mousewheel', 'dragstart', 'dr agend', 'dragenter', 'dragleave', 'dragover', 'drag', 'contextmenu'];
129 eventList.forEach(function(eventName) { 129 eventList.forEach(function(eventName) {
130 targetDiv.addEventListener(eventName, function(event) { 130 targetDiv.addEventListener(eventName, function(event) {
131 debug(++seqNo + ". targetDiv received " + event.type + " buttons: " + even t.buttons); 131 debug(++seqNo + ". targetDiv received " + event.type + " buttons: " + even t.buttons);
132 }); 132 });
133 dragImg.addEventListener(eventName, function(event) { 133 dragImg.addEventListener(eventName, function(event) {
134 debug(++seqNo + ". dragImg received " + event.type + " buttons: " + event. buttons); 134 debug(++seqNo + ". dragImg received " + event.type + " buttons: " + event. buttons);
135 }); 135 });
136 }); 136 });
137 } 137 }
138 138
139 function runTests() { 139 window.onload=function() {
140 for (var i = 0; i < testSet.length; i++) { 140 init();
141 printTestInfo(testSet[i]); 141 if(window.eventSender) {
142 for (var i = 0; i < testSet.length; i++) {
143 printTestInfo(testSet[i]);
142 144
143 // Reset the state for the new test 145 // Reset the state for the new test
144 seqNo = 0; 146 seqNo = 0;
145 eventSender.setMouseButtonState(-1, testSet[i].initialButtons); 147 eventSender.setMouseButtonState(-1, testSet[i].initialButtons);
146 internals.settings.setShowContextMenuOnMouseUp(testSet[i].showContextMenuOnM ouseUp); 148 internals.settings.setShowContextMenuOnMouseUp(testSet[i].showContextMenuO nMouseUp);
147 149
148 testSet[i].action(); 150 testSet[i].action();
149 151
150 // Reset the mouse position 152 // Reset the mouse position
151 eventSender.mouseMoveTo(-1, -1); 153 eventSender.mouseMoveTo(-1, -1);
152 154
153 debug(''); 155 debug('');
156 }
154 } 157 }
155 } 158 }
156 159
157 init(); 160 if (!window.eventSender) {
158 if (window.eventSender)
159 runTests();
160 else
161 debug("This test requires eventSender"); 161 debug("This test requires eventSender");
162 }
162 163
163 </script> 164 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698