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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java

Issue 602873002: Prevent orthogonal fling accumulation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup Created 6 years, 3 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
« no previous file with comments | « no previous file | content/renderer/input/input_handler_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java
index e5c147d9d7c3bfb007cc62d4995e0971c5318b8b..bece9a2d95d654c370f60290c5baab77f5c05cdb 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java
@@ -19,7 +19,7 @@ import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content_shell_apk.ContentShellTestBase;
-/*
+/**
* Tests that we can scroll and fling a ContentView running inside ContentShell.
*/
public class ContentViewScrollingTest extends ContentShellTestBase {
@@ -152,24 +152,30 @@ public class ContentViewScrollingTest extends ContentShellTestBase {
@SmallTest
@Feature({"Main"})
public void testFling() throws Throwable {
+ // Scaling the initial velocity by the device scale factor ensures that
+ // it's of sufficient magnitude for all displays densities.
+ float deviceScaleFactor =
+ getInstrumentation().getTargetContext().getResources().getDisplayMetrics().density;
+ int velocity = (int) (1000 * deviceScaleFactor);
+
// Vertical fling to lower-left.
- fling(0, -1000);
+ fling(0, -velocity);
assertWaitForScroll(true, false);
// Horizontal fling to lower-right.
- fling(-1000, 0);
+ fling(-velocity, 0);
assertWaitForScroll(false, false);
// Vertical fling to upper-right.
- fling(0, 1000);
+ fling(0, velocity);
assertWaitForScroll(false, true);
// Horizontal fling to top-left.
- fling(1000, 0);
+ fling(velocity, 0);
assertWaitForScroll(true, true);
// Diagonal fling to bottom-right.
- fling(-1000, -1000);
+ fling(-velocity, -velocity);
assertWaitForScroll(false, false);
}
« no previous file with comments | « no previous file | content/renderer/input/input_handler_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698