Chromium Code Reviews| Index: LayoutTests/fast/events/panScroll-nested-divs-forbidden.html |
| diff --git a/LayoutTests/fast/events/panScroll-nested-divs-forbidden.html b/LayoutTests/fast/events/panScroll-nested-divs-forbidden.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..866db120f09c05785ec60f04b96fda50ec825146 |
| --- /dev/null |
| +++ b/LayoutTests/fast/events/panScroll-nested-divs-forbidden.html |
| @@ -0,0 +1,116 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<style type="text/css"> |
| +div { |
| + line-height: 50px; |
| +} |
| +#outerdiv { |
| + overflow:auto; |
| + border: 2px solid #000FFF; |
| +} |
| +#innerdiv { |
| + overflow:auto; |
| + border: 2px solid #000000; |
| + width: 120%; |
| + padding: 5px; |
| +} |
| +</style> |
| +<script> |
| +function $(id) { return document.getElementById(id); } |
| + |
| +function finishTest() { |
| + // Check that there was a horizontal scroll. |
| + if (didScrollHorizontally) |
| + testPassed('Outer div was scrolled horizontally.'); |
| + else |
| + testFailed('Outer div was not scrolled horizontally.'); |
| + |
| + // Check that there was no vertical scroll. |
| + if (didScrollVertically) |
| + testFailed('Outer div was scrolled vertically.'); |
| + else |
| + testPassed('Outer div was not scrolled vertically.'); |
| + |
| + window.testRunner.notifyDone(); |
| +} |
| + |
| +var didScrollHorizontally; |
| +var didScrollVertically; |
| + |
| +function testIt() { |
| + var outerdiv = $('outerdiv'); |
| + didScrollHorizontally = false; |
| + didScrollVertically = false; |
| + |
| + // Check that the outer div has not been scrolled vertically. |
| + if (outerdiv.scrollTop) |
|
yosin_UTC9
2013/05/14 01:40:05
nit: these check are redundant. We don't need to v
tdanderson
2013/05/16 17:34:52
OK, removed.
|
| + testFailed('outerdiv.scrollTop != 0 before the pan scroll.'); |
| + else |
| + testPassed('outerdiv.scrollTop == 0 before the pan scroll.'); |
| + |
| + // Check that the outer div has not been scrolled horizontally. |
| + if (outerdiv.scrollLeft) |
| + testFailed('outerdiv.scrollLeft != 0 before the pan scroll.'); |
| + else |
| + testPassed('outerdiv.scrollLeft == 0 before the pan scroll.'); |
| + |
| + // Attempt a digonal pan scroll originating in the inner div. |
| + eventSender.mouseMoveTo(150, 150); |
| + eventSender.mouseDown(1); |
| + eventSender.mouseUp(1); |
| + eventSender.mouseMoveTo(225, 75); |
| + |
| + var retryCount = 0; |
| + |
| + function checkScrolled() |
| + { |
| + if (outerdiv.scrollLeft) |
| + didScrollHorizontally = true; |
| + |
| + if (outerdiv.scrollTop) |
| + didScrollVertically = true; |
| + |
| + testPassed('retryCount is ' + retryCount); |
| + ++retryCount; |
| + if (retryCount > 10) { |
|
yosin_UTC9
2013/05/14 01:40:05
We don't need to iterate 10 times for fast machine
tdanderson
2013/05/16 17:34:52
Done. Thanks a lot for the clarification.
|
| + finishTest(); |
| + return; |
| + } |
| + |
| + window.setTimeout(checkScrolled, 50); |
| + } |
| + |
| + checkScrolled(); |
| +} |
| + |
| +function setUpTest() |
| +{ |
| + if (!window.eventSender) { |
| + console.log('Please run within DumpRenderTree.'); |
| + return; |
| + } |
| + |
| + window.jsTestIsAsync = false; |
|
yosin_UTC9
2013/05/14 01:40:05
should be window.jsTestIsAsync = true and
don't ca
tdanderson
2013/05/16 17:34:52
Done.
|
| + window.setTimeout(testIt, 0); |
| + testRunner.waitUntilDone(); |
| +} |
| +</script> |
| +</head> |
| +<body> |
| +<div id="outerdiv"> |
| + <p>Top of outer div.</p> |
| + <div id="innerdiv"> |
| + <p>Inner div.</p> |
| + </div> |
| + <p>Bottom of outer div.</p> |
| +</div> |
| +<p>Test for <a href="http://crbug.com/232965">bug 232965</a> This tests that vertical pan scrolling does not propagate from the inner div to the outer div when the outer div has no vertical overflow.</p> |
| +<div id="console"></div> |
| +<script src="../js/resources/js-test-pre.js"></script> |
| +<script> |
| +setUpTest(); |
| +</script> |
| +<script src="../js/resources/js-test-post.js"></script> |
| +</body> |
| +</html> |