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/fast/forms/suggestion-picker/month-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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 function test1AfterClosing() { 90 function test1AfterClosing() {
91 shouldBeNull('$("mock-page-popup")'); 91 shouldBeNull('$("mock-page-popup")');
92 shouldBeEqualToString('document.getElementById("month").value', '2012-03'); 92 shouldBeEqualToString('document.getElementById("month").value', '2012-03');
93 93
94 openPicker($('month'), test2); 94 openPicker($('month'), test2);
95 } 95 }
96 96
97 var scrollTopBeforeWheelEvent = 0; 97 var scrollTopBeforeWheelEvent = 0;
98 var scrollTopAfterWheelEvent = 0; 98 var scrollTopAfterWheelEvent = 0;
99 var suggestionList;
99 100
100 function test2() { 101 function test2() {
101 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0]; 102 suggestionList = popupWindow.document.getElementsByClassName("suggestion-lis t")[0];
102 103
103 debug('Check that you can scroll using the mouse wheel.'); 104 debug('Check that you can scroll using the mouse wheel.');
104 105
105 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 106 function finishTest() {
106 dispatchWheelEvent(suggestionList, 0, -100); 107 popupWindow.focus();
107 scrollTopAfterWheelEvent = suggestionList.scrollTop; 108 eventSender.keyDown('escape');
108 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 109 waitUntilClosing(test2AfterClosing);
110 }
109 111
110 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 112 function scrollUp() {
111 dispatchWheelEvent(suggestionList, 0, 100); 113 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
112 scrollTopAfterWheelEvent = suggestionList.scrollTop; 114 dispatchWheelEvent(suggestionList, 0, 100);
113 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); 115 shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop' , 'true', finishTest)
116 }
114 117
115 popupWindow.focus(); 118 function scrollDown() {
116 eventSender.keyDown('escape'); 119 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
117 waitUntilClosing(test2AfterClosing); 120 dispatchWheelEvent(suggestionList, 0, -100);
121 shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop' , 'true', scrollUp);
122 }
123
124 scrollDown();
118 } 125 }
119 126
120 function test2AfterClosing() { 127 function test2AfterClosing() {
121 shouldBeNull('$("mock-page-popup")'); 128 shouldBeNull('$("mock-page-popup")');
122 129
123 openPicker($('month'), test3); 130 openPicker($('month'), test3);
124 } 131 }
125 132
126 function test3() { 133 function test3() {
127 debug('Check that you can scroll using the scroll bar.'); 134 debug('Check that you can scroll using the scroll bar.');
128 135
129 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0]; 136 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0];
130 var suggestionListOffset = cumulativeOffset(suggestionList); 137 var suggestionListOffset = cumulativeOffset(suggestionList);
131 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2; 138 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2;
132 139
133 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 140 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
134 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels 141 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels
135 eventSender.mouseDown(); 142 eventSender.mouseDown();
136 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight); 143 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight);
137 eventSender.mouseUp(); 144 eventSender.mouseUp();
138 scrollTopAfterWheelEvent = suggestionList.scrollTop; 145 scrollTopAfterWheelEvent = suggestionList.scrollTop;
139 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 146 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent');
140 147
141 finishJSTest(); 148 finishJSTest();
142 } 149 }
143 150
144 </script> 151 </script>
145 </body> 152 </body>
146 </html> 153 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698