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

Unified Diff: LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.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-consume-deltas-throw.html
diff --git a/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html b/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html
new file mode 100644
index 0000000000000000000000000000000000000000..7f44f5849510def34ee6cfc70c79d469e0744ba5
--- /dev/null
+++ b/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>ScrollState's consumeDelta method throws on invalid deltas</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();
+}
+
+function testConsumingDelta(dx, dy, consume_x, consume_y, testName, expectedError) {
+ test(function() {
+ var scrollState = new ScrollState(dx, dy);
+ assert_throws('InvalidModificationError', function() {
+ scrollState.consumeDelta(consume_x, consume_y);
+ });
+ }, testName);
+}
+
+// Consume from an event with a delta of (5, 5).
+testConsumingDelta(5, 5, 6, 4, "Overconsumed X");
+testConsumingDelta(5, 5, 4, 6, "Overconsumed Y");
+testConsumingDelta(5, 5, -1, 4, "Can't increase X delta");
+testConsumingDelta(5, 5, 4, -1, "Can't increase Y delta");
+
+// Consume from an event with a delta of (-5, -5).
+testConsumingDelta(-5, -5, -6, -4, "Overconsumed X with negative delta");
+testConsumingDelta(-5, -5, -4, -6, "Overconsumed Y with negative delta");
+testConsumingDelta(-5, -5, 1, -4, "Can't increase X delta magnitude");
+testConsumingDelta(-5, -5, -4, 1, "Can't increase Y delta magnitude");
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698