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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java

Issue 1589023003: [Contextual Search] Enable for fullscreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 months 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
Index: chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
index 9259b745fea7bf8f743fde9e125af81f75c42769..6c200881291b75cc0f6e1e609d7e208c821c1983 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -48,6 +48,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelUtils;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeTabUtils;
+import org.chromium.chrome.test.util.FullscreenTestUtils;
import org.chromium.chrome.test.util.OmniboxTestUtils;
import org.chromium.chrome.test.util.TestHttpServerClient;
import org.chromium.components.navigation_interception.NavigationParams;
@@ -2544,4 +2545,58 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
// Make sure we did not try to trigger translate.
assertFalse(mManager.getRequest().isTranslationForced());
}
+
+ /**
+ * Tests that Contextual Search works in fullscreen. Specifically, tests that tapping a word
+ * peeks the panel, expanding the bar results in the bar ending at the correct spot in the page
+ * and tapping the base page closes the panel.
+ */
+ @SmallTest
+ @Feature({"ContextualSearch"})
+ @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
+ public void testTapContentAndExpandPanelInFullscreen()
+ throws InterruptedException, TimeoutException {
+ // Toggle tab to fulllscreen.
+ FullscreenTestUtils.togglePersistentFullscreenAndAssert(getActivity().getActivityTab(),
+ true, getActivity());
+
+ // Simulate a tap and assert that the panel peeks.
+ simulateTapSearch("search");
+
+ // Expand the panel and assert that it ends up in the right place.
+ tapPeekingBarToExpandAndAssert();
+ assertEquals(mManager.getContextualSearchPanel().getHeight(),
+ mManager.getContextualSearchPanel().getPanelHeightFromState(PanelState.EXPANDED));
+
+ // Tap the base page and assert that the panel is closed.
+ tapBasePageToClosePanel();
+ }
+
+ /**
+ * Tests that the Contextual Search panel is dismissed when entering or exiting fullscreen.
+ */
+ @SmallTest
+ @Feature({"ContextualSearch"})
+ @Restriction({RESTRICTION_TYPE_NON_LOW_END_DEVICE})
+ public void testPanelDismissedOnToggleFullscreen()
+ throws InterruptedException, TimeoutException {
+ // Simulate a tap and assert that the panel peeks.
+ simulateTapSearch("search");
+
+ // Toggle tab to fullscreen.
+ Tab tab = getActivity().getActivityTab();
+ FullscreenTestUtils.togglePersistentFullscreenAndAssert(tab, true, getActivity());
+
+ // Assert that the panel is closed.
+ waitForPanelToClose();
+
+ // Simulate a tap and assert that the panel peeks.
+ simulateTapSearch("search");
+
+ // Toggle tab to non-fullscreen.
+ FullscreenTestUtils.togglePersistentFullscreenAndAssert(tab, false, getActivity());
+
+ // Assert that the panel is closed.
+ waitForPanelToClose();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698