Index: third_party/WebKit/LayoutTests/fast/events/selection-autoscroll-borderbelt.html |
diff --git a/third_party/WebKit/LayoutTests/fast/events/selection-autoscroll-borderbelt.html b/third_party/WebKit/LayoutTests/fast/events/selection-autoscroll-borderbelt.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..57f66abbf0dfd73a29da64d56f4b3324e9a541e2 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/events/selection-autoscroll-borderbelt.html |
@@ -0,0 +1,57 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<body> |
bokan
2016/09/19 21:13:18
Nit: no <body> tag
|
+For manual testing, Select some text and drag the mouse close to the bottom |
+(do not reach the border) before releasing. |
+ <div id="scrollable" style="height: 100px; overflow: auto; border: solid 3px #cc0000"> |
+ <p>This is a very long sentence to take up some space.</p> |
+ <p>This is a very long sentence to take up some space.</p> |
+ <p>This is a very long sentence to take up some space.</p> |
+ <p>This is a very long sentence to take up some space.</p> |
+ <p>This is a very long sentence to take up some space.</p> |
+ <p>This is a very long sentence to take up some space.</p> |
+ <p>This is a very long sentence to take up some space.</p> |
+ <p>This is a very long sentence to take up some space.</p> |
+ <p>This is a very long sentence to take up some space.</p> |
+ <p>This is a very long sentence to take up some space.</p> |
+ </div> |
+</body> |
+<script> |
+var scrollable = document.getElementById("scrollable"); |
+var retryCount = 0; |
+var testAutoscroll = async_test('Selection-autoscroll should be triggered when the mouse is within the border belt'); |
+testAutoscroll.step(function() { |
+ function checkScrolled() { |
+ console.log(scrollable.scrollTop); |
bokan
2016/09/19 21:13:18
Please remove the logging output.
|
+ if (scrollable.scrollTop > 0) { |
+ testAutoscroll.done(); |
+ return; |
+ } |
+ ++retryCount; |
+ if (retryCount > 4) { |
+ assert_true(false); |
+ testAutoscroll.done(); |
+ return; |
+ } |
+ // Autoscroll is occurred evey 0.05 sec. |
bokan
2016/09/19 21:13:18
Where does this constant come from? I see Autoscro
|
+ window.setTimeout(checkScrolled, 50); |
bokan
2016/09/19 21:13:18
We generally avoid using window.setTimeout in test
|
+ return; |
+ } |
+ |
+ if (!window.eventSender) |
+ return; |
+ |
+ var dragStartX = scrollable.offsetLeft + 20; |
+ var dragStartY = scrollable.offsetTop + 5; |
+ var dragEndX = dragStartX; |
+ var dragEndY = scrollable.offsetTop + scrollable.offsetHeight - 10; |
+ |
+ eventSender.dragMode = false; |
+ eventSender.mouseMoveTo(dragStartX, dragStartY); |
+ eventSender.mouseDown(); |
+ eventSender.mouseMoveTo(dragEndX, dragEndY); |
+ |
+ checkScrolled(); |
+}); |
+</script> |