OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 if (Date.now() - startTime < fakeMouseMoveTimerDelay) { | 31 if (Date.now() - startTime < fakeMouseMoveTimerDelay) { |
32 window.setTimeout(scrolledWhileCursorNotVisible, 10); | 32 window.setTimeout(scrolledWhileCursorNotVisible, 10); |
33 return; | 33 return; |
34 } | 34 } |
35 | 35 |
36 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered); | 36 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered); |
37 shouldBeEqualToString("array[1].innerHTML", textWhenWasHovered); | 37 shouldBeEqualToString("array[1].innerHTML", textWhenWasHovered); |
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.body.scrollTop", "100"); | 41 shouldBe("document.documentElement.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 | 48 // The delay is necessary to guarantee that the fake mouse move |
49 // event timer has fired. But since the cursor is visible, we | 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. | 50 // can stop waiting as soon as the hover effect has been invoked. |
51 var elementHovered = array[2].innerHTML == textWhenHovered; | 51 var elementHovered = array[2].innerHTML == textWhenHovered; |
52 if (!elementHovered && Date.now() - startTime < fakeMouseMoveTimerDelay) { | 52 if (!elementHovered && Date.now() - startTime < fakeMouseMoveTimerDelay) { |
53 window.setTimeout(scrolledWhileCursorVisible, 10); | 53 window.setTimeout(scrolledWhileCursorVisible, 10); |
54 return; | 54 return; |
55 } | 55 } |
56 | 56 |
57 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered); | 57 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered); |
58 shouldBeEqualToString("array[1].innerHTML", textWhenWasHovered); | 58 shouldBeEqualToString("array[1].innerHTML", textWhenWasHovered); |
59 shouldBeEqualToString("array[2].innerHTML", textWhenHovered); | 59 shouldBeEqualToString("array[2].innerHTML", textWhenHovered); |
60 shouldBeEqualToString("array[3].innerHTML", textWhenNotHovered); | 60 shouldBeEqualToString("array[3].innerHTML", textWhenNotHovered); |
61 | 61 |
62 debug("Mouse is not visible, scrolling page so the mouse ends up on the four
th div."); | 62 debug("Mouse is not visible, scrolling page so the mouse ends up on the four
th div."); |
63 shouldBe("document.body.scrollTop", "50"); | 63 shouldBe("document.documentElement.scrollTop", "50"); |
64 internals.setIsCursorVisible(document, false); | 64 internals.setIsCursorVisible(document, false); |
65 startTime = Date.now(); | 65 startTime = Date.now(); |
66 eventSender.continuousMouseScrollBy(0, -elementHeight); | 66 eventSender.continuousMouseScrollBy(0, -elementHeight); |
67 scrolledWhileCursorNotVisible(); | 67 scrolledWhileCursorNotVisible(); |
68 } | 68 } |
69 | 69 |
70 var array; | 70 var array; |
71 var numHoverElements = 30; | 71 var numHoverElements = 30; |
72 var elementHeight = 50; | 72 var elementHeight = 50; |
73 var fakeMouseMoveTimerDelay = 150; | 73 var fakeMouseMoveTimerDelay = 150; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 shouldBeEqualToString("array[0].innerHTML", textWhenHovered); | 109 shouldBeEqualToString("array[0].innerHTML", textWhenHovered); |
110 shouldBeEqualToString("array[1].innerHTML", textWhenNotHovered); | 110 shouldBeEqualToString("array[1].innerHTML", textWhenNotHovered); |
111 | 111 |
112 debug("Mouse is visible, moving it over the second div."); | 112 debug("Mouse is visible, moving it over the second div."); |
113 eventSender.mouseMoveTo(53, centerOfDivAtIndex(1)); | 113 eventSender.mouseMoveTo(53, centerOfDivAtIndex(1)); |
114 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered); | 114 shouldBeEqualToString("array[0].innerHTML", textWhenWasHovered); |
115 shouldBeEqualToString("array[1].innerHTML", textWhenHovered); | 115 shouldBeEqualToString("array[1].innerHTML", textWhenHovered); |
116 shouldBeEqualToString("array[2].innerHTML", textWhenNotHovered); | 116 shouldBeEqualToString("array[2].innerHTML", textWhenNotHovered); |
117 | 117 |
118 debug("Mouse is visible, scrolling page so the mouse ends up on the third di
v."); | 118 debug("Mouse is visible, scrolling page so the mouse ends up on the third di
v."); |
119 shouldBe("document.body.scrollTop", "0"); | 119 shouldBe("document.documentElement.scrollTop", "0"); |
120 startTime = Date.now(); | 120 startTime = Date.now(); |
121 eventSender.continuousMouseScrollBy(0, -elementHeight); | 121 eventSender.continuousMouseScrollBy(0, -elementHeight); |
122 scrolledWhileCursorVisible(); | 122 scrolledWhileCursorVisible(); |
123 } | 123 } |
124 | 124 |
125 function buildPage() | 125 function buildPage() |
126 { | 126 { |
127 var table = document.getElementById('table_to_fill'); | 127 var table = document.getElementById('table_to_fill'); |
128 var i; | 128 var i; |
129 for (i = 0; i < numHoverElements; i++) { | 129 for (i = 0; i < numHoverElements; i++) { |
130 var p = document.createElement('tr'); | 130 var p = document.createElement('tr'); |
131 p.innerHTML = '<tr><td><div class="hoverme">' + textWhenNotHovered + '</
div></td></tr>'; | 131 p.innerHTML = '<tr><td><div class="hoverme">' + textWhenNotHovered + '</
div></td></tr>'; |
132 table.appendChild(p); | 132 table.appendChild(p); |
133 } | 133 } |
134 } | 134 } |
135 </script> | 135 </script> |
136 | 136 |
137 <table id="table_to_fill" width="100%" cellpadding="0px" cellspacing="0px" borde
r="0px"> | 137 <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> | 138 <tr><td><div class="hoverme">hover over me</div></td></tr> |
139 </table> | 139 </table> |
140 | 140 |
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> | 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> |
142 | 142 |
143 <div id="console"></div> | 143 <div id="console"></div> |
144 </body> | 144 </body> |
145 </html> | 145 </html> |
OLD | NEW |