| Index: content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java
|
| index 931e88d4d3fe99b5c4ca7594846edf06c299e348..6d529d9d0f294c5699050abf5ff9900e2170a326 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreSelectionTest.java
|
| @@ -41,6 +41,7 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| + "<br/><input id=\"disabled_text\" type=\"text\" disabled value=\"Sample Text\" />"
|
| + "</form></body></html>");
|
| private ContentViewCore mContentViewCore;
|
| + private WebActionMode mActionMode;
|
|
|
| @Override
|
| public void setUp() throws Exception {
|
| @@ -50,6 +51,7 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| waitForActiveShellToBeDoneLoading();
|
|
|
| mContentViewCore = getContentViewCore();
|
| + mActionMode = mContentViewCore.getActionMode();
|
| waitForSelectActionBarVisible(false);
|
| waitForPastePopupStatus(false);
|
| }
|
| @@ -65,11 +67,11 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
|
|
| requestFocusOnUiThread(false);
|
| waitForSelectActionBarVisible(false);
|
| - assertFalse(mContentViewCore.hasSelection());
|
| + assertFalse(mActionMode.hasSelection());
|
|
|
| requestFocusOnUiThread(true);
|
| waitForSelectActionBarVisible(false);
|
| - assertFalse(mContentViewCore.hasSelection());
|
| + assertFalse(mActionMode.hasSelection());
|
| }
|
|
|
| @SmallTest
|
| @@ -80,21 +82,21 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
|
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
|
|
| mContentViewCore.preserveSelectionOnNextLossOfFocus();
|
| requestFocusOnUiThread(false);
|
| waitForSelectActionBarVisible(false);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
|
|
| requestFocusOnUiThread(true);
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
|
|
| // Losing focus yet again should properly clear the selection.
|
| requestFocusOnUiThread(false);
|
| waitForSelectActionBarVisible(false);
|
| - assertFalse(mContentViewCore.hasSelection());
|
| + assertFalse(mActionMode.hasSelection());
|
| }
|
|
|
| @SmallTest
|
| @@ -103,15 +105,15 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectionPreservedAfterReshown() throws Throwable {
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
|
|
| setVisibileOnUiThread(false);
|
| waitForSelectActionBarVisible(false);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
|
|
| setVisibileOnUiThread(true);
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| }
|
|
|
| @SmallTest
|
| @@ -120,15 +122,15 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectionPreservedAfterReattached() throws Throwable {
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
|
|
| setAttachedOnUiThread(false);
|
| waitForSelectActionBarVisible(false);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
|
|
| setAttachedOnUiThread(true);
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| }
|
|
|
| /*
|
| @@ -236,10 +238,10 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testActionBarConfiguredCorrectlyForInput() throws Throwable {
|
| DOMUtils.longPressNode(this, mContentViewCore, "input_text");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| - assertTrue(mContentViewCore.getSelectActionHandler().isSelectionEditable());
|
| - assertFalse(mContentViewCore.getSelectActionHandler().isSelectionPassword());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| + assertTrue(mActionMode.isSelectionEditable());
|
| + assertFalse(mActionMode.isSelectionPassword());
|
| }
|
|
|
| @SmallTest
|
| @@ -248,10 +250,10 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testActionBarConfiguredCorrectlyForPassword() throws Throwable {
|
| DOMUtils.longPressNode(this, mContentViewCore, "password");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| - assertTrue(mContentViewCore.getSelectActionHandler().isSelectionEditable());
|
| - assertTrue(mContentViewCore.getSelectActionHandler().isSelectionPassword());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| + assertTrue(mActionMode.isSelectionEditable());
|
| + assertTrue(mActionMode.isSelectionPassword());
|
| }
|
|
|
| @SmallTest
|
| @@ -260,10 +262,10 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testActionBarConfiguredCorrectlyForPlainText() throws Throwable {
|
| DOMUtils.longPressNode(this, mContentViewCore, "plain_text_1");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| - assertFalse(mContentViewCore.getSelectActionHandler().isSelectionEditable());
|
| - assertFalse(mContentViewCore.getSelectActionHandler().isSelectionPassword());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| + assertFalse(mActionMode.isSelectionEditable());
|
| + assertFalse(mActionMode.isSelectionPassword());
|
| }
|
|
|
| @SmallTest
|
| @@ -272,10 +274,10 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testActionBarConfiguredCorrectlyForTextArea() throws Throwable {
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| - assertTrue(mContentViewCore.getSelectActionHandler().isSelectionEditable());
|
| - assertFalse(mContentViewCore.getSelectActionHandler().isSelectionPassword());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| + assertTrue(mActionMode.isSelectionEditable());
|
| + assertFalse(mActionMode.isSelectionPassword());
|
| }
|
|
|
| @SmallTest
|
| @@ -284,8 +286,8 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarPlainTextCopy() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "plain_text_1");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarCopy();
|
| waitForClipboardContents(mContentViewCore.getContext(), "SamplePlainTextOne");
|
| }
|
| @@ -296,8 +298,8 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarInputCopy() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "input_text");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarCopy();
|
| waitForClipboardContents(mContentViewCore.getContext(), "SampleInputText");
|
| }
|
| @@ -308,14 +310,14 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarPasswordCopy() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "plain_text_1");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarCopy();
|
| waitForClipboardContents(mContentViewCore.getContext(), "SamplePlainTextOne");
|
| DOMUtils.longPressNode(this, mContentViewCore, "password");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarCopy();
|
| // Copy option won't be there for Password, hence no change in Clipboard
|
| // Validating with previous Clipboard content
|
| @@ -328,8 +330,8 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarTextAreaCopy() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarCopy();
|
| waitForClipboardContents(mContentViewCore.getContext(), "SampleTextArea");
|
| }
|
| @@ -341,12 +343,12 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| copyStringToClipboard("SampleTextToCopy");
|
| DOMUtils.longPressNode(this, mContentViewCore, "plain_text_1");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertEquals(mContentViewCore.getSelectedText(), "SamplePlainTextOne");
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertEquals(mActionMode.getSelectedText(), "SamplePlainTextOne");
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarCut();
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| // Cut option won't be available for plain text.
|
| // Hence validating previous Clipboard content.
|
| waitForClipboardContents(mContentViewCore.getContext(), "SampleTextToCopy");
|
| @@ -358,14 +360,14 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarInputCut() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "input_text");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertEquals(mContentViewCore.getSelectedText(), "SampleInputText");
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertEquals(mActionMode.getSelectedText(), "SampleInputText");
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarCut();
|
| waitForSelectActionBarVisible(false);
|
| - assertFalse(mContentViewCore.hasSelection());
|
| + assertFalse(mActionMode.hasSelection());
|
| waitForClipboardContents(mContentViewCore.getContext(), "SampleInputText");
|
| - assertEquals(mContentViewCore.getSelectedText(), "");
|
| + assertEquals(mActionMode.getSelectedText(), "");
|
| }
|
|
|
| @SmallTest
|
| @@ -375,11 +377,11 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| copyStringToClipboard("SampleTextToCopy");
|
| DOMUtils.longPressNode(this, mContentViewCore, "password");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarCut();
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| // Cut option won't be there for Password, hence no change in Clipboard
|
| // Validating with previous Clipboard content
|
| waitForClipboardContents(mContentViewCore.getContext(), "SampleTextToCopy");
|
| @@ -391,14 +393,14 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarTextAreaCut() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertEquals(mContentViewCore.getSelectedText(), "SampleTextArea");
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertEquals(mActionMode.getSelectedText(), "SampleTextArea");
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarCut();
|
| waitForSelectActionBarVisible(false);
|
| - assertFalse(mContentViewCore.hasSelection());
|
| + assertFalse(mActionMode.hasSelection());
|
| waitForClipboardContents(mContentViewCore.getContext(), "SampleTextArea");
|
| - assertEquals(mContentViewCore.getSelectedText(), "");
|
| + assertEquals(mActionMode.getSelectedText(), "");
|
| }
|
|
|
| @SmallTest
|
| @@ -407,10 +409,10 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarPlainTextSelectAll() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "plain_text_1");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarSelectAll();
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| waitForSelectActionBarVisible(true);
|
| }
|
|
|
| @@ -420,12 +422,12 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarInputSelectAll() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "input_text");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarSelectAll();
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| waitForSelectActionBarVisible(true);
|
| - assertEquals(mContentViewCore.getSelectedText(), "SampleInputText");
|
| + assertEquals(mActionMode.getSelectedText(), "SampleInputText");
|
| }
|
|
|
| @SmallTest
|
| @@ -434,10 +436,10 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarPasswordSelectAll() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "password");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarSelectAll();
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| waitForSelectActionBarVisible(true);
|
| }
|
|
|
| @@ -447,12 +449,12 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarTextAreaSelectAll() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarSelectAll();
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| waitForSelectActionBarVisible(true);
|
| - assertEquals(mContentViewCore.getSelectedText(), "SampleTextArea");
|
| + assertEquals(mActionMode.getSelectedText(), "SampleTextArea");
|
| }
|
|
|
| private CharSequence getTextBeforeCursor(final int length, final int flags) {
|
| @@ -475,12 +477,12 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testCursorPositionAfterHidingActionMode() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarSelectAll();
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| waitForSelectActionBarVisible(true);
|
| - assertEquals(mContentViewCore.getSelectedText(), "SampleTextArea");
|
| + assertEquals(mActionMode.getSelectedText(), "SampleTextArea");
|
| hideSelectActionMode();
|
| waitForSelectActionBarVisible(false);
|
| CriteriaHelper.pollInstrumentationThread(
|
| @@ -499,15 +501,15 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| copyStringToClipboard("SampleTextToCopy");
|
| DOMUtils.longPressNode(this, mContentViewCore, "plain_text_1");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarPaste();
|
| DOMUtils.longPressNode(this, mContentViewCore, "plain_text_1");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
| // Paste option won't be available for plain text.
|
| // Hence content won't be changed.
|
| - assertNotSame(mContentViewCore.getSelectedText(), "SampleTextToCopy");
|
| + assertNotSame(mActionMode.getSelectedText(), "SampleTextToCopy");
|
| }
|
|
|
| @SmallTest
|
| @@ -519,19 +521,19 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| // Select the input field.
|
| DOMUtils.longPressNode(this, mContentViewCore, "input_text");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| + assertTrue(mActionMode.hasSelection());
|
|
|
| // Paste into the input field.
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarPaste();
|
| waitForSelectActionBarVisible(false);
|
| - assertFalse(mContentViewCore.hasSelection());
|
| + assertFalse(mActionMode.hasSelection());
|
|
|
| // Ensure the new text matches the pasted text.
|
| DOMUtils.longPressNode(this, mContentViewCore, "input_text");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertEquals("SampleTextToCopy", mContentViewCore.getSelectedText());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertEquals("SampleTextToCopy", mActionMode.getSelectedText());
|
| }
|
|
|
| /*
|
| @@ -545,23 +547,23 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| // Select the password field.
|
| DOMUtils.longPressNode(this, mContentViewCore, "password");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertEquals(mContentViewCore.getSelectedText().length(), "SamplePassword".length());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertEquals(mActionMode.getSelectedText().length(), "SamplePassword".length());
|
|
|
| // Paste "SamplePassword2" into the password field, replacing
|
| // "SamplePassword".
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarPaste();
|
| waitForSelectActionBarVisible(false);
|
| - assertFalse(mContentViewCore.hasSelection());
|
| + assertFalse(mActionMode.hasSelection());
|
|
|
| // Ensure the new text matches the pasted text. Note that we can't
|
| // actually compare strings as password field selections only provide
|
| // a placeholder with the correct length.
|
| DOMUtils.longPressNode(this, mContentViewCore, "password");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertEquals(mContentViewCore.getSelectedText().length(), "SamplePassword2".length());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertEquals(mActionMode.getSelectedText().length(), "SamplePassword2".length());
|
| }
|
|
|
| @SmallTest
|
| @@ -571,14 +573,14 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| copyStringToClipboard("SampleTextToCopy");
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarPaste();
|
| DOMUtils.clickNode(this, mContentViewCore, "plain_text_1");
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertEquals(mContentViewCore.getSelectedText(), "SampleTextToCopy");
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertEquals(mActionMode.getSelectedText(), "SampleTextToCopy");
|
| }
|
|
|
| @SmallTest
|
| @@ -587,8 +589,8 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| public void testSelectActionBarSearchAndShareLaunchesNewTask() throws Exception {
|
| DOMUtils.longPressNode(this, mContentViewCore, "textarea");
|
| waitForSelectActionBarVisible(true);
|
| - assertTrue(mContentViewCore.hasSelection());
|
| - assertNotNull(mContentViewCore.getSelectActionHandler());
|
| + assertTrue(mActionMode.hasSelection());
|
| + assertTrue(mActionMode.isValid());
|
| selectActionBarSearch();
|
| Intent i = getActivity().getLastSentIntent();
|
| int new_task_flag = Intent.FLAG_ACTIVITY_NEW_TASK;
|
| @@ -603,7 +605,7 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @Override
|
| public void run() {
|
| - mContentViewCore.getSelectActionHandler().paste();
|
| + mActionMode.paste();
|
| }
|
| });
|
| }
|
| @@ -612,7 +614,7 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @Override
|
| public void run() {
|
| - mContentViewCore.getSelectActionHandler().selectAll();
|
| + mActionMode.selectAll();
|
| }
|
| });
|
| }
|
| @@ -621,7 +623,7 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @Override
|
| public void run() {
|
| - mContentViewCore.getSelectActionHandler().cut();
|
| + mActionMode.cut();
|
| }
|
| });
|
| }
|
| @@ -630,7 +632,7 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @Override
|
| public void run() {
|
| - mContentViewCore.getSelectActionHandler().copy();
|
| + mActionMode.copy();
|
| }
|
| });
|
| }
|
| @@ -639,7 +641,7 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @Override
|
| public void run() {
|
| - mContentViewCore.getSelectActionHandler().search();
|
| + mActionMode.search();
|
| }
|
| });
|
| }
|
| @@ -648,7 +650,7 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @Override
|
| public void run() {
|
| - mContentViewCore.getSelectActionHandler().share();
|
| + mActionMode.share();
|
| }
|
| });
|
| }
|
| @@ -657,7 +659,7 @@ public class ContentViewCoreSelectionTest extends ContentShellTestBase {
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @Override
|
| public void run() {
|
| - mContentViewCore.hideSelectActionMode();
|
| + mContentViewCore.destroySelectActionMode();
|
| }
|
| });
|
| }
|
|
|