Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-layoutObject.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-layoutObject.html b/third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-layoutObject.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9464be5c348497121d9665919eb36767892bb983 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-layoutObject.html |
| @@ -0,0 +1,81 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<div id = "div" style="overflow: auto; width: 1400px"> |
| +<table style="height:2000px; width: 1800px"> |
| + <tbody> |
| + <tr style="height: 2000px"> |
| + <td style="width: 600px; height: 2000px">first</td> |
| + <td style="width: 1200px; height: 2000px"> |
| + <iframe style="width: 1000px; height: 2000px" src="resources/middleClickAutoscroll-iframe.html"></iframe> |
| + </td> |
| + </tr> |
| + </tbody> |
| +</table> |
| +</div> |
| +<script> |
| +var testBubble = async_test("Tests that middleClickAutoscroll finds the correct ancestor layoutobject when starting in an unscrollable direction.") |
| +testBubble.step(function() { |
| + if (!window.eventSender) |
| + return; |
| + var startx = 100; |
|
bokan
2016/11/09 15:34:10
It's hard to tell where you're clicking from the r
|
| + var starty = 100; |
| + var endx = 100; |
| + var endy = 200; |
| + eventSender.mouseMoveTo(startx, starty); |
| + eventSender.mouseDown(1); |
| + eventSender.mouseUp(1); |
| + eventSender.mouseMoveTo(endx, endy) |
|
bokan
2016/11/09 15:34:10
I would also add a followup horizontal scroll to t
|
| + |
| + |
| + var animationFrameCount = 0; |
| + var animation = function () { |
| + animationFrameCount++; |
| + if (animationFrameCount == 30) { |
| + eventSender.mouseDown(1); |
| + eventSender.mouseUp(1); |
| + assert_not_equals(window.scrollY, 0); |
| + testIFrame(); |
| + testBubble.done(); |
| + } |
| + else { |
| + window.requestAnimationFrame(animation); |
| + } |
| + }; |
| + window.requestAnimationFrame(animation); |
| +}); |
| + |
| +function testIFrame() { |
| + |
| +var testIFrame = async_test("Tests that middleClickAutoscroll finds the correct ancestor layoutobject when starting in an iframe, and the latching is correctly implemented.") |
| +testIFrame.step(function() { |
| + if (!window.eventSender) |
| + return; |
| + var startx = 650; |
| + var starty = 500; |
| + var endx = 750; |
| + var endy = 500; |
| + eventSender.mouseMoveTo(startx, starty); |
| + eventSender.mouseDown(1); |
| + eventSender.mouseUp(1); |
| + eventSender.mouseMoveTo(endx, endy) |
| + |
| + |
| + var animationFrameCount = 0; |
| + var animation = function () { |
| + animationFrameCount++; |
| + var div = document.getElementById("div"); |
| + if (animationFrameCount == 30) { |
| + eventSender.mouseDown(1); |
| + eventSender.mouseUp(1); |
|
bokan
2016/11/09 15:34:10
Is this Down/Up needed?
|
| + assert_not_equals(div.scrollLeft, 0); |
| + assert_equals(window.scrollX, 0); |
| + testIFrame.done(); |
| + } else { |
| + window.requestAnimationFrame(animation); |
| + } |
| + }; |
| + window.requestAnimationFrame(animation); |
| +}); |
| +} |
| +</script> |