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

Side by Side Diff: LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.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: Address skobes' nits. 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>ScrollState's consumeDelta method throws on invalid deltas</title> 4 <title>ScrollState's consumeDelta method throws on invalid deltas</title>
5 <script src="../../../resources/testharness.js"></script> 5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script> 6 <script src="../../../resources/testharnessreport.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10 10
11 if (!window.internals || !window.internals.runtimeFlags.scrollCustomizationEnabl ed) { 11 test(function() {
12 console.log("These tests only work with window.internals exposed, " + 12 assert_true('ScrollState' in window, "'ScrollState' in window");
13 "and require scroll customization."); 13 }, "These tests only work with scroll customization enabled.");
14 done();
15 }
16 14
17 function testConsumingDelta(dx, dy, consume_x, consume_y, testName, expectedErro r) { 15 function testConsumingDelta(dx, dy, consume_x, consume_y, testName, expectedErro r) {
18 test(function() { 16 test(function() {
19 var scrollState = new ScrollState(dx, dy); 17 var scrollState = new ScrollState(dx, dy);
20 assert_throws('InvalidModificationError', function() { 18 assert_throws('InvalidModificationError', function() {
21 scrollState.consumeDelta(consume_x, consume_y); 19 scrollState.consumeDelta(consume_x, consume_y);
22 }); 20 });
23 assert_equals(scrollState.deltaX, dx); 21 assert_equals(scrollState.deltaX, dx);
24 assert_equals(scrollState.deltaY, dy); 22 assert_equals(scrollState.deltaY, dy);
25 }, testName); 23 }, testName);
26 } 24 }
27 25
28 // Consume from an event with a delta of (5, 5). 26 if ('ScrollState' in window) {
29 testConsumingDelta(5, 5, 6, 4, "Overconsumed X"); 27 // Consume from an event with a delta of (5, 5).
30 testConsumingDelta(5, 5, 4, 6, "Overconsumed Y"); 28 testConsumingDelta(5, 5, 6, 4, "Overconsumed X");
31 testConsumingDelta(5, 5, -1, 4, "Can't increase X delta"); 29 testConsumingDelta(5, 5, 4, 6, "Overconsumed Y");
32 testConsumingDelta(5, 5, 4, -1, "Can't increase Y delta"); 30 testConsumingDelta(5, 5, -1, 4, "Can't increase X delta");
31 testConsumingDelta(5, 5, 4, -1, "Can't increase Y delta");
33 32
34 // Consume from an event with a delta of (-5, -5). 33 // Consume from an event with a delta of (-5, -5).
35 testConsumingDelta(-5, -5, -6, -4, "Overconsumed X with negative delta"); 34 testConsumingDelta(-5, -5, -6, -4, "Overconsumed X with negative delta");
36 testConsumingDelta(-5, -5, -4, -6, "Overconsumed Y with negative delta"); 35 testConsumingDelta(-5, -5, -4, -6, "Overconsumed Y with negative delta");
37 testConsumingDelta(-5, -5, 1, -4, "Can't increase X delta magnitude"); 36 testConsumingDelta(-5, -5, 1, -4, "Can't increase X delta magnitude");
38 testConsumingDelta(-5, -5, -4, 1, "Can't increase Y delta magnitude"); 37 testConsumingDelta(-5, -5, -4, 1, "Can't increase Y delta magnitude");
38 }
39 </script> 39 </script>
40 </body> 40 </body>
41 </html> 41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698