| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser.input; | 5 package org.chromium.content.browser.input; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 import android.test.suitebuilder.annotation.MediumTest; | 9 import android.test.suitebuilder.annotation.MediumTest; |
| 10 import android.view.inputmethod.CursorAnchorInfo; | 10 import android.view.inputmethod.CursorAnchorInfo; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // In "IMMEDIATE" mode, even when there's no change, we should be notifi
ed at least once. | 52 // In "IMMEDIATE" mode, even when there's no change, we should be notifi
ed at least once. |
| 53 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 53 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 54 @Override | 54 @Override |
| 55 public void run() { | 55 public void run() { |
| 56 mInputMethodManagerWrapper.clearLastCursorAnchorInfo(); | 56 mInputMethodManagerWrapper.clearLastCursorAnchorInfo(); |
| 57 } | 57 } |
| 58 }); | 58 }); |
| 59 requestCursorUpdates(InputConnection.CURSOR_UPDATE_IMMEDIATE); | 59 requestCursorUpdates(InputConnection.CURSOR_UPDATE_IMMEDIATE); |
| 60 waitForUpdateCursorAnchorInfoComposingText("abcd"); | 60 waitForUpdateCursorAnchorInfoComposingText("abcd"); |
| 61 | |
| 62 setComposingText("abcde", 2); | |
| 63 requestCursorUpdates(InputConnection.CURSOR_UPDATE_IMMEDIATE); | |
| 64 waitForUpdateCursorAnchorInfoComposingText("abcde"); | |
| 65 } | 61 } |
| 66 | 62 |
| 67 private void requestCursorUpdates(final int cursorUpdateMode) { | 63 private void requestCursorUpdates(final int cursorUpdateMode) { |
| 68 final InputConnection connection = mConnection; | 64 final InputConnection connection = mConnection; |
| 69 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 65 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 70 @Override | 66 @Override |
| 71 public void run() { | 67 public void run() { |
| 72 connection.requestCursorUpdates(cursorUpdateMode); | 68 connection.requestCursorUpdates(cursorUpdateMode); |
| 73 } | 69 } |
| 74 }); | 70 }); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 85 return false; | 81 return false; |
| 86 } | 82 } |
| 87 | 83 |
| 88 String actual = (info == null ? "" : info.getComposingText().toS
tring()); | 84 String actual = (info == null ? "" : info.getComposingText().toS
tring()); |
| 89 updateFailureReason("Expected: {" + expected + "}, Actual: {" +
actual + "}"); | 85 updateFailureReason("Expected: {" + expected + "}, Actual: {" +
actual + "}"); |
| 90 return expected.equals(actual); | 86 return expected.equals(actual); |
| 91 } | 87 } |
| 92 }); | 88 }); |
| 93 } | 89 } |
| 94 } | 90 } |
| OLD | NEW |