| 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.CursorAnchorInfo; |
| 10 import android.view.inputmethod.EditorInfo; | 11 import android.view.inputmethod.EditorInfo; |
| 11 import android.view.inputmethod.InputConnection; | 12 import android.view.inputmethod.InputConnection; |
| 12 | 13 |
| 13 import org.chromium.base.Log; | 14 import org.chromium.base.Log; |
| 14 import org.chromium.content.browser.ContentViewCore; | 15 import org.chromium.content.browser.ContentViewCore; |
| 15 import org.chromium.content.browser.input.InputMethodManagerWrapper; | 16 import org.chromium.content.browser.input.InputMethodManagerWrapper; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * Overrides InputMethodManagerWrapper for testing purposes. | 19 * Overrides InputMethodManagerWrapper for testing purposes. |
| 19 */ | 20 */ |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return "[ " + mStart + ", " + mEnd + " ]"; | 65 return "[ " + mStart + ", " + mEnd + " ]"; |
| 65 } | 66 } |
| 66 } | 67 } |
| 67 | 68 |
| 68 private final ContentViewCore mContentViewCore; | 69 private final ContentViewCore mContentViewCore; |
| 69 private InputConnection mInputConnection; | 70 private InputConnection mInputConnection; |
| 70 private int mRestartInputCounter; | 71 private int mRestartInputCounter; |
| 71 private int mShowSoftInputCounter; | 72 private int mShowSoftInputCounter; |
| 72 private int mHideSoftInputCounter; | 73 private int mHideSoftInputCounter; |
| 73 private int mUpdateSelectionCounter; | 74 private int mUpdateSelectionCounter; |
| 75 private int mUpdateCursorAnchorInfoCounter = 0; |
| 74 private EditorInfo mEditorInfo; | 76 private EditorInfo mEditorInfo; |
| 75 private final Range mSelection = new Range(0, 0); | 77 private final Range mSelection = new Range(0, 0); |
| 76 private final Range mComposition = new Range(-1, -1); | 78 private final Range mComposition = new Range(-1, -1); |
| 77 private boolean mIsShowWithoutHideOutstanding; | 79 private boolean mIsShowWithoutHideOutstanding; |
| 80 private CursorAnchorInfo mLastCursorAnchorInfo; |
| 78 | 81 |
| 79 public TestInputMethodManagerWrapper(ContentViewCore contentViewCore) { | 82 public TestInputMethodManagerWrapper(ContentViewCore contentViewCore) { |
| 80 super(null); | 83 super(null); |
| 81 Log.d(TAG, "TestInputMethodManagerWrapper constructor"); | 84 Log.d(TAG, "TestInputMethodManagerWrapper constructor"); |
| 82 mContentViewCore = contentViewCore; | 85 mContentViewCore = contentViewCore; |
| 83 } | 86 } |
| 84 | 87 |
| 85 @Override | 88 @Override |
| 86 public void restartInput(View view) { | 89 public void restartInput(View view) { |
| 87 mRestartInputCounter++; | 90 mRestartInputCounter++; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 Log.d(TAG, "updateSelection"); | 127 Log.d(TAG, "updateSelection"); |
| 125 mUpdateSelectionCounter++; | 128 mUpdateSelectionCounter++; |
| 126 mSelection.set(selStart, selEnd); | 129 mSelection.set(selStart, selEnd); |
| 127 mComposition.set(candidatesStart, candidatesEnd); | 130 mComposition.set(candidatesStart, candidatesEnd); |
| 128 } | 131 } |
| 129 | 132 |
| 130 public int getRestartInputCounter() { | 133 public int getRestartInputCounter() { |
| 131 return mRestartInputCounter; | 134 return mRestartInputCounter; |
| 132 } | 135 } |
| 133 | 136 |
| 137 @Override |
| 138 public void updateCursorAnchorInfo(View view, CursorAnchorInfo cursorAnchorI
nfo) { |
| 139 mUpdateCursorAnchorInfoCounter++; |
| 140 mLastCursorAnchorInfo = cursorAnchorInfo; |
| 141 } |
| 142 |
| 134 public int getShowSoftInputCounter() { | 143 public int getShowSoftInputCounter() { |
| 135 Log.d(TAG, "getShowSoftInputCounter: %d", mShowSoftInputCounter); | 144 Log.d(TAG, "getShowSoftInputCounter: %d", mShowSoftInputCounter); |
| 136 return mShowSoftInputCounter; | 145 return mShowSoftInputCounter; |
| 137 } | 146 } |
| 138 | 147 |
| 139 public int getHideSoftInputCounter() { | 148 public int getHideSoftInputCounter() { |
| 140 return mHideSoftInputCounter; | 149 return mHideSoftInputCounter; |
| 141 } | 150 } |
| 142 | 151 |
| 143 public int getUpdateSelectionCounter() { | 152 public int getUpdateSelectionCounter() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 164 return mSelection; | 173 return mSelection; |
| 165 } | 174 } |
| 166 | 175 |
| 167 public Range getComposition() { | 176 public Range getComposition() { |
| 168 return mComposition; | 177 return mComposition; |
| 169 } | 178 } |
| 170 | 179 |
| 171 public boolean isShowWithoutHideOutstanding() { | 180 public boolean isShowWithoutHideOutstanding() { |
| 172 return mIsShowWithoutHideOutstanding; | 181 return mIsShowWithoutHideOutstanding; |
| 173 } | 182 } |
| 174 } | 183 |
| 184 public int getUpdateCursorAnchorInfoCounter() { |
| 185 return mUpdateCursorAnchorInfoCounter; |
| 186 } |
| 187 |
| 188 public void clearLastCursorAnchorInfo() { |
| 189 mLastCursorAnchorInfo = null; |
| 190 } |
| 191 |
| 192 public CursorAnchorInfo getLastCursorAnchorInfo() { |
| 193 return mLastCursorAnchorInfo; |
| 194 } |
| 195 } |
| OLD | NEW |