Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / scroll-behavior / scroll-customization / scrollstate-consume-deltas-throw.html
blob5345dde11a23279992cf95b53e79927075b08dd8
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ScrollState's consumeDelta method throws on invalid deltas</title>
5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <script>
11 test(function() {
12 assert_true('ScrollState' in window, "'ScrollState' in window");
13 }, "These tests only work with scroll customization enabled.");
15 function testConsumingDelta(dx, dy, consume_x, consume_y, testName, expectedError) {
16 test(function() {
17 var scrollState = new ScrollState(dx, dy);
18 assert_throws('InvalidModificationError', function() {
19 scrollState.consumeDelta(consume_x, consume_y);
20 });
21 assert_equals(scrollState.deltaX, dx);
22 assert_equals(scrollState.deltaY, dy);
23 }, testName);
26 if ('ScrollState' in window) {
27 // Consume from an event with a delta of (5, 5).
28 testConsumingDelta(5, 5, 6, 4, "Overconsumed X");
29 testConsumingDelta(5, 5, 4, 6, "Overconsumed Y");
30 testConsumingDelta(5, 5, -1, 4, "Can't increase X delta");
31 testConsumingDelta(5, 5, 4, -1, "Can't increase Y delta");
33 // 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, -4, -6, "Overconsumed Y with negative delta");
36 testConsumingDelta(-5, -5, 1, -4, "Can't increase X delta magnitude");
37 testConsumingDelta(-5, -5, -4, 1, "Can't increase Y delta magnitude");
39 </script>
40 </body>
41 </html>