OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.test.util; | 5 package org.chromium.content.browser.test.util; |
6 | 6 |
7 import android.os.IBinder; | 7 import android.os.IBinder; |
8 import android.os.ResultReceiver; | 8 import android.os.ResultReceiver; |
9 import android.view.View; | 9 import android.view.View; |
10 import android.view.inputmethod.EditorInfo; | 10 import android.view.inputmethod.EditorInfo; |
11 import android.view.inputmethod.InputConnection; | 11 import android.view.inputmethod.InputConnection; |
12 | 12 |
13 import org.chromium.content.browser.ContentViewCore; | 13 import org.chromium.content.browser.ContentViewCore; |
| 14 import org.chromium.content.browser.input.CursorAnchorInfoWrapper; |
14 import org.chromium.content.browser.input.InputMethodManagerWrapper; | 15 import org.chromium.content.browser.input.InputMethodManagerWrapper; |
15 | 16 |
16 public class TestInputMethodManagerWrapper extends InputMethodManagerWrapper { | 17 public class TestInputMethodManagerWrapper extends InputMethodManagerWrapper { |
17 private final ContentViewCore mContentViewCore; | 18 private final ContentViewCore mContentViewCore; |
18 private InputConnection mInputConnection; | 19 private InputConnection mInputConnection; |
19 private int mShowSoftInputCounter = 0; | 20 private int mShowSoftInputCounter = 0; |
20 private int mUpdateSelectionCounter = 0; | 21 private int mUpdateSelectionCounter = 0; |
| 22 private int mUpdateCursorAnchorInfoCounter = 0; |
21 private EditorInfo mEditorInfo; | 23 private EditorInfo mEditorInfo; |
| 24 private CursorAnchorInfoWrapper mLastCursorAnchortInfo; |
22 | 25 |
23 public TestInputMethodManagerWrapper(ContentViewCore contentViewCore) { | 26 public TestInputMethodManagerWrapper(ContentViewCore contentViewCore) { |
24 super(null); | 27 super(null); |
25 mContentViewCore = contentViewCore; | 28 mContentViewCore = contentViewCore; |
26 } | 29 } |
27 | 30 |
28 @Override | 31 @Override |
29 public void restartInput(View view) { | 32 public void restartInput(View view) { |
30 mEditorInfo = new EditorInfo(); | 33 mEditorInfo = new EditorInfo(); |
31 mInputConnection = mContentViewCore.onCreateInputConnection(mEditorInfo)
; | 34 mInputConnection = mContentViewCore.onCreateInputConnection(mEditorInfo)
; |
(...skipping 20 matching lines...) Expand all Loading... |
52 mInputConnection = null; | 55 mInputConnection = null; |
53 return retVal; | 56 return retVal; |
54 } | 57 } |
55 | 58 |
56 @Override | 59 @Override |
57 public void updateSelection(View view, int selStart, int selEnd, | 60 public void updateSelection(View view, int selStart, int selEnd, |
58 int candidatesStart, int candidatesEnd) { | 61 int candidatesStart, int candidatesEnd) { |
59 mUpdateSelectionCounter++; | 62 mUpdateSelectionCounter++; |
60 } | 63 } |
61 | 64 |
| 65 @Override |
| 66 public void updateCursorAnchorInfo(View view, CursorAnchorInfoWrapper wrappe
r) { |
| 67 mUpdateCursorAnchorInfoCounter++; |
| 68 mLastCursorAnchortInfo = wrapper; |
| 69 } |
| 70 |
62 public int getShowSoftInputCounter() { | 71 public int getShowSoftInputCounter() { |
63 return mShowSoftInputCounter; | 72 return mShowSoftInputCounter; |
64 } | 73 } |
65 | 74 |
66 public int getUpdateSelectionCounter() { | 75 public int getUpdateSelectionCounter() { |
67 return mUpdateSelectionCounter; | 76 return mUpdateSelectionCounter; |
68 } | 77 } |
69 | 78 |
70 public EditorInfo getEditorInfo() { | 79 public EditorInfo getEditorInfo() { |
71 return mEditorInfo; | 80 return mEditorInfo; |
72 } | 81 } |
| 82 |
| 83 public int getUpdateCursorAnchorInfoCounter() { |
| 84 return mUpdateCursorAnchorInfoCounter; |
| 85 } |
| 86 |
| 87 public void clearLastCursorAnchorInfoWrapper() { |
| 88 mLastCursorAnchortInfo = null; |
| 89 } |
| 90 |
| 91 public CursorAnchorInfoWrapper getLastCursorAnchorInfoWrapper() { |
| 92 return mLastCursorAnchortInfo; |
| 93 } |
73 } | 94 } |
74 | |
OLD | NEW |