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

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

Issue 1463583004: [Contextual Search] Trigger translation on long-press. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tiny tweak. Created 5 years, 1 month 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 | « chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRequest.java ('k') | 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/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 78e8c44bae85454c677247e1bf45bbbac62c56f7..15a6814bb9839e561099c1f5cb9dd42c579460d0 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
@@ -2585,4 +2585,51 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
// Make sure we did not try to trigger translate.
assertFalse(mManager.getRequest().isTranslationForced());
}
+
+ /**
+ * Tests that a long-press does trigger translation.
+ */
+ @SmallTest
+ @Feature({"ContextualSearch"})
+ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+ public void testLongpressTranslates() throws InterruptedException, TimeoutException {
+ // LongPress on any word should trigger translation.
+ simulateLongPressSearch("search");
+
+ // Make sure we did try to trigger translate.
+ assertTrue(mManager.getRequest().isTranslationForced());
+ }
+
+ /**
+ * Tests that a long-press does trigger translation.
+ */
+ @SmallTest
+ @Feature({"ContextualSearch"})
+ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+ @CommandLineFlags.Add(ContextualSearchFieldTrial.DISABLE_AUTO_DETECT_TRANSLATION_ONEBOX
+ + "=true")
+ public void testLongpressAutoDetectDisabledDoesNotTranslate()
+ throws InterruptedException, TimeoutException {
+ // Unless disabled, LongPress on any word should trigger translation.
+ simulateLongPressSearch("search");
+
+ // Make sure we did not try to trigger translate.
+ assertFalse(mManager.getRequest().isTranslationForced());
+ }
+
+ /**
+ * Tests that a long-press does trigger translation.
+ */
+ @SmallTest
+ @Feature({"ContextualSearch"})
+ @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
+ @CommandLineFlags.Add(ContextualSearchFieldTrial.DISABLE_FORCE_TRANSLATION_ONEBOX + "=true")
+ public void testLongpressTranslateDisabledDoesNotTranslate()
+ throws InterruptedException, TimeoutException {
+ // Unless disabled, LongPress on any word should trigger translation.
+ simulateLongPressSearch("search");
+
+ // Make sure we did not try to trigger translate.
+ assertFalse(mManager.getRequest().isTranslationForced());
+ }
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRequest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698