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

Unified Diff: android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/ScrollByAction.java

Issue 2349663003: Adding WebView select tests to test select element's dropdown menu (Closed)
Patch Set: use BaseJUnit4ClassRunner Created 4 years, 1 month 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: android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/ScrollByAction.java
diff --git a/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/ScrollByAction.java b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/ScrollByAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..6e89f5947e6608af7887a2c7c62376ca40865e68
--- /dev/null
+++ b/android_webview/tools/automated_ui_tests/javatests/src/org/chromium/webview_ui_test/test/util/ScrollByAction.java
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
the real yoland 2016/11/15 01:45:44 maybe put this under webview_ui_test/test/util/act
aluo 2016/11/18 00:22:30 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+package org.chromium.webview_ui_test.test;
mikecase (-- gone --) 2016/11/15 00:50:49 nit: add empty line above the package line
aluo 2016/11/18 00:22:30 Done.
+
+import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
+import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
+import static android.support.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
+
+import static org.hamcrest.Matchers.allOf;
+
+import android.support.test.espresso.UiController;
+import android.support.test.espresso.ViewAction;
+import android.support.test.espresso.matcher.ViewMatchers;
+import android.view.View;
+
+import org.hamcrest.Matcher;
+
+/**
+ * A ViewAction to scroll a view
+ */
+public class ScrollByAction implements ViewAction {
+ Integer mX, mY;
mikecase (-- gone --) 2016/11/15 00:50:49 nit: I think you should prefer using primitives ov
aluo 2016/11/18 00:22:30 Done.
+
+ public ScrollByAction(int x, int y) {
+ mX = x;
+ mY = y;
+ }
+
+ @Override
+ public Matcher<View> getConstraints() {
+ return allOf(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE),
the real yoland 2016/11/15 01:45:44 hmm, since these are all used on WebView, maybe se
aluo 2016/11/18 00:22:30 This action will work on any view.
+ isDescendantOfA(isAssignableFrom(View.class)));
+ }
+
+ @Override
+ public String getDescription() {
+ return "scroll by: " + mX + "," + mY;
+ }
+
+ /**
+ * Performs scroll by action then waits for completion.
+ *
+ * @param uiController the controller to use to interact with the UI.
+ * @param view the view to act upon. never null.
mikecase (-- gone --) 2016/11/15 00:50:49 same as other View action comment. MAybe mention i
aluo 2016/11/18 00:22:30 Done.
+ */
+ @Override
+ public void perform(UiController uiController, View view) {
+ view.scrollBy(mX, mY);
+ uiController.loopMainThreadUntilIdle();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698