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

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

Issue 1379183003: [ContextualSearch] Adds long press promo for Contextual Search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing more comments Created 5 years, 2 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 8ad5673ec0e4ef5492fef7147b266f742c4617da..aff355a7474728e1f795dd67e188faceca2b0db6 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
@@ -1945,4 +1945,41 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
false, -14, 0);
waitForSelectionToBe("United States Intelligence");
}
+
+ /**
+ * Tests that long-press triggers the Peek Promo, and expanding the Panel dismisses it.
+ */
+ @SmallTest
+ @Feature({"ContextualSearch"})
+ @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
+ @CommandLineFlags.Add(ContextualSearchFieldTrial.PEEK_PROMO_ENABLED + "=true")
+ public void testLongPressShowsPeekPromo() throws InterruptedException, TimeoutException {
+ // Must be in undecided state in order to trigger the Peek Promo.
+ mPolicy.overrideDecidedStateForTesting(false);
+ // Must have never opened the Panel in order to trigger the Peek Promo.
+ assertEquals(0, mPolicy.getPromoOpenCount());
+
+ // Long press and make sure the Promo shows.
+ longPressNode("intelligence");
+ waitForPanelToPeekAndAssert();
+ assertTrue(mPanelDelegate.isPeekPromoVisible());
+
+ // After expanding the Panel the Promo should be invisible.
+ swipePanelUp();
+ waitForPanelToExpandAndAssert();
+ assertFalse(mPanelDelegate.isPeekPromoVisible());
+
+ // After closing the Panel the Promo should still be invisible.
+ tapBasePageToClosePanel();
+ assertFalse(mPanelDelegate.isPeekPromoVisible());
+
+ // Click elsewhere to clear the selection.
+ clickNode("question-mark");
+ waitForSelectionToBe(null);
+
+ // Now that the Panel was opened at least once, the Promo should not show again.
+ longPressNode("intelligence");
+ waitForPanelToPeekAndAssert();
+ assertFalse(mPanelDelegate.isPeekPromoVisible());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698