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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/scrolling/hover-during-scroll.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 <style> 4 <style>
5 div { 5 div {
6 line-height: 50px; 6 line-height: 50px;
7 } 7 }
8 8
9 .hoverme { 9 .hoverme {
10 background-color: lightblue; 10 background-color: lightblue;
(...skipping 27 matching lines...) Expand all
38 shouldBeEqualToString("array[2].innerHTML", textWhenHovered); 38 shouldBeEqualToString("array[2].innerHTML", textWhenHovered);
39 shouldBeEqualToString("array[3].innerHTML", textWhenNotHovered); 39 shouldBeEqualToString("array[3].innerHTML", textWhenNotHovered);
40 shouldBeEqualToString("array[4].innerHTML", textWhenNotHovered); 40 shouldBeEqualToString("array[4].innerHTML", textWhenNotHovered);
41 shouldBe("document.scrollingElement.scrollTop", "100"); 41 shouldBe("document.scrollingElement.scrollTop", "100");
42 42
43 testRunner.notifyDone(); 43 testRunner.notifyDone();
44 } 44 }
45 45
46 function scrolledWhileCursorVisible() 46 function scrolledWhileCursorVisible()
47 { 47 {
48 // The delay is necessary to guarantee that the fake mouse move
49 // event timer has fired. But since the cursor is visible, we
50 // can stop waiting as soon as the hover effect has been invoked.
51 var elementHovered = array[2].innerHTML == textWhenHovered; 48 var elementHovered = array[2].innerHTML == textWhenHovered;
52 if (!elementHovered && Date.now() - startTime < fakeMouseMoveTimerDelay) { 49 if (!elementHovered) {
53 window.setTimeout(scrolledWhileCursorVisible, 10); 50 window.setTimeout(scrolledWhileCursorVisible, 10);
54 return; 51 return;
55 } 52 }
56 53
57 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered); 54 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered);
58 shouldBeEqualToString("array[1].innerHTML", textWhenWasHovered); 55 shouldBeEqualToString("array[1].innerHTML", textWhenWasHovered);
59 shouldBeEqualToString("array[2].innerHTML", textWhenHovered); 56 shouldBeEqualToString("array[2].innerHTML", textWhenHovered);
60 shouldBeEqualToString("array[3].innerHTML", textWhenNotHovered); 57 shouldBeEqualToString("array[3].innerHTML", textWhenNotHovered);
61 58
62 debug("Mouse is not visible, scrolling page so the mouse ends up on the four th div."); 59 debug("Mouse is not visible, scrolling page so the mouse ends up on the four th div.");
63 shouldBe("document.scrollingElement.scrollTop", "50"); 60 shouldBe("document.scrollingElement.scrollTop", "50");
64 internals.setIsCursorVisible(document, false); 61 internals.setIsCursorVisible(document, false);
65 startTime = Date.now(); 62 startTime = Date.now();
66 eventSender.continuousMouseScrollBy(0, -elementHeight); 63 eventSender.continuousMouseScrollBy(0, -elementHeight);
67 scrolledWhileCursorNotVisible(); 64 shouldBecomeEqual('document.scrollingElement.scrollTop == elementHeight*2', 'true', scrolledWhileCursorNotVisible);
68 } 65 }
69 66
70 var array; 67 var array;
71 var numHoverElements = 30; 68 var numHoverElements = 30;
72 var elementHeight = 50; 69 var elementHeight = 50;
73 var fakeMouseMoveTimerDelay = 150; 70 var fakeMouseMoveTimerDelay = 500;
74 var textWhenNotHovered = "hover over me"; 71 var textWhenNotHovered = "hover over me";
75 var textWhenHovered = "currently hovered"; 72 var textWhenHovered = "currently hovered";
76 var textWhenWasHovered = "was hovered"; 73 var textWhenWasHovered = "was hovered";
77 var startTime; 74 var startTime;
78 75
79 function runtest() 76 function runtest()
80 { 77 {
81 buildPage(); 78 buildPage();
82 79
83 array = document.getElementsByClassName('hoverme'); 80 array = document.getElementsByClassName('hoverme');
(...skipping 28 matching lines...) Expand all
112 debug("Mouse is visible, moving it over the second div."); 109 debug("Mouse is visible, moving it over the second div.");
113 eventSender.mouseMoveTo(53, centerOfDivAtIndex(1)); 110 eventSender.mouseMoveTo(53, centerOfDivAtIndex(1));
114 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered); 111 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered);
115 shouldBeEqualToString("array[1].innerHTML", textWhenHovered); 112 shouldBeEqualToString("array[1].innerHTML", textWhenHovered);
116 shouldBeEqualToString("array[2].innerHTML", textWhenNotHovered); 113 shouldBeEqualToString("array[2].innerHTML", textWhenNotHovered);
117 114
118 debug("Mouse is visible, scrolling page so the mouse ends up on the third di v."); 115 debug("Mouse is visible, scrolling page so the mouse ends up on the third di v.");
119 shouldBe("document.scrollingElement.scrollTop", "0"); 116 shouldBe("document.scrollingElement.scrollTop", "0");
120 startTime = Date.now(); 117 startTime = Date.now();
121 eventSender.continuousMouseScrollBy(0, -elementHeight); 118 eventSender.continuousMouseScrollBy(0, -elementHeight);
122 scrolledWhileCursorVisible(); 119 shouldBecomeEqual('document.scrollingElement.scrollTop == elementHeight', 't rue', scrolledWhileCursorVisible);
123 } 120 }
124 121
125 function buildPage() 122 function buildPage()
126 { 123 {
127 var table = document.getElementById('table_to_fill'); 124 var table = document.getElementById('table_to_fill');
128 var i; 125 var i;
129 for (i = 0; i < numHoverElements; i++) { 126 for (i = 0; i < numHoverElements; i++) {
130 var p = document.createElement('tr'); 127 var p = document.createElement('tr');
131 p.innerHTML = '<tr><td><div class="hoverme">' + textWhenNotHovered + '</ div></td></tr>'; 128 p.innerHTML = '<tr><td><div class="hoverme">' + textWhenNotHovered + '</ div></td></tr>';
132 table.appendChild(p); 129 table.appendChild(p);
133 } 130 }
134 } 131 }
135 </script> 132 </script>
136 133
137 <table id="table_to_fill" width="100%" cellpadding="0px" cellspacing="0px" borde r="0px"> 134 <table id="table_to_fill" width="100%" cellpadding="0px" cellspacing="0px" borde r="0px">
138 <tr><td><div class="hoverme">hover over me</div></td></tr> 135 <tr><td><div class="hoverme">hover over me</div></td></tr>
139 </table> 136 </table>
140 137
141 <p>Test for <a href="http://crbug.com/153784">http://crbug.com/153784</a>. New h over effects should not be invoked during scroll if the mouse cursor is not visi ble.</p> 138 <p>Test for <a href="http://crbug.com/153784">http://crbug.com/153784</a>. New h over effects should not be invoked during scroll if the mouse cursor is not visi ble.</p>
142 139
143 <div id="console"></div> 140 <div id="console"></div>
144 </body> 141 </body>
145 </html> 142 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698