| Index: content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionTest.java
|
| diff --git a/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionTest.java b/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionTest.java
|
| index 124e3259f300fd0b7d7993d50870ee54bdd92f72..689249d8fd9b6f0503b377373ea23d043abe0214 100644
|
| --- a/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionTest.java
|
| +++ b/content/public/android/junit/src/org/chromium/content/browser/input/ThreadedInputConnectionTest.java
|
| @@ -122,15 +122,23 @@ public class ThreadedInputConnectionTest {
|
| @Test
|
| @Feature({"TextInput"})
|
| public void testBatchEdit() {
|
| + // Type 'hello'.
|
| + assertTrue(mConnection.commitText("hello ", 1));
|
| // IME app calls beginBatchEdit().
|
| assertTrue(mConnection.beginBatchEdit());
|
| - // Type hello real fast.
|
| - mConnection.commitText("hello", 1);
|
| - mInOrder.verify(mImeAdapter).sendCompositionToNative("hello", 1, true, 0);
|
| + // Type 'world'.
|
| + assertTrue(mConnection.commitText("world", 1));
|
| +
|
| + mInOrder.verify(mImeAdapter).sendCompositionToNative("hello ", 1, true, 0);
|
| + mInOrder.verify(mImeAdapter).notifyUserAction();
|
| + mInOrder.verify(mImeAdapter).beginBatchEdit();
|
| + mInOrder.verify(mImeAdapter).sendCompositionToNative("world", 1, true, 0);
|
| + mInOrder.verify(mImeAdapter).notifyUserAction();
|
|
|
| // Renderer updates states asynchronously.
|
| - mConnection.updateStateOnUiThread("hello", 5, 5, -1, -1, true, true);
|
| - mInOrder.verify(mImeAdapter, never()).updateSelection(5, 5, -1, -1);
|
| + mConnection.updateStateOnUiThread("hello ", 6, 6, -1, -1, true, true);
|
| + mInOrder.verify(mImeAdapter).updateSelection(6, 6, -1, -1);
|
| + mInOrder.verify(mImeAdapter, never()).updateSelection(11, 11, -1, -1);
|
| assertEquals(0, mConnection.getQueueForTest().size());
|
|
|
| {
|
| @@ -143,16 +151,15 @@ public class ThreadedInputConnectionTest {
|
| // We still have one outer batch edit, so should not update selection yet.
|
| mInOrder.verify(mImeAdapter, never()).updateSelection(4, 4, -1, -1);
|
|
|
| - // Prepare to call requestTextInputStateUpdate.
|
| - mConnection.updateStateOnUiThread("hello", 4, 4, -1, -1, true, false);
|
| - assertEquals(1, mConnection.getQueueForTest().size());
|
| - when(mImeAdapter.requestTextInputStateUpdate()).thenReturn(true);
|
| -
|
| // IME app calls endBatchEdit().
|
| assertFalse(mConnection.endBatchEdit());
|
| +
|
| + mInOrder.verify(mImeAdapter).endBatchEdit();
|
| // Batch edit is finished, now update selection.
|
| + mConnection.updateStateOnUiThread("hello world", 4, 4, -1, -1, true, true);
|
| mInOrder.verify(mImeAdapter).updateSelection(4, 4, -1, -1);
|
| assertEquals(0, mConnection.getQueueForTest().size());
|
| + mInOrder.verifyNoMoreInteractions();
|
| }
|
|
|
| @Test
|
|
|