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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/suggestion-picker/week-suggestion-picker-mouse-operations.html

Issue 1413493005: Update layout tests to work when smooth scrolling is enabled by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: worked on nit Created 5 years, 1 month 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 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script src="../../forms/resources/common.js"></script> 5 <script src="../../forms/resources/common.js"></script>
6 <script src="../../forms/resources/common-wheel-event.js"></script> 6 <script src="../../forms/resources/common-wheel-event.js"></script>
7 <script src="../../forms/resources/picker-common.js"></script> 7 <script src="../../forms/resources/picker-common.js"></script>
8 <script src="resources/suggestion-picker-common.js"></script> 8 <script src="resources/suggestion-picker-common.js"></script>
9 </head> 9 </head>
10 <body style="background-color: #bbbbbb;"> 10 <body style="background-color: #bbbbbb;">
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 function test1AfterClosing() { 109 function test1AfterClosing() {
110 shouldBeNull('$("mock-page-popup")'); 110 shouldBeNull('$("mock-page-popup")');
111 shouldBeEqualToString('document.getElementById("week").value', '2012-W03'); 111 shouldBeEqualToString('document.getElementById("week").value', '2012-W03');
112 112
113 openPicker($('week'), test2); 113 openPicker($('week'), test2);
114 } 114 }
115 115
116 var scrollTopBeforeWheelEvent = 0; 116 var scrollTopBeforeWheelEvent = 0;
117 var scrollTopAfterWheelEvent = 0; 117 var scrollTopAfterWheelEvent = 0;
118 var suggestionList;
118 119
119 function test2() { 120 function test2() {
120 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0]; 121 suggestionList = popupWindow.document.getElementsByClassName("suggestion-lis t")[0];
121 122
122 debug('Check that you can scroll using the mouse wheel.'); 123 debug('Check that you can scroll using the mouse wheel.');
123 124
124 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 125 function finishTest() {
125 dispatchWheelEvent(suggestionList, 0, -100); 126 popupWindow.focus();
126 scrollTopAfterWheelEvent = suggestionList.scrollTop; 127 eventSender.keyDown('escape');
127 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 128 waitUntilClosing(test2AfterClosing);
129 }
128 130
129 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 131 function scrollUp() {
130 dispatchWheelEvent(suggestionList, 0, 100); 132 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
131 scrollTopAfterWheelEvent = suggestionList.scrollTop; 133 dispatchWheelEvent(suggestionList, 0, 100);
132 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); 134 shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop' , 'true', finishTest)
135 }
133 136
134 popupWindow.focus(); 137 function scrollDown() {
135 eventSender.keyDown('escape'); 138 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
136 waitUntilClosing(test2AfterClosing); 139 dispatchWheelEvent(suggestionList, 0, -100);
140 shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop' , 'true', scrollUp);
141 }
142
143 scrollDown();
137 } 144 }
138 145
139 function test2AfterClosing() { 146 function test2AfterClosing() {
140 shouldBeNull('$("mock-page-popup")'); 147 shouldBeNull('$("mock-page-popup")');
141 148
142 openPicker($('week'), test3); 149 openPicker($('week'), test3);
143 } 150 }
144 151
145 function test3() { 152 function test3() {
146 debug('Check that you can scroll using the scroll bar.'); 153 debug('Check that you can scroll using the scroll bar.');
147 154
148 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0]; 155 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0];
149 var suggestionListOffset = cumulativeOffset(suggestionList); 156 var suggestionListOffset = cumulativeOffset(suggestionList);
150 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2; 157 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2;
151 158
152 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 159 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
153 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels 160 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels
154 eventSender.mouseDown(); 161 eventSender.mouseDown();
155 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight); 162 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight);
156 eventSender.mouseUp(); 163 eventSender.mouseUp();
157 scrollTopAfterWheelEvent = suggestionList.scrollTop; 164 scrollTopAfterWheelEvent = suggestionList.scrollTop;
158 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 165 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent');
159 166
160 finishJSTest(); 167 finishJSTest();
161 } 168 }
162 169
163 </script> 170 </script>
164 </body> 171 </body>
165 </html> 172 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698