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

Unified Diff: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TouchCommon.java

Issue 11090050: [Android] Restore the previous behaviour of TouchCommon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | « content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TouchCommon.java
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 757fd21980f857862e21a21a4475c611537417d6..c99ff5b08d45907a178d00b12089213d3227aa89 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
@@ -4,22 +4,23 @@
package org.chromium.content.browser.test.util;
-import android.app.Activity;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
-
-import org.chromium.content.browser.test.util.UiUtils;
+import android.test.ActivityInstrumentationTestCase2;
/**
* Touch-related functionality reused across test cases.
*/
public class TouchCommon {
- private Activity mActivity;
+ private ActivityInstrumentationTestCase2 mActivityTestCase;
- public TouchCommon(Activity activity) {
- mActivity = activity;
+ // TODO(leandrogracia): This method should receive and use an activity
+ // instead of the ActivityInstrumentationTestCase2. However this is causing
+ // problems downstream. Any fix for this should be landed downstream first.
+ public TouchCommon(ActivityInstrumentationTestCase2 activityTestCase) {
+ mActivityTestCase = activityTestCase;
}
/**
@@ -132,7 +133,8 @@ public class TouchCommon {
MotionEvent.ACTION_DOWN, x, y, 0);
dispatchTouchEvent(event);
- int longPressTimeout = ViewConfiguration.get(mActivity).getLongPressTimeout();
+ int longPressTimeout = ViewConfiguration.get(
+ mActivityTestCase.getActivity()).getLongPressTimeout();
// Long press is flaky with just longPressTimeout. Doubling the time to be safe.
SystemClock.sleep(longPressTimeout * 2);
@@ -162,9 +164,10 @@ public class TouchCommon {
* @param event
*/
private void dispatchTouchEvent(final MotionEvent event) {
- final View view = mActivity.findViewById(android.R.id.content).getRootView();
+ final View view = mActivityTestCase.getActivity().findViewById(
+ android.R.id.content).getRootView();
try {
- UiUtils.runOnUiThread(mActivity, new Runnable() {
+ mActivityTestCase.runTestOnUiThread(new Runnable() {
@Override
public void run() {
view.dispatchTouchEvent(event);
« no previous file with comments | « content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698