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

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

Issue 1131723006: [Android] Implement scrollTo in terms of scrollBy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 7 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: 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 b76e81e6d98f4807b19b509890646667965a9c3c..aee0be173365cffa8a9ddecca93cdde5a2c0c653 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
@@ -136,6 +136,15 @@ public class ContentViewScrollingTest extends ContentShellTestBase {
});
}
+ private void scrollBy(final int dx, final int dy) throws Throwable {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ getContentViewCore().getContainerView().scrollBy(dx, dy);
+ }
+ });
+ }
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -181,7 +190,7 @@ public class ContentViewScrollingTest extends ContentShellTestBase {
@SmallTest
@RerunWithUpdatedContainerView
@Feature({"Main"})
- public void testScroll() throws Throwable {
+ public void testScrollTo() throws Throwable {
// Vertical scroll to lower-left.
scrollTo(0, 2500);
assertWaitForScroll(true, false);
@@ -203,6 +212,38 @@ public class ContentViewScrollingTest extends ContentShellTestBase {
assertWaitForScroll(false, false);
}
+ @SmallTest
+ @RerunWithUpdatedContainerView
+ @Feature({"Main"})
+ public void testScrollBy() throws Throwable {
+ scrollTo(0, 0);
+ assertWaitForScroll(true, true);
+
+ // No scroll
+ scrollBy(0, 0);
+ assertWaitForScroll(true, true);
+
+ // Vertical scroll to lower-left.
+ scrollBy(0, 2500);
+ assertWaitForScroll(true, false);
+
+ // Horizontal scroll to lower-right.
+ scrollBy(2500, 0);
+ assertWaitForScroll(false, false);
+
+ // Vertical scroll to upper-right.
+ scrollBy(0, -2500);
+ assertWaitForScroll(false, true);
+
+ // Horizontal scroll to top-left.
+ scrollBy(-2500, 0);
+ assertWaitForScroll(true, true);
+
+ // Diagonal scroll to bottom-right.
+ scrollBy(2500, 2500);
+ assertWaitForScroll(false, false);
+ }
+
/**
* To ensure the device properly responds to bounds-exceeding scrolls, e.g., overscroll
* effects are properly initialized.

Powered by Google App Engine
This is Rietveld 408576698