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

Side by Side Diff: LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html

Issue 1239993005: Revert of Expose scroll customization for touch to JS (behind REF). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 test(function() { 11 if (!window.internals || !window.internals.runtimeFlags.scrollCustomizationEnabl ed) {
12 assert_true('ScrollState' in window, "'ScrollState' in window"); 12 console.log("These tests only work with window.internals exposed, " +
13 }, "These tests only work with scroll customization enabled."); 13 "and require scroll customization.");
14 done();
15 }
14 16
15 function testConsumingDelta(dx, dy, consume_x, consume_y, testName, expectedErro r) { 17 function testConsumingDelta(dx, dy, consume_x, consume_y, testName, expectedErro r) {
16 test(function() { 18 test(function() {
17 var scrollState = new ScrollState(dx, dy); 19 var scrollState = new ScrollState(dx, dy);
18 assert_throws('InvalidModificationError', function() { 20 assert_throws('InvalidModificationError', function() {
19 scrollState.consumeDelta(consume_x, consume_y); 21 scrollState.consumeDelta(consume_x, consume_y);
20 }); 22 });
21 assert_equals(scrollState.deltaX, dx); 23 assert_equals(scrollState.deltaX, dx);
22 assert_equals(scrollState.deltaY, dy); 24 assert_equals(scrollState.deltaY, dy);
23 }, testName); 25 }, testName);
24 } 26 }
25 27
26 if ('ScrollState' in window) { 28 // Consume from an event with a delta of (5, 5).
27 // Consume from an event with a delta of (5, 5). 29 testConsumingDelta(5, 5, 6, 4, "Overconsumed X");
28 testConsumingDelta(5, 5, 6, 4, "Overconsumed X"); 30 testConsumingDelta(5, 5, 4, 6, "Overconsumed Y");
29 testConsumingDelta(5, 5, 4, 6, "Overconsumed Y"); 31 testConsumingDelta(5, 5, -1, 4, "Can't increase X delta");
30 testConsumingDelta(5, 5, -1, 4, "Can't increase X delta"); 32 testConsumingDelta(5, 5, 4, -1, "Can't increase Y delta");
31 testConsumingDelta(5, 5, 4, -1, "Can't increase Y delta");
32 33
33 // Consume from an event with a delta of (-5, -5). 34 // Consume from an event with a delta of (-5, -5).
34 testConsumingDelta(-5, -5, -6, -4, "Overconsumed X with negative delta"); 35 testConsumingDelta(-5, -5, -6, -4, "Overconsumed X with negative delta");
35 testConsumingDelta(-5, -5, -4, -6, "Overconsumed Y with negative delta"); 36 testConsumingDelta(-5, -5, -4, -6, "Overconsumed Y with negative delta");
36 testConsumingDelta(-5, -5, 1, -4, "Can't increase X delta magnitude"); 37 testConsumingDelta(-5, -5, 1, -4, "Can't increase X delta magnitude");
37 testConsumingDelta(-5, -5, -4, 1, "Can't increase Y delta magnitude"); 38 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