Commit 43363a69 authored by Ted Choc's avatar Ted Choc Committed by Commit Bot

Deflake the IME tests on Kitkat Tablet devices

The underlying problem is how Chrome determines what action
mode should be shown on long press.  If you long press on
whitespace, then just the paste popup is shown.  If you long
press on text, then cut/copy/paste is shown.

On these test devices, it simply happened to touch on whitespace
where other devices would touch on the text based on the offsets
calculated.

This changes the bulk of the tests to not have whitespace at
all to avoid this.  For testLongPressInputWhileComposingText, it
just makes the first portion of the text very long to avoid the
mismatch (not fool proof, but better).

BUG=907573

Change-Id: I87fabd8d6fcc8a532976e2abe028e60664e3c7f5
Reviewed-on: https://chromium-review.googlesource.com/c/1353953Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611876}
parent fb32107d
......@@ -280,10 +280,11 @@ class ImeActivityTestRule extends ContentShellActivityTestRule {
}
});
Pair<Range, Range> selection = states.get(index);
Assert.assertEquals(selectionStart, selection.first.start());
Assert.assertEquals(selectionEnd, selection.first.end());
Assert.assertEquals(compositionStart, selection.second.start());
Assert.assertEquals(compositionEnd, selection.second.end());
Assert.assertEquals("Mismatched selection start", selectionStart, selection.first.start());
Assert.assertEquals("Mismatched selection end", selectionEnd, selection.first.end());
Assert.assertEquals(
"Mismatched composition start", compositionStart, selection.second.start());
Assert.assertEquals("Mismatched composition end", compositionEnd, selection.second.end());
}
void resetUpdateSelectionList() {
......
......@@ -578,7 +578,7 @@ public class ImeTest {
@SmallTest
@Feature({"TextInput"})
public void testKeyboardNotDismissedAfterCopySelection() throws Exception {
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
mRule.waitAndVerifyUpdateSelection(0, 11, 11, -1, -1);
// Select 'text' part.
......@@ -588,7 +588,7 @@ public class ImeTest {
mRule.selectAll();
mRule.copy();
mRule.assertClipboardContents(mRule.getActivity(), "Sample Text");
mRule.assertClipboardContents(mRule.getActivity(), "Sample_Text");
Assert.assertEquals(11, mRule.getInputMethodManagerWrapper().getSelection().end());
mRule.assertWaitForKeyboardStatus(true);
}
......@@ -597,7 +597,7 @@ public class ImeTest {
@SmallTest
@Feature({"TextInput"})
public void testImeNotDismissedAfterCutSelection() throws Exception {
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
mRule.waitAndVerifyUpdateSelection(0, 11, 11, -1, -1);
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
mRule.assertWaitForSelectActionBarStatus(true);
......@@ -614,7 +614,7 @@ public class ImeTest {
DOMUtils.focusNode(mRule.getWebContents(), "input_radio");
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
mRule.assertWaitForKeyboardStatus(false);
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
mRule.assertWaitForKeyboardStatus(true);
}
......@@ -625,7 +625,7 @@ public class ImeTest {
public void testSelectActionBarShownOnLongPressingInput() throws Exception {
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
mRule.assertWaitForSelectActionBarStatus(false);
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
mRule.assertWaitForSelectActionBarStatus(true);
}
......@@ -635,21 +635,21 @@ public class ImeTest {
@Feature({"TextInput"})
public void testLongPressInputWhileComposingText() throws Exception {
mRule.assertWaitForSelectActionBarStatus(false);
mRule.setComposingText("Sample Text", 1);
mRule.waitAndVerifyUpdateSelection(0, 11, 11, 0, 11);
mRule.setComposingText("SampleTextThatIsVeryLong Test", 1);
mRule.waitAndVerifyUpdateSelection(0, 29, 29, 0, 29);
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
mRule.assertWaitForSelectActionBarStatus(true);
// Long press will first change selection region, and then trigger IME app to show up.
// See RenderFrameImpl::didChangeSelection() and RenderWidget::didHandleGestureEvent().
mRule.waitAndVerifyUpdateSelection(1, 7, 11, 0, 11);
mRule.waitAndVerifyUpdateSelection(1, 0, 24, 0, 29);
// Now IME app wants to finish composing text because an external selection
// change has been detected. At least Google Latin IME and Samsung IME
// behave this way.
mRule.finishComposingText();
mRule.waitAndVerifyUpdateSelection(2, 7, 11, -1, -1);
mRule.waitAndVerifyUpdateSelection(2, 0, 24, -1, -1);
}
@Test
......@@ -657,7 +657,7 @@ public class ImeTest {
@Feature({"TextInput"})
public void testImeShownWhenLongPressOnAlreadySelectedText() throws Exception {
mRule.assertWaitForSelectActionBarStatus(false);
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
int showCount = mRule.getInputMethodManagerWrapper().getShowSoftInputCounter();
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
......@@ -722,7 +722,7 @@ public class ImeTest {
@SmallTest
@Feature({"TextInput"})
public void testSelectActionBarClearedOnTappingInput() throws Exception {
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
mRule.assertWaitForKeyboardStatus(true);
mRule.assertWaitForSelectActionBarStatus(true);
......@@ -734,7 +734,7 @@ public class ImeTest {
@SmallTest
@Feature({"TextInput"})
public void testSelectActionBarClearedOnTappingOutsideInput() throws Exception {
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
mRule.assertWaitForKeyboardStatus(true);
mRule.assertWaitForSelectActionBarStatus(true);
......@@ -768,14 +768,14 @@ public class ImeTest {
DOMUtils.focusNode(mRule.getWebContents(), "input_text");
mRule.assertWaitForKeyboardStatus(true);
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
// We should wait to avoid race condition.
mRule.waitAndVerifyUpdateSelection(0, 11, 11, -1, -1);
DOMUtils.focusNode(mRule.getWebContents(), "textarea");
mRule.waitAndVerifyUpdateSelection(1, 0, 0, -1, -1);
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
mRule.waitAndVerifyUpdateSelection(2, 11, 11, -1, -1);
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
......@@ -1321,7 +1321,7 @@ public class ImeTest {
@SmallTest
@Feature({"TextInput"})
public void testSelectionClearedOnKeyEvent() throws Throwable {
mRule.commitText("Sample Text", 1);
mRule.commitText("Sample_Text", 1);
mRule.waitAndVerifyUpdateSelection(0, 11, 11, -1, -1);
DOMUtils.longPressNode(mRule.getWebContents(), "input_text");
......
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