| Index: LayoutTests/fast/scroll-behavior/sub-frame-scroll.html
|
| diff --git a/LayoutTests/fast/scroll-behavior/sub-frame-scroll.html b/LayoutTests/fast/scroll-behavior/sub-frame-scroll.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..74367419aa44a79b8d191096250b7532cd890a53
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/scroll-behavior/sub-frame-scroll.html
|
| @@ -0,0 +1,69 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| + <head>
|
| + <style>
|
| + #scroll {
|
| + width: 100px;
|
| + height: 100px;
|
| + overflow:scroll;
|
| + }
|
| +
|
| + #content {
|
| + width: 10000px;
|
| + height: 10000px;
|
| + background-color: blue;
|
| + }
|
| + </style>
|
| + <script src="../../resources/testharness.js"></script>
|
| + <script src="../../resources/testharnessreport.js"></script>
|
| + </head>
|
| + <body>
|
| + <div id="scroll">
|
| + <div id="content"></div>
|
| + </div>
|
| + <script>
|
| + /**
|
| + * This test is to make sure smooth scrolling is turned on sub frame
|
| + * scrollbars.
|
| + * Actually animation and calculation is tested by unittest. This only
|
| + * test that non main frame scrollbars can scroll and they are not just
|
| + * snapping to the correct position when smooth scrolling is on.
|
| + */
|
| + if (window.internals) {
|
| + window.internals.settings.setScrollAnimatorEnabled(true);
|
| + }
|
| +
|
| + function testing() {
|
| + var div = document.getElementById("scroll");
|
| +
|
| + test(function() {assert_equals(div.scrollTop, 0)}, "Test starting point");
|
| + test(function() {div.scrollByLines(10); assert_not_equals(div.scrollTop, 0)}, "Test div is able to scroll");
|
| + test(function() {div.scrollTop = 0; assert_equals(div.scrollTop, 0)}, "Reset to starting point");
|
| +
|
| + var smoothScrollTest = async_test('smooth scrolls');
|
| + var info = {
|
| + pos: 0,
|
| + step: 0
|
| + };
|
| +
|
| + div.onscroll = smoothScrollTest.step_func(function() {
|
| + var cur = div.scrollTop;
|
| + if (info.step != 0) {
|
| + assert_true(cur > pos);
|
| + }
|
| + info.pos = cur;
|
| + info.step += 1;
|
| + });
|
| +
|
| + test(function() {
|
| + div.scrollByPages(50);
|
| + assert_greater_than(info.step, 1);
|
| + assert_greater_than(div.scrollTop, 0);
|
| + }, "scroll");
|
| + smoothScrollTest.done();
|
| + }
|
| +
|
| + window.addEventListener('load', testing, false);
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|