Commit 37c0c94c authored by amaralp's avatar amaralp Committed by Commit bot

Make ImeTest wait for insertion handle to be shown

The Ime test, testPastePopupShowAndHide, was flaking because of a race condition
where the paste popup menu was shown before the insertion handle was shown. This
is a problem because it allows the scenario:

1) Paste menu shown
2) Set composition
3) Insertion handle is shown

This causes the paste menu to not be hidden since setting the composition only
clears the menu by clearing the insertion handle. This CL makes setting the
composition wait for the insertion handle to be shown to guarantee this sequence:

1) Paste menu and insertion handle shown
2) Set composition
3) Insertion handle cleared
4) Paste menu hidden

BUG=661572

Review-Url: https://codereview.chromium.org/2617583003
Cr-Commit-Position: refs/heads/master@{#441971}
parent 64657dda
...@@ -22,7 +22,6 @@ import android.view.inputmethod.EditorInfo; ...@@ -22,7 +22,6 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnection;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils; import org.chromium.base.test.util.UrlUtils;
import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.ContentViewCore;
...@@ -1118,7 +1117,6 @@ public class ImeTest extends ContentShellTestBase { ...@@ -1118,7 +1117,6 @@ public class ImeTest extends ContentShellTestBase {
@SmallTest @SmallTest
@Feature({"TextInput"}) @Feature({"TextInput"})
@DisabledTest(message = "crbug.com/661572")
public void testPastePopupShowAndHide() throws Throwable { public void testPastePopupShowAndHide() throws Throwable {
commitText("hello", 1); commitText("hello", 1);
waitAndVerifyUpdateSelection(0, 5, 5, -1, -1); waitAndVerifyUpdateSelection(0, 5, 5, -1, -1);
...@@ -1135,7 +1133,8 @@ public class ImeTest extends ContentShellTestBase { ...@@ -1135,7 +1133,8 @@ public class ImeTest extends ContentShellTestBase {
CriteriaHelper.pollUiThread(new Criteria() { CriteriaHelper.pollUiThread(new Criteria() {
@Override @Override
public boolean isSatisfied() { public boolean isSatisfied() {
return mSelectionPopupController.isPastePopupShowing(); return mSelectionPopupController.isPastePopupShowing()
&& mSelectionPopupController.isInsertion();
} }
}); });
......
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