| Index: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
|
| index c931600cd206190a7f6b75ae2c69beb930b47502..74a05d1a851f05658a15e37b34f92647ca0a3ea1 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
|
| @@ -1326,28 +1326,43 @@ public class ImeTest extends ContentShellTestBase {
|
| }));
|
| }
|
|
|
| - // Tests that the method call order is kept.
|
| - // See crbug.com/601707 for details.
|
| + // Tests that the method call order is kept and get updates correctly.
|
| + // crbug.com/601707, crbug.com/643473
|
| @MediumTest
|
| @Feature({"TextInput"})
|
| + @CommandLineFlags.Add("enable-features=ImeThread")
|
| public void testSetSelectionCommitTextOrder() throws Exception {
|
| final ChromiumBaseInputConnection connection = mConnection;
|
| - runBlockingOnImeThread(new Callable<Void>() {
|
| + CharSequence interimResult = runBlockingOnImeThread(new Callable<CharSequence>() {
|
| @Override
|
| - public Void call() {
|
| + public CharSequence call() {
|
| + connection.commitText("hi ", 1);
|
| connection.beginBatchEdit();
|
| connection.commitText("hello world", 1);
|
| - connection.setSelection(6, 6);
|
| - connection.deleteSurroundingText(0, 5);
|
| + connection.setSelection(9, 9);
|
| + connection.deleteSurroundingText(3, 8);
|
| connection.commitText("'", 1);
|
| connection.commitText("world", 1);
|
| - connection.setSelection(7, 7);
|
| + connection.setSelection(10, 10);
|
| connection.setComposingText("", 1);
|
| + CharSequence text = connection.getTextBeforeCursor(20, 0);
|
| connection.endBatchEdit();
|
| - return null;
|
| + return text;
|
| }
|
| });
|
| - waitAndVerifyUpdateSelection(0, 7, 7, -1, -1);
|
| + // get* methods in the middle of batch edit will give results based on the states
|
| + // *before* entering the batch edit.
|
| + assertEquals("hi ", interimResult);
|
| + waitAndVerifyUpdateSelection(0, 3, 3, -1, -1);
|
| + waitAndVerifyUpdateSelection(1, 10, 10, -1, -1);
|
| +
|
| + // get* methods *after* batch edit should give results that reflect the batch edit.
|
| + assertEquals("hi hel'wor", runBlockingOnImeThread(new Callable<CharSequence>() {
|
| + @Override
|
| + public CharSequence call() throws Exception {
|
| + return connection.getTextBeforeCursor(20, 0);
|
| + }
|
| + }));
|
| }
|
|
|
| private void performGo(TestCallbackHelperContainer testCallbackHelperContainer)
|
|
|