Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnectionFactory.java

Issue 1721613002: Add JUnit tests for ImeThread activation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adjusted to robolectric 3.0 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.os.Handler; 7 import android.os.Handler;
8 import android.os.HandlerThread; 8 import android.os.HandlerThread;
9 import android.view.View; 9 import android.view.View;
10 import android.view.inputmethod.EditorInfo; 10 import android.view.inputmethod.EditorInfo;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 public void run() { 196 public void run() {
197 checkRegisterResult(view, checkInvalidator, retry); 197 checkRegisterResult(view, checkInvalidator, retry);
198 } 198 }
199 }); 199 });
200 } 200 }
201 201
202 private void checkRegisterResult(View view, CheckInvalidator checkInvalidato r, int retry) { 202 private void checkRegisterResult(View view, CheckInvalidator checkInvalidato r, int retry) {
203 if (DEBUG_LOGS) Log.w(TAG, "checkRegisterResult - retry: " + retry); 203 if (DEBUG_LOGS) Log.w(TAG, "checkRegisterResult - retry: " + retry);
204 // Success. 204 // Success.
205 if (mInputMethodManagerWrapper.isActive(mProxyView)) { 205 if (mInputMethodManagerWrapper.isActive(mProxyView)) {
206 mInputMethodUma.recordProxyViewSuccess(); 206 onRegisterProxyViewSuccess();
207 return; 207 return;
208 } 208 }
209 209
210 if (checkInvalidator.isInvalid()) return; 210 if (checkInvalidator.isInvalid()) return;
211 211
212 if (retry > 0) { 212 if (retry > 0) {
213 postCheckRegisterResultOnUiThread(view, checkInvalidator, retry - 1) ; 213 postCheckRegisterResultOnUiThread(view, checkInvalidator, retry - 1) ;
214 return; 214 return;
215 } 215 }
216 216
217 onRegisterProxyViewFailed(); 217 onRegisterProxyViewFailure();
218 } 218 }
219 219
220 @VisibleForTesting 220 @VisibleForTesting
221 protected void onRegisterProxyViewFailed() { 221 protected void onRegisterProxyViewSuccess() {
222 Log.w(TAG, "onRegisterProxyViewFailed"); 222 Log.d(TAG, "onRegisterProxyViewSuccess");
223 mInputMethodUma.recordProxyViewSuccess();
224 }
225
226 @VisibleForTesting
227 protected void onRegisterProxyViewFailure() {
228 Log.w(TAG, "onRegisterProxyViewFailure");
223 mInputMethodUma.recordProxyViewFailure(); 229 mInputMethodUma.recordProxyViewFailure();
224 } 230 }
225 231
226 @Override 232 @Override
227 public Handler getHandler() { 233 public Handler getHandler() {
228 return mHandler; 234 return mHandler;
229 } 235 }
230 236
231 @Override 237 @Override
232 public void onWindowFocusChanged(boolean gainFocus) { 238 public void onWindowFocusChanged(boolean gainFocus) {
(...skipping 15 matching lines...) Expand all
248 if (mProxyView != null) mProxyView.onOriginalViewAttachedToWindow(); 254 if (mProxyView != null) mProxyView.onOriginalViewAttachedToWindow();
249 } 255 }
250 256
251 @Override 257 @Override
252 public void onViewDetachedFromWindow() { 258 public void onViewDetachedFromWindow() {
253 if (DEBUG_LOGS) Log.d(TAG, "onViewDetachedFromWindow"); 259 if (DEBUG_LOGS) Log.d(TAG, "onViewDetachedFromWindow");
254 if (mCheckInvalidator != null) mCheckInvalidator.invalidate(); 260 if (mCheckInvalidator != null) mCheckInvalidator.invalidate();
255 if (mProxyView != null) mProxyView.onOriginalViewDetachedFromWindow(); 261 if (mProxyView != null) mProxyView.onOriginalViewDetachedFromWindow();
256 } 262 }
257 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698