14 background-color: blue;
17 <script src="../../resources/testharness.js"></script>
18 <script src="../../resources/testharnessreport.js"></script>
20 if (window.internals) {
21 window.internals.settings.setScrollAnimatorEnabled(true);
24 setup({explicit_done:true});
29 <div id="content"></div>
33 * This test is to make sure smooth scrolling is turned on sub frame
35 * Actually animation and calculation is tested by unittest. This only
36 * test that non main frame scrollbars can scroll and they are not just
37 * snapping to the correct position when smooth scrolling is on.
41 var div = document.getElementById("scroll");
42 // Generate what end position should be if there is no smooth scrolling.
43 var endPosition = (function() {
44 if (window.internals) {
45 window.internals.settings.setScrollAnimatorEnabled(false);
47 div.scrollByPages(10);
49 if (window.internals) {
50 window.internals.settings.setScrollAnimatorEnabled(true);
55 // Test that div is scrollable and reset scrollTop to 0.
56 test(function() {div.scrollTop = 0; assert_equals(div.scrollTop, 0)}, "Reset scrollable area to starting point.");
58 var smoothScrollTest = async_test("Smooth scrolling is on for non mainframe scrollbars.");
59 // Test that checks scrollTop is between start and end.
60 var testFunc = smoothScrollTest.step_func(function() {
61 var cur = div.scrollTop;
62 assert_greater_than(cur, 0, "Scrolling has started.");
63 assert_less_than(cur, endPosition, "Scrolling hasn't ended.");
64 smoothScrollTest.done();
67 // In the middle of scroll animation, scrollTop should be between start and end position.
68 div.onscroll = window.setTimeout(testFunc, 200);
70 div.scrollByPages(10);
72 // If there is no smooth scrolling, test times out. Explicitly ends test so it would show up as fail.
73 window.setTimeout(function() {
74 smoothScrollTest.done();
79 window.addEventListener('load', testing, false);