Chromium Code Reviews| 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.documentElement.scrollTop", "100"); | 41 shouldBe("document.documentElement.scrollTop", "0"); |
|
ajuma
2015/02/02 14:29:53
Does using the body element here work? (Also below
| |
| 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.documentElement.scrollTop", "50"); | 63 shouldBe("document.documentElement.scrollTop", "0"); |
| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |