Chromium Code Reviews| Index: LayoutTests/fast/events/mouse-cursor-style-change-iframe.html |
| diff --git a/LayoutTests/fast/events/mouse-cursor-style-change-iframe.html b/LayoutTests/fast/events/mouse-cursor-style-change-iframe.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7e47cf6b94b6035ef16d5ebcfbfaea256080cde1 |
| --- /dev/null |
| +++ b/LayoutTests/fast/events/mouse-cursor-style-change-iframe.html |
| @@ -0,0 +1,82 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/js-test.js"></script> |
| +<style type="text/css"> |
| + #container { |
| + padding: 30px; |
| + cursor: pointer; |
| + border: 1px solid blue; |
| + } |
| + .wait { |
| + cursor: wait !important; |
| + } |
| + iframe { |
| + width: 300px; |
| + } |
| +</style> |
| +</head> |
| +<body> |
| +<p id="description"></p> |
| +<div id="container"> |
| + <iframe id=frame srcdoc="<body style='height: 500px; cursor: text;'></body>"></iframe> |
|
bokan
2015/05/01 15:55:56
Nit: frame -> "frame"
Rick Byers
2015/05/01 17:26:47
Done.
|
| +</div> |
| +<div id="console"></div> |
| +<script> |
| + var CURSOR_UPDATE_DELAY = 50; |
|
bokan
2015/05/01 15:55:56
It looks like we need this delay because the curso
Rick Byers
2015/05/01 17:26:47
Done.
|
| + |
| + description("Test that a cursor change that occurs due only to a style change correctly considers iframes."); |
| + |
| + if (!window.eventSender) { |
| + testFailed('This test requires DumpRenderTree'); |
| + } |
| + |
| + if (window.testRunner) { |
| + testRunner.dumpAsText(); |
| + testRunner.waitUntilDone(); |
| + window.jsTestIsAsync = true; |
| + } |
| + |
| + var container = document.getElementById('container'); |
| + |
| + var y; |
| + var frame; |
| + |
| + if (window.eventSender) { |
| + debug('Mouse moved to cursor changing div'); |
| + eventSender.mouseMoveTo(100, container.offsetTop + 5); |
| + debug('Cursor Info: ' + window.internals.getCurrentCursorInfo(document)); |
| + shouldBeEqualToString('window.internals.getCurrentCursorInfo(document)', 'type=Hand hotSpot=0,0'); |
| + |
| + debug('Changing cursor style'); |
| + container.classList.add('wait'); |
| + setTimeout(function() { |
| + shouldBeEqualToString('window.internals.getCurrentCursorInfo(document)', 'type=Wait hotSpot=0,0'); |
| + debug(''); |
| + |
| + debug('Now move mouse onto iframe above cursor changing div'); |
| + frame = document.getElementById('frame'); |
| + y = frame.offsetTop + 10; |
| + eventSender.mouseMoveTo(100, y); |
| + eventSender.mouseMoveTo(101, y); |
|
bokan
2015/05/01 15:55:56
Why the 1px move?
Rick Byers
2015/05/01 17:26:47
Whoops, that was leftover from trying to diagnose
|
| + shouldBe('document.elementFromPoint(100, y)', 'frame'); |
| + shouldBeTrue('document.elementsFromPoint(100, y).indexOf(container) > 0'); |
| + shouldBeEqualToString('window.internals.getCurrentCursorInfo(document)', 'type=IBeam hotSpot=0,0'); |
| + debug(''); |
| + |
| + debug('Changing cursor style of the background should not affect the cursor as it sits over the iframe'); |
| + container.classList.remove('wait'); |
| + setTimeout(function() { |
| + shouldBeEqualToString('window.internals.getCurrentCursorInfo(document)', 'type=IBeam hotSpot=0,0'); |
| + finishJSTest(); |
| + }, CURSOR_UPDATE_DELAY); |
| + }, CURSOR_UPDATE_DELAY); |
| + |
| + } else { |
| + function toggleCursorInMainFrame() { |
| + container.classList.toggle('cursor'); |
| + requestAnimationFrame(toggleCursorInMainFrame); |
| + } |
| + requestAnimationFrame(toggleCursorInMainFrame); |
| + } |
| +</script> |
| +</body> |
| +</html> |