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.util.Pair; | 9 import android.util.Pair; |
10 import android.view.View; | 10 import android.view.View; |
(...skipping 21 matching lines...) Expand all Loading... |
32 private InputConnection mInputConnection; | 32 private InputConnection mInputConnection; |
33 private int mRestartInputCounter; | 33 private int mRestartInputCounter; |
34 private int mShowSoftInputCounter; | 34 private int mShowSoftInputCounter; |
35 private int mHideSoftInputCounter; | 35 private int mHideSoftInputCounter; |
36 private final Range mSelection = new Range(-1, -1); | 36 private final Range mSelection = new Range(-1, -1); |
37 private final Range mComposition = new Range(-1, -1); | 37 private final Range mComposition = new Range(-1, -1); |
38 private boolean mIsShowWithoutHideOutstanding; | 38 private boolean mIsShowWithoutHideOutstanding; |
39 private final List<Pair<Range, Range>> mUpdateSelectionList; | 39 private final List<Pair<Range, Range>> mUpdateSelectionList; |
40 private int mUpdateCursorAnchorInfoCounter; | 40 private int mUpdateCursorAnchorInfoCounter; |
41 private CursorAnchorInfo mLastCursorAnchorInfo; | 41 private CursorAnchorInfo mLastCursorAnchorInfo; |
| 42 private int mImeOptions; |
42 | 43 |
43 public TestInputMethodManagerWrapper(ContentViewCore contentViewCore) { | 44 public TestInputMethodManagerWrapper(ContentViewCore contentViewCore) { |
44 super(null); | 45 super(null); |
45 Log.d(TAG, "TestInputMethodManagerWrapper constructor"); | 46 Log.d(TAG, "TestInputMethodManagerWrapper constructor"); |
46 mContentViewCore = contentViewCore; | 47 mContentViewCore = contentViewCore; |
47 mUpdateSelectionList = new ArrayList<>(); | 48 mUpdateSelectionList = new ArrayList<>(); |
48 } | 49 } |
49 | 50 |
50 @Override | 51 @Override |
51 public void restartInput(View view) { | 52 public void restartInput(View view) { |
52 mRestartInputCounter++; | 53 mRestartInputCounter++; |
53 Log.d(TAG, "restartInput: count [%d]", mRestartInputCounter); | 54 Log.d(TAG, "restartInput: count [%d]", mRestartInputCounter); |
54 EditorInfo editorInfo = new EditorInfo(); | 55 EditorInfo editorInfo = new EditorInfo(); |
55 mInputConnection = mContentViewCore.onCreateInputConnection(editorInfo); | 56 mInputConnection = mContentViewCore.onCreateInputConnection(editorInfo); |
| 57 mImeOptions = editorInfo.imeOptions; |
56 } | 58 } |
57 | 59 |
58 @Override | 60 @Override |
59 public void showSoftInput(View view, int flags, ResultReceiver resultReceive
r) { | 61 public void showSoftInput(View view, int flags, ResultReceiver resultReceive
r) { |
60 mIsShowWithoutHideOutstanding = true; | 62 mIsShowWithoutHideOutstanding = true; |
61 mShowSoftInputCounter++; | 63 mShowSoftInputCounter++; |
62 Log.d(TAG, "showSoftInput: count [%d]", mShowSoftInputCounter); | 64 Log.d(TAG, "showSoftInput: count [%d]", mShowSoftInputCounter); |
63 if (mInputConnection != null) return; | 65 if (mInputConnection != null) return; |
64 EditorInfo editorInfo = new EditorInfo(); | 66 EditorInfo editorInfo = new EditorInfo(); |
65 mInputConnection = mContentViewCore.onCreateInputConnection(editorInfo); | 67 mInputConnection = mContentViewCore.onCreateInputConnection(editorInfo); |
| 68 mImeOptions = editorInfo.imeOptions; |
66 } | 69 } |
67 | 70 |
68 @Override | 71 @Override |
69 public boolean isActive(View view) { | 72 public boolean isActive(View view) { |
70 boolean result = mInputConnection != null; | 73 boolean result = mInputConnection != null; |
71 Log.d(TAG, "isActive: returns [%b]", result); | 74 Log.d(TAG, "isActive: returns [%b]", result); |
72 return result; | 75 return result; |
73 } | 76 } |
74 | 77 |
75 @Override | 78 @Override |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 164 } |
162 | 165 |
163 public void clearLastCursorAnchorInfo() { | 166 public void clearLastCursorAnchorInfo() { |
164 mLastCursorAnchorInfo = null; | 167 mLastCursorAnchorInfo = null; |
165 } | 168 } |
166 | 169 |
167 public CursorAnchorInfo getLastCursorAnchorInfo() { | 170 public CursorAnchorInfo getLastCursorAnchorInfo() { |
168 return mLastCursorAnchorInfo; | 171 return mLastCursorAnchorInfo; |
169 } | 172 } |
170 | 173 |
| 174 public int getImeOptions() { |
| 175 return mImeOptions; |
| 176 } |
| 177 |
171 public void onUpdateSelection(Range oldSel, Range oldComp, Range newSel, Ran
ge newComp) {} | 178 public void onUpdateSelection(Range oldSel, Range oldComp, Range newSel, Ran
ge newComp) {} |
172 | 179 |
173 public void expectsSelectionOutsideComposition() {} | 180 public void expectsSelectionOutsideComposition() {} |
174 } | 181 } |
OLD | NEW |