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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/suggestion-picker/datetimelocal-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: 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 function test1AfterClosing() { 63 function test1AfterClosing() {
64 shouldBeNull('document.getElementById("mock-page-popup")'); 64 shouldBeNull('document.getElementById("mock-page-popup")');
65 shouldBeEqualToString('document.getElementById("datetime-local").value', '20 12-11-22T01:03'); 65 shouldBeEqualToString('document.getElementById("datetime-local").value', '20 12-11-22T01:03');
66 66
67 openPicker($('datetime-local'), test2); 67 openPicker($('datetime-local'), test2);
68 } 68 }
69 69
70 var scrollTopBeforeWheelEvent = 0; 70 var scrollTopBeforeWheelEvent = 0;
71 var scrollTopAfterWheelEvent = 0; 71 var scrollTopAfterWheelEvent = 0;
72 var suggestionList;
72 73
73 function test2() { 74 function test2() {
74 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0]; 75 suggestionList = popupWindow.document.getElementsByClassName("suggestion-lis t")[0];
75 76
76 debug('Check that you can scroll using the mouse wheel.'); 77 debug('Check that you can scroll using the mouse wheel.');
77 78
78 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 79 function finishTest() {
79 dispatchWheelEvent(suggestionList, 0, -100); 80 popupWindow.focus();
80 scrollTopAfterWheelEvent = suggestionList.scrollTop; 81 eventSender.keyDown('escape');
81 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 82 waitUntilClosing(test2AfterClosing);
83 }
82 84
83 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 85 function scrollUp() {
84 dispatchWheelEvent(suggestionList, 0, 100); 86 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
85 scrollTopAfterWheelEvent = suggestionList.scrollTop; 87 dispatchWheelEvent(suggestionList, 0, 100);
86 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); 88 shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop' , 'true', finishTest)
89 }
87 90
88 popupWindow.focus(); 91 function scrollDown() {
89 eventSender.keyDown('escape'); 92 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
90 waitUntilClosing(test2AfterClosing); 93 dispatchWheelEvent(suggestionList, 0, -100);
94 shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop' , 'true', scrollUp);
95 }
96
97 scrollDown();
91 } 98 }
92 99
93 function test2AfterClosing() { 100 function test2AfterClosing() {
94 shouldBeNull('$("mock-page-popup")'); 101 shouldBeNull('$("mock-page-popup")');
95 102
96 openPicker($('datetime-local'), test3); 103 openPicker($('datetime-local'), test3);
97 } 104 }
98 105
99 function test3() { 106 function test3() {
100 debug('Check that you can scroll using the scroll bar.'); 107 debug('Check that you can scroll using the scroll bar.');
101 108
102 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0]; 109 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0];
103 var suggestionListOffset = cumulativeOffset(suggestionList); 110 var suggestionListOffset = cumulativeOffset(suggestionList);
104 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2; 111 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2;
105 112
106 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 113 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
107 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels 114 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels
108 eventSender.mouseDown(); 115 eventSender.mouseDown();
109 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight); 116 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight);
110 eventSender.mouseUp(); 117 eventSender.mouseUp();
111 scrollTopAfterWheelEvent = suggestionList.scrollTop; 118 scrollTopAfterWheelEvent = suggestionList.scrollTop;
112 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 119 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent');
113 120
114 finishJSTest(); 121 finishJSTest();
115 } 122 }
116 123
117 </script> 124 </script>
118 </body> 125 </body>
119 </html> 126 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698