Commit 1c82afee authored by Matt Jones's avatar Matt Jones Committed by Commit Bot

Deflake TabsTest#testTabSwitcherCollapseSelection

This patch attempts to deflake more TabsTest tests by using the new
TouchCommon infra and loading new tabs via the test rule. The test
was run 100 times locally without flaking.

Bug: 799728
Change-Id: Ic26b9fb5c25d911d13a0a6280357c91eef32985a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2134652Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756409}
parent bdf04d9f
......@@ -406,11 +406,8 @@ public class TabsTest {
float dragEndX = size.x * endX;
float dragStartY = size.y * startY;
float dragEndY = size.y * endY;
long downTime = SystemClock.uptimeMillis();
TouchCommon.dragStart(mActivityTestRule.getActivity(), dragStartX, dragStartY, downTime);
TouchCommon.dragTo(mActivityTestRule.getActivity(), dragStartX, dragEndX, dragStartY,
dragEndY, stepCount, downTime);
TouchCommon.dragEnd(mActivityTestRule.getActivity(), dragEndX, dragEndY, downTime);
TouchCommon.performDrag(mActivityTestRule.getActivity(), dragStartX, dragEndX, dragStartY,
dragEndY, stepCount, 250);
}
private void scrollDown() {
......@@ -425,12 +422,9 @@ public class TabsTest {
@MediumTest
@Restriction(UiRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Android-TabSwitcher"})
@RetryOnFailure
@DisabledTest(message = "crbug.com/799728")
public void testTabSwitcherCollapseSelection() throws Exception {
mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext());
ChromeTabUtils.fullyLoadUrlInNewTab(InstrumentationRegistry.getInstrumentation(),
mActivityTestRule.getActivity(), mTestServer.getURL(TEST_FILE_PATH), false);
mActivityTestRule.loadUrlInNewTab(mTestServer.getURL(TEST_FILE_PATH), false);
DOMUtils.longPressNode(mActivityTestRule.getWebContents(), "textarea");
assertWaitForSelectedText("helloworld");
......
......@@ -71,6 +71,23 @@ public class TouchCommon {
downTime, eventTime, MotionEvent.ACTION_UP, windowXY[0], windowXY[1], 0));
}
/**
* Synchronously perform a start-to-end drag event on the specified view with deterministic
* timing (events do not use system time).
*
* @param activity The main activity to dispatch events to.
* @param fromX X coordinate of the initial touch, in screen coordinates.
* @param toX X coordinate of the drag destination, in screen coordinates.
* @param fromY X coordinate of the initial touch, in screen coordinates.
* @param toY Y coordinate of the drag destination, in screen coordinates.
* @param stepCount How many move steps to include in the drag.
* @param duration The amount of time that will be simulated for the event stream in ms.
*/
public static void performDrag(Activity activity, float fromX, float toX, float fromY,
float toY, int stepCount, long duration) {
performDrag(getRootViewForActivity(activity), fromX, toX, fromY, toY, stepCount, duration);
}
/**
* Starts (synchronously) a drag motion. Normally followed by dragTo() and dragEnd().
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment