Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Unified Diff: LayoutTests/fast/scroll-behavior/sub-frame-scroll.html

Issue 214953004: Enable Scroll Animation for RenderLayerScrollableArea (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add Layout test Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/page/PageAnimator.cpp » ('j') | Source/core/page/PageAnimator.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | Source/core/page/PageAnimator.cpp » ('j') | Source/core/page/PageAnimator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698