| Index: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
|
| index f454dca0633a07ec4d0f52bc872e77b2d3b4a904..132a8c9f2de3a3aa3e75e88e7f03a6c91e8be1d3 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
|
| @@ -820,30 +820,25 @@ public class ImeTest extends ContentShellTestBase {
|
| // crbug.com/606059
|
| if (usingReplicaInputConnection()) return;
|
|
|
| - int textLength = 25000;
|
| - String text = new String(new char[textLength]).replace("\0", "a");
|
| -
|
| - commitText(text, 1);
|
| - waitAndVerifyUpdateSelection(0, textLength, textLength, -1, -1);
|
| - selectAll();
|
| - waitAndVerifyUpdateSelection(1, 0, textLength, -1, -1);
|
| - copy();
|
| + final int textLength = 25000;
|
| + final String text = new String(new char[textLength]).replace("\0", "a");
|
| + setClip(text);
|
| assertClipboardContents(getActivity(), text);
|
|
|
| focusElement("textarea");
|
| - waitAndVerifyUpdateSelection(2, 0, 0, -1, -1);
|
| + waitAndVerifyUpdateSelection(0, 0, 0, -1, -1);
|
|
|
| // In order to reproduce the bug, we need some text after the pasting text.
|
| commitText("hello", 1);
|
| - waitAndVerifyUpdateSelection(3, 5, 5, -1, -1);
|
| + waitAndVerifyUpdateSelection(1, 5, 5, -1, -1);
|
|
|
| setSelection(0, 0);
|
| - waitAndVerifyUpdateSelection(4, 0, 0, -1, -1);
|
| + waitAndVerifyUpdateSelection(2, 0, 0, -1, -1);
|
|
|
| // It will crash after the 3rd paste if ImeThread is not enabled.
|
| for (int i = 0; i < 10; i++) {
|
| paste();
|
| - waitAndVerifyUpdateSelection(5 + i, textLength * (i + 1), textLength * (i + 1), -1, -1);
|
| + waitAndVerifyUpdateSelection(3 + i, textLength * (i + 1), textLength * (i + 1), -1, -1);
|
| }
|
| }
|
|
|
| @@ -1732,6 +1727,18 @@ public class ImeTest extends ContentShellTestBase {
|
| });
|
| }
|
|
|
| + private void setClip(final CharSequence text) {
|
| + ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + final ClipboardManager clipboardManager =
|
| + (ClipboardManager) getActivity().getSystemService(
|
| + Context.CLIPBOARD_SERVICE);
|
| + clipboardManager.setPrimaryClip(ClipData.newPlainText(null, text));
|
| + }
|
| + });
|
| + }
|
| +
|
| private void paste() {
|
| final WebContents webContents = mWebContents;
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
|
|