Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.content.ClipData; | 9 import android.content.ClipData; |
| 10 import android.content.ClipboardManager; | 10 import android.content.ClipboardManager; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 int restartCount = mInputMethodManagerWrapper.getRestartInputCounter(); | 190 int restartCount = mInputMethodManagerWrapper.getRestartInputCounter(); |
| 191 Integer[] history = mConnectionFactory.getTextInputTypeHistory(); | 191 Integer[] history = mConnectionFactory.getTextInputTypeHistory(); |
| 192 return stringifyKeyboardStates(showCount, hideCount, restartCount, histo ry); | 192 return stringifyKeyboardStates(showCount, hideCount, restartCount, histo ry); |
| 193 } | 193 } |
| 194 | 194 |
| 195 String stringifyKeyboardStates(int show, int hide, int restart, Integer[] hi story) { | 195 String stringifyKeyboardStates(int show, int hide, int restart, Integer[] hi story) { |
| 196 return "show count: " + show + ", hide count: " + hide + ", restart coun t: " + restart | 196 return "show count: " + show + ", hide count: " + hide + ", restart coun t: " + restart |
| 197 + ", input type history: " + Arrays.deepToString(history); | 197 + ", input type history: " + Arrays.deepToString(history); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void performEditorAction(final int action) { | |
| 201 final InputConnection inputConnection = mConnection; | |
| 202 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | |
| 203 @Override | |
| 204 public void run() { | |
| 205 inputConnection.performEditorAction(action); | |
| 206 } | |
| 207 }); | |
| 208 } | |
| 209 | |
| 200 void performGo(TestCallbackHelperContainer testCallbackHelperContainer) thro ws Throwable { | 210 void performGo(TestCallbackHelperContainer testCallbackHelperContainer) thro ws Throwable { |
| 201 final InputConnection inputConnection = mConnection; | 211 final InputConnection inputConnection = mConnection; |
| 202 final Callable<Void> callable = new Callable<Void>() { | 212 final Callable<Void> callable = new Callable<Void>() { |
| 203 @Override | 213 @Override |
| 204 public Void call() throws Exception { | 214 public Void call() throws Exception { |
| 205 inputConnection.performEditorAction(EditorInfo.IME_ACTION_GO); | 215 inputConnection.performEditorAction(EditorInfo.IME_ACTION_GO); |
| 206 return null; | 216 return null; |
| 207 } | 217 } |
| 208 }; | 218 }; |
| 209 | 219 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 return states.size() > index; | 265 return states.size() > index; |
| 256 } | 266 } |
| 257 }); | 267 }); |
| 258 Pair<Range, Range> selection = states.get(index); | 268 Pair<Range, Range> selection = states.get(index); |
| 259 Assert.assertEquals(selectionStart, selection.first.start()); | 269 Assert.assertEquals(selectionStart, selection.first.start()); |
| 260 Assert.assertEquals(selectionEnd, selection.first.end()); | 270 Assert.assertEquals(selectionEnd, selection.first.end()); |
| 261 Assert.assertEquals(compositionStart, selection.second.start()); | 271 Assert.assertEquals(compositionStart, selection.second.start()); |
| 262 Assert.assertEquals(compositionEnd, selection.second.end()); | 272 Assert.assertEquals(compositionEnd, selection.second.end()); |
| 263 } | 273 } |
| 264 | 274 |
| 265 void resetUpdateSelectionList() { | 275 void resetUpdateSelectionList() { |
|
Changwan Ryu
2017/05/11 22:57:12
Previously we only clear selection list in setUp()
AKVT
2017/05/12 13:26:25
Done.
| |
| 266 mInputMethodManagerWrapper.getUpdateSelectionList().clear(); | 276 mInputMethodManagerWrapper.getUpdateSelectionList().clear(); |
| 267 } | 277 } |
| 268 | 278 |
| 269 void assertClipboardContents(final Activity activity, final String expectedC ontents) { | 279 void assertClipboardContents(final Activity activity, final String expectedC ontents) { |
| 270 CriteriaHelper.pollUiThread(new Criteria() { | 280 CriteriaHelper.pollUiThread(new Criteria() { |
| 271 @Override | 281 @Override |
| 272 public boolean isSatisfied() { | 282 public boolean isSatisfied() { |
| 273 ClipboardManager clipboardManager = | 283 ClipboardManager clipboardManager = |
| 274 (ClipboardManager) activity.getSystemService(Context.CLI PBOARD_SERVICE); | 284 (ClipboardManager) activity.getSystemService(Context.CLI PBOARD_SERVICE); |
| 275 ClipData clip = clipboardManager.getPrimaryClip(); | 285 ClipData clip = clipboardManager.getPrimaryClip(); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 607 public void onViewAttachedToWindow() { | 617 public void onViewAttachedToWindow() { |
| 608 mFactory.onViewAttachedToWindow(); | 618 mFactory.onViewAttachedToWindow(); |
| 609 } | 619 } |
| 610 | 620 |
| 611 @Override | 621 @Override |
| 612 public void onViewDetachedFromWindow() { | 622 public void onViewDetachedFromWindow() { |
| 613 mFactory.onViewDetachedFromWindow(); | 623 mFactory.onViewDetachedFromWindow(); |
| 614 } | 624 } |
| 615 } | 625 } |
| 616 } | 626 } |
| OLD | NEW |