| <!DOCTYPE html> |
| <script src="../../resources/js-test.js"></script> |
| <script src="resources/expect-cursor-update.js"></script> |
| <style type="text/css"> |
| #test-container { |
| position: relative; |
| padding: 10px; |
| } |
| #target { |
| cursor: text; |
| background-color: blue; |
| width: 100px; |
| height: 100px; |
| } |
| #overlay { |
| cursor: wait; |
| width: 200px; |
| height: 200px; |
| background: rgba(255,0,0,0.2); |
| position: absolute; |
| left: 0; |
| top: 0; |
| } |
| </style> |
| <p id="description"></p> |
| <p><a href="http://crbug.com/26723">Bug 26723</a></p> |
| <div id="test-container"> |
| <div id="target"></div> |
| </div> |
| <br/> |
| <div id="console"></div> |
| <script> |
| description("Test that mouse cursors are changed correctly after layout."); |
| |
| // Ensure the shouldBe calls don't trigger layouts during our testing. |
| setPrintTestResultsLazily(); |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| window.jsTestIsAsync = true; |
| } |
| |
| var overlay; |
| function addOverlay() { |
| var testContainer = document.getElementById('test-container'); |
| overlay = document.createElement('div'); |
| overlay.id='overlay'; |
| testContainer.appendChild(overlay); |
| } |
| |
| // Can't do anything useful here without eventSender |
| if (window.eventSender) { |
| var target = document.getElementById('target'); |
| eventSender.dragMode = false; |
| debug('Mouse move'); |
| var rect = target.getBoundingClientRect(); |
| eventSender.mouseMoveTo(rect.left + 3, rect.top + 3); |
| shouldBeEqualToString('internals.getCurrentCursorInfo()', 'type=IBeam hotSpot=0,0'); |
| debug('Adding overlay element'); |
| addOverlay(); |
| expectSendFakeMouseMove('type=Wait hotSpot=0,0', function() { |
| debug('Moving overlay element'); |
| overlay.style.top = "100px"; |
| expectSendFakeMouseMove('type=IBeam hotSpot=0,0', function() { |
| finishJSTest(); |
| }); |
| }); |
| } else { |
| testFailed('This test requires DumpRenderTree. Click to manually update layout.'); |
| document.addEventListener('click', addOverlay); |
| } |
| |
| </script> |