summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authoraurimas@chromium.org <aurimas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-17 12:24:33 +0000
committeraurimas@chromium.org <aurimas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-17 12:24:33 +0000
commitd3b18b6aa11aaa023b31d0f2707af6c63e8e87a3 (patch)
treea1640ad91269b565cdbe4e1091f04eb07de316c2 /content
parentf665dd0ab00a0e26af1fc8c4e128c98b8b5ec316 (diff)
downloadchromium_src-d3b18b6aa11aaa023b31d0f2707af6c63e8e87a3.zip
chromium_src-d3b18b6aa11aaa023b31d0f2707af6c63e8e87a3.tar.gz
chromium_src-d3b18b6aa11aaa023b31d0f2707af6c63e8e87a3.tar.bz2
Changing Autofill implementation for android.
Changing Autofill implementation to better match gtk linux implementation. BUG=160593 Review URL: https://chromiumcodereview.appspot.com/11364179 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TouchCommon.java37
1 files changed, 35 insertions, 2 deletions
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TouchCommon.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TouchCommon.java
index c99ff5b..70b046d 100644
--- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TouchCommon.java
+++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TouchCommon.java
@@ -118,6 +118,29 @@ public class TouchCommon {
}
/**
+ * Sends (synchronously) a single click on the specified relative coordinates inside
+ * a given view.
+ *
+ * @param view The view to be clicked.
+ * @param x screen absolute
+ * @param y screen absolute
+ * @see TouchUtils
+ */
+ public void singleClickViewRelative(View view, int x, int y) {
+ long downTime = SystemClock.uptimeMillis();
+ long eventTime = SystemClock.uptimeMillis();
+
+ MotionEvent event = MotionEvent.obtain(downTime, eventTime,
+ MotionEvent.ACTION_DOWN, x, y, 0);
+ dispatchTouchEvent(view, event);
+
+ eventTime = SystemClock.uptimeMillis();
+ event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP,
+ x, y, 0);
+ dispatchTouchEvent(view, event);
+ }
+
+ /**
* Sends (synchronously) a long press to an absolute screen coordinates.
*
* @param x screen absolute
@@ -164,8 +187,18 @@ public class TouchCommon {
* @param event
*/
private void dispatchTouchEvent(final MotionEvent event) {
- final View view = mActivityTestCase.getActivity().findViewById(
- android.R.id.content).getRootView();
+ View view =
+ mActivityTestCase.getActivity().findViewById(android.R.id.content).getRootView();
+ dispatchTouchEvent(view, event);
+ }
+
+ /**
+ * Send a MotionEvent to the specified view instead of the root view.
+ * For example AutofillPopup window that is above the root view.
+ * @param view The view that should receive the event.
+ * @param event The view to be dispatched.
+ */
+ private void dispatchTouchEvent(final View view, final MotionEvent event) {
try {
mActivityTestCase.runTestOnUiThread(new Runnable() {
@Override