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

Unified Diff: third_party/WebKit/LayoutTests/fast/hidpi/static/gesture-scroll-amount.html

Issue 1754033002: ScrollableArea::pixelStep should return DIP not viewport (physical pixels) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: 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>

Powered by Google App Engine
This is Rietveld 408576698