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

Unified Diff: LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html

Issue 850443002: Scroll Customization Prototype (Not for review, WIP) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase / cleanup / minor bug fixes 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/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html
diff --git a/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html b/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html
new file mode 100644
index 0000000000000000000000000000000000000000..e2cbe609338750c6b3926bfbb8eddca7e05163ee
--- /dev/null
+++ b/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>ScrollState constructor behaves correctly</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<script>
+
+if (!window.internals || !window.internals.runtimeFlags.scrollCustomizationEnabled) {
+ console.log("These tests only work with window.internals exposed, " +
+ "and require scroll customization.");
+ done();
+}
+
+var elementCount = 10;
+var remainingNumberOfTimesToBeCalled = elementCount;
+
+var distributeScroll = function(scrollState) {
+ this.calledOrder = elementCount - remainingNumberOfTimesToBeCalled;
+ remainingNumberOfTimesToBeCalled--;
+ scrollState.distributeToScrollChainDescendant();
+}
+
+var elements = [];
+for (var i = 0; i < elementCount; ++i) {
+ var element = document.createElement("div");
+ element.creationOrder = i;
+ element.distributeScroll = distributeScroll;
+ elements.push(element);
+}
+
+test(function() {
+ var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false);
+ window.internals.setScrollChain(scrollState, elements);
+ scrollState.distributeToScrollChainDescendant();
+ assert_equals(0, remainingNumberOfTimesToBeCalled);
+ for (var i = 0; i < elementCount; ++i)
+ assert_equals(elements[i].creationOrder, elements[i].calledOrder);
+}, "distributeToScrollChainDescendant propagates correctly.");
+
+test(function() {
+ var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false);
+ window.internals.setScrollChain(scrollState, []);
+ assert_equals(0, remainingNumberOfTimesToBeCalled);
+ scrollState.distributeToScrollChainDescendant();
+ assert_equals(0, remainingNumberOfTimesToBeCalled);
+}, "distributeToScrollChainDescendant with empty scroll chain does nothing.");
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698