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

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

Issue 879333002: Support buttons attribute for drag event (blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 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
« no previous file with comments | « no previous file | LayoutTests/fast/events/mouse-event-buttons-attribute-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <div id="region" style="width:100px; height:100px; position:absolute; left:0px; top:0px;"></div> 2 <div id="target" style="width:100px; height:100px; position:absolute; left:0px; top:0px;"></div>
3 <img id="drag" src="resources/greenbox30.png" style="position:absolute; left:0px ; top:100px;" draggable>
3 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
4 <script> 5 <script>
5 6
6 const L = 'leftButton'; 7 const L = 'leftButton';
7 const R = 'rightButton'; 8 const R = 'rightButton';
8 const M = 'middleButton'; 9 const M = 'middleButton';
9 const TABLE = { 10 const TABLE = {
10 'leftButton': 1, 11 'leftButton': 1,
11 'rightButton': 2, 12 'rightButton': 2,
12 'middleButton': 4 13 'middleButton': 4
13 }; 14 };
14 const ME = 'MouseEvent'; 15 const ME = 'MouseEvent';
15 const WE = 'WheelEvent'; 16 const WE = 'WheelEvent';
16 const GE = 'GestureEvent'; 17 const GE = 'GestureEvent';
18 const DE = 'DragEvent';
17 19
20 var target = document.getElementById('target');
21 var drag = document.getElementById('drag');
18 var buttons = -2; 22 var buttons = -2;
19 var div = document.getElementById('region');
20 var testSet = [ 23 var testSet = [
21 { type: ME, name: 'dblclick', modifiers: [L], expectedModifiers: [], action: d oubleClickAction }, 24 { type: ME, name: 'dblclick', modifiers: [L], expectedModifiers: [], action: d oubleClickAction },
22 { type: ME, name: 'click', modifiers: [L, R], expectedModifiers: [R], action: clickAction }, 25 { type: ME, name: 'click', modifiers: [L, R], expectedModifiers: [R], action: clickAction },
23 { type: ME, name: 'mousedown', modifiers: [L, M, R], action: clickAction }, 26 { type: ME, name: 'mousedown', modifiers: [L, M, R], action: clickAction },
24 { type: ME, name: 'mouseup', modifiers: [L, M, R], expectedModifiers: [M, R], action: clickAction }, 27 { type: ME, name: 'mouseup', modifiers: [L, M, R], expectedModifiers: [M, R], action: clickAction },
25 { type: ME, name: 'mousemove', modifiers: [], action: moveAction }, 28 { type: ME, name: 'mousemove', modifiers: [], action: moveAction },
26 { type: ME, name: 'mousemove', modifiers: [L], action: moveAction }, 29 { type: ME, name: 'mousemove', modifiers: [L], action: moveAction },
27 { type: ME, name: 'mouseenter', modifiers: [R, M], action: moveAction }, 30 { type: ME, name: 'mouseenter', modifiers: [R, M], action: moveAction },
28 { type: ME, name: 'mouseleave', modifiers: [L, R], action: moveAction }, 31 { type: ME, name: 'mouseleave', modifiers: [L, R], action: moveAction },
29 { type: ME, name: 'mouseover', modifiers: [L, M], action: moveAction }, 32 { type: ME, name: 'mouseover', modifiers: [L, M], action: moveAction },
30 { type: ME, name: 'mouseout', modifiers: [L], action: moveAction }, 33 { type: ME, name: 'mouseout', modifiers: [L], action: moveAction },
31 { type: ME, name: 'contextmenu', modifiers: [R], action: rightClickAction, sho wContextMenuOnMouseUp: false }, 34 { type: ME, name: 'contextmenu', modifiers: [R], action: rightClickAction, sho wContextMenuOnMouseUp: false },
32 { type: ME, name: 'contextmenu', modifiers: [R], expectedModifiers: [], action : rightClickAction, showContextMenuOnMouseUp: true }, 35 { type: ME, name: 'contextmenu', modifiers: [R], expectedModifiers: [], action : rightClickAction, showContextMenuOnMouseUp: true },
33 { type: WE, name: 'mousewheel', modifiers: [L, R], action: wheelAction }, 36 { type: WE, name: 'mousewheel', modifiers: [L, R], action: wheelAction },
34 { type: GE, name: 'dblclick', modifiers: [L], expectedModifiers: [], action: d oubleTapAction }, 37 { type: GE, name: 'dblclick', modifiers: [L], expectedModifiers: [], action: d oubleTapAction },
35 { type: GE, name: 'click', modifiers: [L], expectedModifiers: [], action: tapA ction }, 38 { type: GE, name: 'click', modifiers: [L], expectedModifiers: [], action: tapA ction },
36 { type: GE, name: 'mousedown', modifiers: [L], action: tapAction }, 39 { type: GE, name: 'mousedown', modifiers: [L], action: tapAction },
37 { type: GE, name: 'mouseup', modifiers: [L], expectedModifiers: [], action: ta pAction }, 40 { type: GE, name: 'mouseup', modifiers: [L], expectedModifiers: [], action: ta pAction },
38 { type: GE, name: 'mousemove', modifiers: [], action: tapAction }, 41 { type: GE, name: 'mousemove', modifiers: [], action: tapAction },
39 { type: GE, name: 'mousedown', modifiers: [R], action: longPressAction }, 42 { type: GE, name: 'mousedown', modifiers: [R], action: longPressAction },
40 { type: GE, name: 'contextmenu', modifiers: [R], action: longPressAction, show ContextMenuOnMouseUp: false }, 43 { type: GE, name: 'contextmenu', modifiers: [R], action: longPressAction, show ContextMenuOnMouseUp: false },
41 { type: GE, name: 'contextmenu', modifiers: [R], expectedModifiers: [], action : longPressAction, showContextMenuOnMouseUp: true }, 44 { type: GE, name: 'contextmenu', modifiers: [R], expectedModifiers: [], action : longPressAction, showContextMenuOnMouseUp: true },
42 { type: GE, name: 'contextmenu', modifiers: [R], action: longTapAction, showCo ntextMenuOnMouseUp: false }, 45 { type: GE, name: 'contextmenu', modifiers: [R], action: longTapAction, showCo ntextMenuOnMouseUp: false },
43 { type: GE, name: 'contextmenu', modifiers: [R], expectedModifiers: [], action : longTapAction, showContextMenuOnMouseUp: true }, 46 { type: GE, name: 'contextmenu', modifiers: [R], expectedModifiers: [], action : longTapAction, showContextMenuOnMouseUp: true },
47 { type: DE, name: 'dragstart', modifiers: [L, R], action: dragDropAction, even tTarget: drag },
48 { type: DE, name: 'drag', modifiers: [L, M, R], action: dragDropAction, eventT arget: drag },
49 { type: DE, name: 'dragend', modifiers: [L, R], expectedModifiers: [], action: dragDropAction, eventTarget: drag },
50 { type: DE, name: 'dragenter', modifiers: [L, M], action: dragDropAction },
51 { type: DE, name: 'dragleave', modifiers: [L, R], action: dragDropAction },
52 { type: DE, name: 'dragover', modifiers: [L, M], action: dragDropAction },
44 ]; 53 ];
45 54
46 function eventHandler(e) 55 function eventHandler(e)
47 { 56 {
48 buttons = e.buttons; 57 buttons = e.buttons;
49 } 58 }
50 59
51 function moveAction(modifiers) 60 function moveAction(modifiers)
52 { 61 {
53 eventSender.mouseMoveTo(-1, -1, modifiers); 62 eventSender.mouseMoveTo(-1, -1, modifiers);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 { 103 {
95 eventSender.gestureLongPress(50, 50); 104 eventSender.gestureLongPress(50, 50);
96 eventSender.gestureLongTap(50, 50); 105 eventSender.gestureLongTap(50, 50);
97 } 106 }
98 107
99 function doubleTapAction(modifiers) 108 function doubleTapAction(modifiers)
100 { 109 {
101 eventSender.gestureTap(50, 50, 2); 110 eventSender.gestureTap(50, 50, 2);
102 } 111 }
103 112
113 function dragDropAction(modifiers)
114 {
115 eventSender.mouseMoveTo(10, 110, modifiers);
116 eventSender.mouseDown(0, modifiers);
117 eventSender.mouseMoveTo(10, 80, modifiers);
118 eventSender.mouseMoveTo(10, 110, modifiers);
119 eventSender.mouseMoveTo(10, 80, modifiers);
120 eventSender.mouseUp(0, modifiers);
121 }
122
104 function raiseEvent(n) 123 function raiseEvent(n)
105 { 124 {
106 if (!window.eventSender) 125 if (!window.eventSender)
107 return; 126 return;
108 127
109 div.addEventListener(testSet[n].name, eventHandler, false); 128 var eventTarget = testSet[n].eventTarget || target;
129
130 eventTarget.addEventListener(testSet[n].name, eventHandler, false);
110 testSet[n].action(testSet[n].modifiers); 131 testSet[n].action(testSet[n].modifiers);
111 testSet[n].buttons = buttons; 132 testSet[n].buttons = buttons;
112 div.removeEventListener(testSet[n].name, eventHandler, false); 133 eventTarget.removeEventListener(testSet[n].name, eventHandler, false);
113 buttons = -1; 134 buttons = -1;
114 } 135 }
115 136
116 function expectedValue(testItem) 137 function expectedValue(testItem)
117 { 138 {
118 var modifiers; 139 var modifiers;
119 if (testItem.expectedModifiers != undefined) 140 if (testItem.expectedModifiers != undefined)
120 modifiers = testItem.expectedModifiers; 141 modifiers = testItem.expectedModifiers;
121 else 142 else
122 modifiers = testItem.modifiers; 143 modifiers = testItem.modifiers;
(...skipping 21 matching lines...) Expand all
144 165
145 for (var i = 0; i < testSet.length; i++) { 166 for (var i = 0; i < testSet.length; i++) {
146 internals.settings.setShowContextMenuOnMouseUp(testSet[i].showContextMenuOnMou seUp); 167 internals.settings.setShowContextMenuOnMouseUp(testSet[i].showContextMenuOnMou seUp);
147 raiseEvent(i); 168 raiseEvent(i);
148 printTestInfo(testSet[i]); 169 printTestInfo(testSet[i]);
149 shouldBeEqualToNumber('testSet[i].buttons', expectedValue(testSet[i])); 170 shouldBeEqualToNumber('testSet[i].buttons', expectedValue(testSet[i]));
150 debug(''); 171 debug('');
151 } 172 }
152 173
153 </script> 174 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/mouse-event-buttons-attribute-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698