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

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

Issue 2537073002: Fix leaks in InputConnectionHandlerThread (Closed)
Patch Set: fix tests Created 4 years 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
« no previous file with comments | « content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 static org.junit.Assert.assertFalse; 7 import static org.junit.Assert.assertFalse;
8 import static org.junit.Assert.assertNotNull; 8 import static org.junit.Assert.assertNotNull;
9 import static org.junit.Assert.assertNull; 9 import static org.junit.Assert.assertNull;
10 import static org.junit.Assert.assertTrue; 10 import static org.junit.Assert.assertTrue;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 mEditorInfo = new EditorInfo(); 128 mEditorInfo = new EditorInfo();
129 mUiHandler = new Handler(); 129 mUiHandler = new Handler();
130 130
131 mContext = Mockito.mock(Context.class); 131 mContext = Mockito.mock(Context.class);
132 mContainerView = Mockito.mock(View.class); 132 mContainerView = Mockito.mock(View.class);
133 mImeAdapter = Mockito.mock(ImeAdapter.class); 133 mImeAdapter = Mockito.mock(ImeAdapter.class);
134 mInputMethodManager = Mockito.mock(InputMethodManager.class); 134 mInputMethodManager = Mockito.mock(InputMethodManager.class);
135 135
136 mFactory = new TestFactory(new InputMethodManagerWrapper(mContext)); 136 mFactory = new TestFactory(new InputMethodManagerWrapper(mContext));
137 // Needed to access handler's looper even before we initialize handler.
138 mFactory.createHandler();
137 mFactory.onWindowFocusChanged(true); 139 mFactory.onWindowFocusChanged(true);
138 140
139 when(mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) 141 when(mContext.getSystemService(Context.INPUT_METHOD_SERVICE))
140 .thenReturn(mInputMethodManager); 142 .thenReturn(mInputMethodManager);
141 when(mContainerView.getContext()).thenReturn(mContext); 143 when(mContainerView.getContext()).thenReturn(mContext);
142 when(mContainerView.getHandler()).thenReturn(mUiHandler); 144 when(mContainerView.getHandler()).thenReturn(mUiHandler);
143 when(mContainerView.hasFocus()).thenReturn(true); 145 when(mContainerView.hasFocus()).thenReturn(true);
144 when(mContainerView.hasWindowFocus()).thenReturn(true); 146 when(mContainerView.hasWindowFocus()).thenReturn(true);
145 147
146 mProxyView = Mockito.mock(ThreadedInputConnectionProxyView.class); 148 mProxyView = Mockito.mock(ThreadedInputConnectionProxyView.class);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 runOneUiTask(); 285 runOneUiTask();
284 mInOrder.verify(mInputMethodManager).isActive(mProxyView); 286 mInOrder.verify(mInputMethodManager).isActive(mProxyView);
285 287
286 mInOrder.verifyNoMoreInteractions(); 288 mInOrder.verifyNoMoreInteractions();
287 // Failed, but no logging because check has been invalidated. 289 // Failed, but no logging because check has been invalidated.
288 assertNull(mInputConnection); 290 assertNull(mInputConnection);
289 assertFalse(mFactory.hasSucceeded()); 291 assertFalse(mFactory.hasSucceeded());
290 assertFalse(mFactory.hasFailed()); 292 assertFalse(mFactory.hasFailed());
291 } 293 }
292 } 294 }
OLDNEW
« no previous file with comments | « content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698