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

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

Issue 1209183004: Expose scroll customization for touch to JS (behind REF). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Clean up static map. Created 5 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>ScrollState constructor behaves correctly</title>
6 <script src="../../../resources/testharness.js"></script>
7 <script src="../../../resources/testharnessreport.js"></script>
8 </head>
9 <body>
10 <script>
11 test(function() {
12 assert_true('ScrollState' in window, "'ScrollState' in window");
13 // TODO(tdresser): Don't rely on window.internals. See crbug.com/483091 for de tails.
14 assert_true(window.internals !== null, "'ScrollState' in window");
15 }, "These tests only work with scroll customization enabled.");
16
17 var elementCount = 10;
18 var remainingNumberOfTimesToBeCalled = elementCount;
19
20 var distributeScroll = function(scrollState) {
21 this.calledOrder = elementCount - remainingNumberOfTimesToBeCalled;
22 remainingNumberOfTimesToBeCalled--;
23 scrollState.distributeToScrollChainDescendant();
24 }
25
26 var elements = [];
27 for (var i = 0; i < elementCount; ++i) {
28 var element = document.createElement("div");
29 element.creationOrder = i;
30 element.setDistributeScroll(distributeScroll.bind(element), "disable-native-sc roll");
31 elements.push(element);
32 }
33
34 if ('ScrollState' in window && window.internals) {
35 test(function() {
36 var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false);
37 window.internals.setScrollChain(scrollState, elements);
38 scrollState.distributeToScrollChainDescendant();
39 assert_equals(0, remainingNumberOfTimesToBeCalled);
40 for (var i = 0; i < elementCount; ++i) {
41 assert_equals(elements[i].creationOrder, elements[i].calledOrder);
42 }
43 }, "distributeToScrollChainDescendant propagates correctly.");
44
45 test(function() {
46 var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false);
47 window.internals.setScrollChain(scrollState, []);
48 assert_equals(0, remainingNumberOfTimesToBeCalled);
49 scrollState.distributeToScrollChainDescendant();
50 assert_equals(0, remainingNumberOfTimesToBeCalled);
51 }, "distributeToScrollChainDescendant with empty scroll chain does nothing.");
52 }
53 </script>
54 </body>
55 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698