Index: third_party/WebKit/LayoutTests/fast/hidpi/static/gesture-scroll-amount.html |
diff --git a/third_party/WebKit/LayoutTests/fast/hidpi/static/gesture-scroll-amount.html b/third_party/WebKit/LayoutTests/fast/hidpi/static/gesture-scroll-amount.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..80c1fc725f87f048165c80f0587a3e12382bd1f7 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/hidpi/static/gesture-scroll-amount.html |
@@ -0,0 +1,86 @@ |
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
+<script src="../../../resources/js-test.js"></script> |
+<style type="text/css"> |
+ body { |
+ height: 2000px; |
+ width: 2000px; |
+ } |
+</style> |
+<script> |
+ |
+var expectedScrollsTotal = 2; |
+var scrollsOccurred = 0; |
+var scrollAmountX = ['1', '3']; |
+var scrollAmountY = ['1', '3']; |
+/* TODO(oshima): Move the scaling to eventSender */ |
+var dpr = window.devicePixelRatio; |
+ |
+function checkScrollOffset() |
+{ |
+ if (window.eventSender) { |
+ shouldBe('document.scrollingElement.scrollTop', scrollAmountY[scrollsOccurred]); |
+ shouldBe('document.scrollingElement.scrollLeft', scrollAmountX[scrollsOccurred]); |
+ scrollsOccurred++; |
+ } |
+ |
+ if (scrollsOccurred == expectedScrollsTotal) { |
+ // If we've got here, we've passed. |
+ isSuccessfullyParsed(); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+ } else { |
+ secondGestureScrollSequence(); |
+ } |
+} |
+ |
+function firstGestureScrollSequence() |
+{ |
+ debug("first gesture"); |
+ |
+ eventSender.gestureScrollBegin(50, 50); |
+ eventSender.gestureScrollUpdate(-dpr, -dpr); |
+ eventSender.gestureScrollEnd(0, 0); |
+ |
+ // Wait for layout. |
+ checkScrollOffset(); |
+} |
+ |
+function secondGestureScrollSequence() |
+{ |
+ debug("second gesture"); |
+ |
+ eventSender.gestureScrollBegin(50, 50); |
+ eventSender.gestureScrollUpdate(-2 * dpr, -2 * dpr); |
+ eventSender.gestureScrollEnd(0, 0); |
+ |
+ // Wait for layout. |
+ checkScrollOffset(); |
+} |
+ |
+function exitIfNecessary() |
+{ |
+ debug('Gesture events not implemented on this platform or broken'); |
+ isSuccessfullyParsed(); |
+ if (window.testRunner) |
+ testRunner.notifyDone(); |
+} |
+ |
+if (window.testRunner) |
+ testRunner.waitUntilDone(); |
+ |
+function runTest() |
+{ |
+ if (window.eventSender) { |
+ description('This test ensures that touch gesture scrolls ' + |
+ 'the right amount pixels in high dpi mode.'); |
+ |
+ if (eventSender.clearTouchPoints) |
+ firstGestureScrollSequence(); |
+ else |
+ exitIfNecessary(); |
+ } else { |
+ debug("This test requires eventSender."); |
+ } |
+} |
+</script> |
+<body onload="runTest()"></body> |