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

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 test expectation for Mac failure 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 | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/scroll-behavior/sub-frame-scroll-expected.txt » ('j') | no next file with comments »
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..a9ea204f6304de80d224715327b03c4c10350d39
--- /dev/null
+++ b/LayoutTests/fast/scroll-behavior/sub-frame-scroll.html
@@ -0,0 +1,82 @@
+<!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>
+ <script>
+ if (window.internals) {
+ window.internals.settings.setScrollAnimatorEnabled(true);
+ }
+
+ setup({explicit_done:true});
+ </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.
+ */
+
+ function testing() {
+ var div = document.getElementById("scroll");
+ // Generate what end position should be if there is no smooth scrolling.
+ var endPosition = (function() {
+ if (window.internals) {
+ window.internals.settings.setScrollAnimatorEnabled(false);
+ }
+ div.scrollByPages(10);
+
+ if (window.internals) {
+ window.internals.settings.setScrollAnimatorEnabled(true);
+ }
+ return div.scrollTop;
+ }) ();
+
+ // Test that div is scrollable and reset scrollTop to 0.
+ test(function() {div.scrollTop = 0; assert_equals(div.scrollTop, 0)}, "Reset scrollable area to starting point.");
+
+ var smoothScrollTest = async_test("Smooth scrolling is on for non mainframe scrollbars.");
+ // Test that checks scrollTop is between start and end.
+ var testFunc = smoothScrollTest.step_func(function() {
+ var cur = div.scrollTop;
+ assert_greater_than(cur, 0, "Scrolling has started.");
+ assert_less_than(cur, endPosition, "Scrolling hasn't ended.");
+ smoothScrollTest.done();
+ done();
+ });
+ // In the middle of scroll animation, scrollTop should be between start and end position.
+ div.onscroll = window.setTimeout(testFunc, 200);
+
+ div.scrollByPages(10);
+
+ // If there is no smooth scrolling, test times out. Explicitly ends test so it would show up as fail.
+ window.setTimeout(function() {
+ smoothScrollTest.done();
+ done();
+ }, 1000);
+ }
+
+ window.addEventListener('load', testing, false);
+ </script>
+ </body>
+</html>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/scroll-behavior/sub-frame-scroll-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698