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"); |
61 } | 65 } |
62 | 66 |
63 private void requestCursorUpdates(final int cursorUpdateMode) { | 67 private void requestCursorUpdates(final int cursorUpdateMode) { |
64 final InputConnection connection = mConnection; | 68 final InputConnection connection = mConnection; |
65 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 69 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
66 @Override | 70 @Override |
67 public void run() { | 71 public void run() { |
68 connection.requestCursorUpdates(cursorUpdateMode); | 72 connection.requestCursorUpdates(cursorUpdateMode); |
69 } | 73 } |
70 }); | 74 }); |
(...skipping 10 matching lines...) Expand all Loading... |
81 return false; | 85 return false; |
82 } | 86 } |
83 | 87 |
84 String actual = (info == null ? "" : info.getComposingText().toS
tring()); | 88 String actual = (info == null ? "" : info.getComposingText().toS
tring()); |
85 updateFailureReason("Expected: {" + expected + "}, Actual: {" +
actual + "}"); | 89 updateFailureReason("Expected: {" + expected + "}, Actual: {" +
actual + "}"); |
86 return expected.equals(actual); | 90 return expected.equals(actual); |
87 } | 91 } |
88 }); | 92 }); |
89 } | 93 } |
90 } | 94 } |
OLD | NEW |