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

Unified Diff: third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/cancel-user-scroll.html

Issue 1553003002: Fix Mac overlay scrollbars to show when programmatically scrolled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test expectation Created 4 years, 10 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
Index: third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/cancel-user-scroll.html
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/cancel-user-scroll.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/cancel-user-scroll.html
new file mode 100644
index 0000000000000000000000000000000000000000..dfb5fc166c3d37b654944f6aa55b205506160111
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/cancel-user-scroll.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<head>
+ <script src="../../../resources/js-test.js"></script>
+ <style>
+ #spacer {
+ height: 10000px;
+ width: 10000px;
+ }
+ </style>
+ <script>
+ function failTest(why) {
+ testFailed(why);
+ if (testRunner)
+ testRunner.notifyDone();
+ }
+
+ function execInNRafs(n, func) {
+ var count = n;
+ var rafCall = function() {
+ count--;
+ if (count <= 0)
+ func();
+ else
+ requestAnimationFrame(rafCall);
+ };
+
+ requestAnimationFrame(rafCall);
+ }
+
+ internals.settings.setScrollAnimatorEnabled(true);
+ internals.settings.setMockScrollbarsEnabled(false);
+
+ if (testRunner) {
+ testRunner.waitUntilDone();
+ }
+
+ onload = function() {
+ var checkScroll = function() {
+ shouldBe('window.scrollY', '0');
+ testRunner.notifyDone();
+ }
+
+ var numScrolls = 0;
+ window.addEventListener('scroll', function() {
+ ++numScrolls;
+ if (numScrolls == 2) {
+ // This programmatic scroll should cancel the user scroll.
+ window.scrollTo(0, 0);
+ } else if (numScrolls == 3) {
+ // End the test a small delay and check that we haven't scrolled
+ // any more after that delay.
+ shouldBe('window.scrollY', '0');
+ execInNRafs(10, checkScroll);
+ } else if (numScrolls > 3) {
+ // Fail if we receive any more scrolls.
+ failTest('Continued user scroll after programmatic scroll.');
+ }
+ });
+
+ window.eventSender.keyDown('end');
+ };
+ </script>
+</head>
+
+<body>
+ <div id="spacer"></div>
+</body>

Powered by Google App Engine
This is Rietveld 408576698