| 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 final ArrayList<EditorInfo> mEditorInfoList = new ArrayList<>(); |
| 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 mEditorInfoList.add(editorInfo); |
| 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 mEditorInfoList.add(editorInfo); |
| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 public int getHideSoftInputCounter() { | 134 public int getHideSoftInputCounter() { |
| 132 return mHideSoftInputCounter; | 135 return mHideSoftInputCounter; |
| 133 } | 136 } |
| 134 | 137 |
| 135 public void reset() { | 138 public void reset() { |
| 136 Log.d(TAG, "reset"); | 139 Log.d(TAG, "reset"); |
| 137 mRestartInputCounter = 0; | 140 mRestartInputCounter = 0; |
| 138 mShowSoftInputCounter = 0; | 141 mShowSoftInputCounter = 0; |
| 139 mHideSoftInputCounter = 0; | 142 mHideSoftInputCounter = 0; |
| 140 mUpdateSelectionList.clear(); | 143 mUpdateSelectionList.clear(); |
| 144 mEditorInfoList.clear(); |
| 141 } | 145 } |
| 142 | 146 |
| 143 public InputConnection getInputConnection() { | 147 public InputConnection getInputConnection() { |
| 144 return mInputConnection; | 148 return mInputConnection; |
| 145 } | 149 } |
| 146 | 150 |
| 147 public Range getSelection() { | 151 public Range getSelection() { |
| 148 return mSelection; | 152 return mSelection; |
| 149 } | 153 } |
| 150 | 154 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 161 } | 165 } |
| 162 | 166 |
| 163 public void clearLastCursorAnchorInfo() { | 167 public void clearLastCursorAnchorInfo() { |
| 164 mLastCursorAnchorInfo = null; | 168 mLastCursorAnchorInfo = null; |
| 165 } | 169 } |
| 166 | 170 |
| 167 public CursorAnchorInfo getLastCursorAnchorInfo() { | 171 public CursorAnchorInfo getLastCursorAnchorInfo() { |
| 168 return mLastCursorAnchorInfo; | 172 return mLastCursorAnchorInfo; |
| 169 } | 173 } |
| 170 | 174 |
| 175 public ArrayList<EditorInfo> getEditorInfoList() { |
| 176 return mEditorInfoList; |
| 177 } |
| 178 |
| 171 public void onUpdateSelection(Range oldSel, Range oldComp, Range newSel, Ran
ge newComp) {} | 179 public void onUpdateSelection(Range oldSel, Range oldComp, Range newSel, Ran
ge newComp) {} |
| 172 | 180 |
| 173 public void expectsSelectionOutsideComposition() {} | 181 public void expectsSelectionOutsideComposition() {} |
| 174 } | 182 } |
| OLD | NEW |