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

Unified Diff: LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html

Issue 882813005: Respect the smooth scrolling setting in LayerScrollableArea. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 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: LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html
diff --git a/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html b/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html
new file mode 100644
index 0000000000000000000000000000000000000000..a88a2b79f3f4605999b213d809ac23d3fd2862fc
--- /dev/null
+++ b/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html
@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<style>
+
+#container {
+ width: 200px;
+ height: 200px;
+ overflow: scroll;
+}
+
+#content {
+ width: 7500px;
+ height: 7500px;
+ background-color: blue;
+}
+
+</style>
+<script src="../../resources/js-test.js"></script>
+<div id="container">
+ <div id="content"></div>
+</div>
+<div id="console"></div>
+<script>
+
+jsTestIsAsync = true;
+element = document.getElementById("container");
+
+var testConfigs = [
+ {preciseDeltas: false, expectSmooth: true},
+ {preciseDeltas: true, expectSmooth: false},
+];
+var config;
+var waitingForScroll = false;
+var scrollStart, scrollDuration;
+
+function nextConfig() {
+ config = testConfigs.shift();
+ if (!config)
+ finishJSTest();
+
+ element.addEventListener("scroll", onElementScroll);
+
+ eventSender.mouseMoveTo(100, 100);
+ eventSender.mouseScrollBy(0, -2, /* paged */ false,
+ config.preciseDeltas);
+ scrollStart = performance.now();
+}
+
+function reset() {
+ element.removeEventListener("scroll", onElementScroll);
+ element.scrollTop = 0;
+ waitingForScroll = false;
+}
+
+function onElementScroll() {
+ if (waitingForScroll) {
+ if (element.scrollTop == 80) {
+ scrollDuration = performance.now() - scrollStart;
+ shouldBeTrue("scrollDuration < 500");
+ reset();
+ nextConfig();
+ }
+ } else if (config.expectSmooth) {
+ shouldNotBe("element.scrollTop", "80");
+ waitingForScroll = true;
+ } else {
+ shouldBe("element.scrollTop", "80");
+ reset();
+ nextConfig();
+ }
+}
+
+function runTest() {
+ internals.settings.setScrollAnimatorEnabled(true);
+ nextConfig();
+}
+
+description("Tests that overflow scrolls are animated, unless the wheel " +
+ "event has precise scrolling deltas.");
+
+if (window.eventSender)
+ runTest();
+else
+ debug("FAIL: This test requires window.eventSender.");
+
+</script>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/scroll-behavior/overflow-scroll-animates-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698