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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java

Issue 2595713002: Fixed and added Find-in-page tests (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java
index 6b6ce25d589ca9559946c133824170c5571c674b..94355d1f439b88785fde53c190185b6feb19d211 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/widget/findinpage/FindTest.java
@@ -28,7 +28,9 @@ import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.FlakyTest;
import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
+import org.chromium.chrome.test.util.FullscreenTestUtils;
import org.chromium.chrome.test.util.MenuUtils;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
@@ -224,6 +226,46 @@ public class FindTest extends ChromeTabbedActivityTestBase {
waitForFindResults("1/7");
}
+ /**
+ * Verify that Next/Previous buttons are disabled whenever there is no match.
+ */
+ @MediumTest
+ @Feature({"FindInPage"})
+ @RetryOnFailure
+ public void testFindNextPreviousOnNoMatch() throws InterruptedException {
+ loadTestAndVerifyFindInPage("pp", "0/0");
+
+ final TextView findQueryText = getFindQueryText();
+ View next = getActivity().findViewById(R.id.find_next_button);
+ View prev = getActivity().findViewById(R.id.find_prev_button);
+ assertFalse(next.isEnabled());
+ assertFalse(prev.isEnabled());
+
+ KeyUtils.singleKeyEventView(getInstrumentation(), findQueryText, KeyEvent.KEYCODE_DEL);
+ KeyUtils.singleKeyEventView(getInstrumentation(), findQueryText, KeyEvent.KEYCODE_DEL);
+
+ loadTestAndVerifyFindInPage("pitts", "1/7");
+ assertTrue(next.isEnabled());
+ assertTrue(prev.isEnabled());
+ }
+
+ /**
+ * Verify that Find in page toolbar is dismissed on entering fullscreen.
+ */
+ @MediumTest
+ @Feature({"FindInPage"})
+ @RetryOnFailure
+ public void testFullscreen() throws InterruptedException {
+ loadTestAndVerifyFindInPage("pitts", "1/7");
+
+ Tab tab = getActivity().getActivityTab();
+ FullscreenTestUtils.togglePersistentFullscreenAndAssert(tab, true, getActivity());
+ waitForFindInPageVisibility(false);
+
+ FullscreenTestUtils.togglePersistentFullscreenAndAssert(tab, false, getActivity());
+ waitForFindInPageVisibility(false);
+ }
+
@MediumTest
@Feature({"FindInPage"})
@RetryOnFailure
@@ -379,10 +421,7 @@ public class FindTest extends ChromeTabbedActivityTestBase {
@Feature({"FindInPage"})
@RetryOnFailure
public void testBackKeyDismissesFind() throws InterruptedException {
- loadUrl(mTestServer.getURL(FILEPATH));
- findInPageFromMenu();
- final TextView findQueryText = getFindQueryText();
- KeyUtils.singleKeyEventView(getInstrumentation(), findQueryText, KeyEvent.KEYCODE_A);
+ loadTestAndVerifyFindInPage("pitts", "1/7");
waitForIME(true);
// Hide IME by clicking next button from find tool bar.
singleClickView(getActivity().findViewById(R.id.find_next_button));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698