Index: chrome/android/javatests/src/org/chromium/chrome/browser/input/TextSuggestionMenuTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/input/TextSuggestionMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/input/TextSuggestionMenuTest.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f3db74c2b3c39156ce0f5b8ffba5483a75f2c7b6 |
--- /dev/null |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/input/TextSuggestionMenuTest.java |
@@ -0,0 +1,61 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.chrome.browser.input; |
+ |
+import android.support.test.filters.LargeTest; |
+import android.view.View; |
+ |
+import org.junit.Assert; |
+ |
+import org.chromium.chrome.browser.ChromeActivity; |
+import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
+import org.chromium.content.R; |
+import org.chromium.content.browser.ContentViewCore; |
+import org.chromium.content.browser.test.util.Criteria; |
+import org.chromium.content.browser.test.util.CriteriaHelper; |
+import org.chromium.content.browser.test.util.DOMUtils; |
+import org.chromium.content.browser.test.util.TouchCommon; |
+ |
+import java.util.concurrent.TimeoutException; |
+ |
+/** |
+ * Integration tests for the text suggestion menu. |
+ */ |
+public class TextSuggestionMenuTest extends ChromeActivityTestCaseBase<ChromeActivity> { |
+ private static final String URL = |
+ "data:text/html, <div contenteditable id=\"div\">iuvwneaoanls</div>"; |
+ |
+ public TextSuggestionMenuTest() { |
+ super(ChromeActivity.class); |
+ } |
+ |
+ @Override |
+ public void startMainActivity() throws InterruptedException { |
+ startMainActivityOnBlankPage(); |
+ } |
+ |
+ @LargeTest |
+ public void testDeleteMisspelledWord() throws InterruptedException, TimeoutException { |
+ loadUrl(URL); |
+ final ContentViewCore cvc = getActivity().getActivityTab().getContentViewCore(); |
+ DOMUtils.focusNode(cvc.getWebContents(), "div"); |
+ DOMUtils.clickNode(cvc, "div"); |
+ |
+ // Wait for the suggestion menu to show |
+ CriteriaHelper.pollUiThread(new Criteria() { |
+ @Override |
+ public boolean isSatisfied() { |
+ return cvc.getTextSuggestionHostForTesting().getSuggestionsPopupWindowForTesting() |
+ != null; |
+ } |
+ }); |
+ |
+ View view = cvc.getTextSuggestionHostForTesting() |
+ .getSuggestionsPopupWindowForTesting() |
+ .getContentViewForTesting(); |
+ TouchCommon.singleClickView(view.findViewById(R.id.deleteButton)); |
+ Assert.assertEquals("", DOMUtils.getNodeContents(cvc.getWebContents(), "div")); |
+ } |
+} |