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

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

Issue 1410533005: [Contextual Search] Re-enabling tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.contextualsearch; 5 package org.chromium.chrome.browser.contextualsearch;
6 6
7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE; 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE;
8 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE; 8 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
9 import static org.chromium.content.browser.test.util.CriteriaHelper.DEFAULT_POLL ING_INTERVAL; 9 import static org.chromium.content.browser.test.util.CriteriaHelper.DEFAULT_POLL ING_INTERVAL;
10 10
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 testSwipeExpand(); 1053 testSwipeExpand();
1054 getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PO RTRAIT); 1054 getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PO RTRAIT);
1055 } 1055 }
1056 1056
1057 /** 1057 /**
1058 * Tests tap to expand, after an initial tap to activate the peeking card. 1058 * Tests tap to expand, after an initial tap to activate the peeking card.
1059 * 1059 *
1060 * @SmallTest 1060 * @SmallTest
1061 * @Feature({"ContextualSearch"}) 1061 * @Feature({"ContextualSearch"})
1062 */ 1062 */
1063 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 1063 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
1064 @FlakyTest 1064 @FlakyTest
1065 public void testTapExpand() throws InterruptedException, TimeoutException { 1065 public void testTapExpand() throws InterruptedException, TimeoutException {
1066 assertNoSearchesLoaded(); 1066 assertNoSearchesLoaded();
1067 clickWordNode("states"); 1067 clickWordNode("states");
1068 assertNoContentViewCore(); 1068 assertNoContentViewCore();
1069 assertNoSearchesLoaded(); 1069 assertNoSearchesLoaded();
1070 1070
1071 // Fake a search term resolution response. 1071 // Fake a search term resolution response.
1072 fakeResponse(false, 200, "states", "United States Intelligence", "altern ate-term", false); 1072 fakeResponse(false, 200, "states", "United States Intelligence", "altern ate-term", false);
1073 assertContainsParameters("states", "alternate-term"); 1073 assertContainsParameters("states", "alternate-term");
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 * Tests the TapN-promo-limit feature, which disables the promo on tap after N taps if 1854 * Tests the TapN-promo-limit feature, which disables the promo on tap after N taps if
1855 * the user has never ever opened the panel. Once the panel is opened, this limiting-feature 1855 * the user has never ever opened the panel. Once the panel is opened, this limiting-feature
1856 * is permanently disabled. 1856 * is permanently disabled.
1857 * 1857 *
1858 * This test is very similar to an existing test for this same feature, so I 'm proactively 1858 * This test is very similar to an existing test for this same feature, so I 'm proactively
1859 * marking this as a FlakyTest too (since we're landing right before upstrea ming). 1859 * marking this as a FlakyTest too (since we're landing right before upstrea ming).
1860 * 1860 *
1861 * @SmallTest 1861 * @SmallTest
1862 * @Feature({"ContextualSearch"}) 1862 * @Feature({"ContextualSearch"})
1863 */ 1863 */
1864 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 1864 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
1865 @CommandLineFlags.Add({ 1865 @CommandLineFlags.Add({
1866 ContextualSearchFieldTrial.PROMO_ON_LIMITED_TAPS + "=true", 1866 ContextualSearchFieldTrial.PROMO_ON_LIMITED_TAPS + "=true",
1867 ContextualSearchFieldTrial.TAP_TRIGGERED_PROMO_LIMIT + "=2"}) 1867 ContextualSearchFieldTrial.TAP_TRIGGERED_PROMO_LIMIT + "=2"})
1868 @FlakyTest 1868 @FlakyTest
1869 public void testPromoTapCount() throws InterruptedException, TimeoutExceptio n { 1869 public void testPromoTapCount() throws InterruptedException, TimeoutExceptio n {
1870 // Note that this tests the basic underlying counter used by 1870 // Note that this tests the basic underlying counter used by
1871 // testTapTriggeredPromoLimitForOptOut. 1871 // testTapTriggeredPromoLimitForOptOut.
1872 // TODO(donnd): consider removing either this test or testTapTriggeredPr omoLimitForOptOut. 1872 // TODO(donnd): consider removing either this test or testTapTriggeredPr omoLimitForOptOut.
1873 mPolicy.overrideDecidedStateForTesting(false); 1873 mPolicy.overrideDecidedStateForTesting(false);
1874 assertTapPromoCounterEnabledAt(0); 1874 assertTapPromoCounterEnabledAt(0);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 assertFalse(mPanel.isPeekPromoVisible()); 2249 assertFalse(mPanel.isPeekPromoVisible());
2250 } 2250 }
2251 2251
2252 //========================================================================== ================== 2252 //========================================================================== ==================
2253 // Content Tests 2253 // Content Tests
2254 //========================================================================== ================== 2254 //========================================================================== ==================
2255 2255
2256 /** 2256 /**
2257 * Tests that tap followed by expand makes Content visible. 2257 * Tests that tap followed by expand makes Content visible.
2258 */ 2258 */
2259 @DisabledTest // https://crbug.com/551711
2260 @SmallTest 2259 @SmallTest
2261 @Feature({"ContextualSearch"}) 2260 @Feature({"ContextualSearch"})
2262 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) 2261 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
2263 public void testTapContentVisibility() throws InterruptedException, TimeoutE xception { 2262 public void testTapContentVisibility() throws InterruptedException, TimeoutE xception {
2264 // Simulate a tap and make sure Content is not visible. 2263 // Simulate a tap and make sure Content is not visible.
2265 simulateTapSearch("search"); 2264 simulateTapSearch("search");
2266 assertContentViewCoreCreatedButNeverMadeVisible(); 2265 assertContentViewCoreCreatedButNeverMadeVisible();
2267 2266
2268 // Expanding the Panel should make the Content visible. 2267 // Expanding the Panel should make the Content visible.
2269 tapPeekingBarToExpandAndAssert(); 2268 tapPeekingBarToExpandAndAssert();
2270 assertContentViewCoreVisible(); 2269 assertContentViewCoreVisible();
2271 2270
2272 // Closing the Panel should destroy the Content. 2271 // Closing the Panel should destroy the Content.
2273 tapBasePageToClosePanel(); 2272 tapBasePageToClosePanel();
2274 assertNoContentViewCore(); 2273 assertNoContentViewCore();
2275 } 2274 }
2276 2275
2277 /** 2276 /**
2278 * Tests that long press followed by expand creates Content and makes it vis ible. 2277 * Tests that long press followed by expand creates Content and makes it vis ible.
2279 * 2278 *
2280 */ 2279 */
2281 @DisabledTest // https://crbug.com/551711
2282 @SmallTest 2280 @SmallTest
2283 @Feature({"ContextualSearch"}) 2281 @Feature({"ContextualSearch"})
2284 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) 2282 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
2285 public void testLongPressContentVisibility() throws InterruptedException, Ti meoutException { 2283 public void testLongPressContentVisibility() throws InterruptedException, Ti meoutException {
2286 // Simulate a long press and make sure no Content is created. 2284 // Simulate a long press and make sure no Content is created.
2287 simulateLongPressSearch("search"); 2285 simulateLongPressSearch("search");
2288 assertNoContentViewCore(); 2286 assertNoContentViewCore();
2289 assertNoSearchesLoaded(); 2287 assertNoSearchesLoaded();
2290 2288
2291 // Expanding the Panel should make the Content visible. 2289 // Expanding the Panel should make the Content visible.
2292 tapPeekingBarToExpandAndAssert(); 2290 tapPeekingBarToExpandAndAssert();
2293 assertContentViewCoreCreated(); 2291 assertContentViewCoreCreated();
2294 assertContentViewCoreVisible(); 2292 assertContentViewCoreVisible();
2295 2293
2296 // Closing the Panel should destroy the Content. 2294 // Closing the Panel should destroy the Content.
2297 tapBasePageToClosePanel(); 2295 tapBasePageToClosePanel();
2298 assertNoContentViewCore(); 2296 assertNoContentViewCore();
2299 } 2297 }
2300 2298
2301 /** 2299 /**
2302 * Tests swiping panel up and down after a tap search will only load the Con tent once. 2300 * Tests swiping panel up and down after a tap search will only load the Con tent once.
2303 */ 2301 */
2304 @DisabledTest // https://crbug.com/551711
2305 @SmallTest 2302 @SmallTest
2306 @Feature({"ContextualSearch"}) 2303 @Feature({"ContextualSearch"})
2307 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 2304 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
2308 public void testTapMultipleSwipeOnlyLoadsContentOnce() 2305 public void testTapMultipleSwipeOnlyLoadsContentOnce()
2309 throws InterruptedException, TimeoutException { 2306 throws InterruptedException, TimeoutException {
2310 // Simulate a tap and make sure Content is not visible. 2307 // Simulate a tap and make sure Content is not visible.
2311 simulateTapSearch("search"); 2308 simulateTapSearch("search");
2312 assertContentViewCoreCreatedButNeverMadeVisible(); 2309 assertContentViewCoreCreatedButNeverMadeVisible();
2313 assertEquals(1, mFakeServer.getLoadedUrlCount()); 2310 assertEquals(1, mFakeServer.getLoadedUrlCount());
2314 2311
2315 // Expanding the Panel should make the Content visible. 2312 // Expanding the Panel should make the Content visible.
2316 tapPeekingBarToExpandAndAssert(); 2313 tapPeekingBarToExpandAndAssert();
2317 assertContentViewCoreVisible(); 2314 assertContentViewCoreVisible();
(...skipping 12 matching lines...) Expand all
2330 2327
2331 // Closing the Panel should destroy the Content. 2328 // Closing the Panel should destroy the Content.
2332 tapBasePageToClosePanel(); 2329 tapBasePageToClosePanel();
2333 assertNoContentViewCore(); 2330 assertNoContentViewCore();
2334 assertEquals(1, mFakeServer.getLoadedUrlCount()); 2331 assertEquals(1, mFakeServer.getLoadedUrlCount());
2335 } 2332 }
2336 2333
2337 /** 2334 /**
2338 * Tests swiping panel up and down after a long press search will only load the Content once. 2335 * Tests swiping panel up and down after a long press search will only load the Content once.
2339 */ 2336 */
2340 @DisabledTest // https://crbug.com/551711
2341 @SmallTest 2337 @SmallTest
2342 @Feature({"ContextualSearch"}) 2338 @Feature({"ContextualSearch"})
2343 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 2339 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
2344 public void testLongPressMultipleSwipeOnlyLoadsContentOnce() 2340 public void testLongPressMultipleSwipeOnlyLoadsContentOnce()
2345 throws InterruptedException, TimeoutException { 2341 throws InterruptedException, TimeoutException {
2346 // Simulate a long press and make sure no Content is created. 2342 // Simulate a long press and make sure no Content is created.
2347 simulateLongPressSearch("search"); 2343 simulateLongPressSearch("search");
2348 assertNoContentViewCore(); 2344 assertNoContentViewCore();
2349 assertNoSearchesLoaded(); 2345 assertNoSearchesLoaded();
2350 2346
2351 // Expanding the Panel should load the URL and make the Content visible. 2347 // Expanding the Panel should load the URL and make the Content visible.
2352 tapPeekingBarToExpandAndAssert(); 2348 tapPeekingBarToExpandAndAssert();
2353 assertContentViewCoreCreated(); 2349 assertContentViewCoreCreated();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2405 2401
2406 // Closing the Panel should destroy the Content. 2402 // Closing the Panel should destroy the Content.
2407 tapBasePageToClosePanel(); 2403 tapBasePageToClosePanel();
2408 assertNoContentViewCore(); 2404 assertNoContentViewCore();
2409 assertEquals(3, mFakeServer.getLoadedUrlCount()); 2405 assertEquals(3, mFakeServer.getLoadedUrlCount());
2410 } 2406 }
2411 2407
2412 /** 2408 /**
2413 * Tests that chained searches load correctly. 2409 * Tests that chained searches load correctly.
2414 */ 2410 */
2415 @DisabledTest // https://crbug.com/551711
2416 @SmallTest 2411 @SmallTest
2417 @Feature({"ContextualSearch"}) 2412 @Feature({"ContextualSearch"})
2418 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 2413 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
2419 public void testChainedSearchLoadsCorrectSearchTerm() 2414 public void testChainedSearchLoadsCorrectSearchTerm()
2420 throws InterruptedException, TimeoutException { 2415 throws InterruptedException, TimeoutException {
2421 // Simulate a tap and make sure Content is not visible. 2416 // Simulate a tap and make sure Content is not visible.
2422 simulateTapSearch("search"); 2417 simulateTapSearch("search");
2423 assertContentViewCoreCreatedButNeverMadeVisible(); 2418 assertContentViewCoreCreatedButNeverMadeVisible();
2424 assertEquals(1, mFakeServer.getLoadedUrlCount()); 2419 assertEquals(1, mFakeServer.getLoadedUrlCount());
2425 ContentViewCore cvc1 = getPanelContentViewCore(); 2420 ContentViewCore cvc1 = getPanelContentViewCore();
2426 2421
2427 // Expanding the Panel should make the Content visible. 2422 // Expanding the Panel should make the Content visible.
2428 tapPeekingBarToExpandAndAssert(); 2423 tapPeekingBarToExpandAndAssert();
(...skipping 22 matching lines...) Expand all
2451 2446
2452 // Closing the Panel should destroy the Content. 2447 // Closing the Panel should destroy the Content.
2453 tapBasePageToClosePanel(); 2448 tapBasePageToClosePanel();
2454 assertNoContentViewCore(); 2449 assertNoContentViewCore();
2455 assertEquals(2, mFakeServer.getLoadedUrlCount()); 2450 assertEquals(2, mFakeServer.getLoadedUrlCount());
2456 } 2451 }
2457 2452
2458 /** 2453 /**
2459 * Tests that chained searches make Content visible when opening the Panel. 2454 * Tests that chained searches make Content visible when opening the Panel.
2460 */ 2455 */
2461 @DisabledTest // https://crbug.com/551711
2462 @SmallTest 2456 @SmallTest
2463 @Feature({"ContextualSearch"}) 2457 @Feature({"ContextualSearch"})
2464 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) 2458 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
2465 public void testChainedSearchContentVisibility() throws InterruptedException , TimeoutException { 2459 public void testChainedSearchContentVisibility() throws InterruptedException , TimeoutException {
2466 // Simulate a tap and make sure Content is not visible. 2460 // Simulate a tap and make sure Content is not visible.
2467 simulateTapSearch("search"); 2461 simulateTapSearch("search");
2468 assertContentViewCoreCreatedButNeverMadeVisible(); 2462 assertContentViewCoreCreatedButNeverMadeVisible();
2469 assertEquals(1, mFakeServer.getLoadedUrlCount()); 2463 assertEquals(1, mFakeServer.getLoadedUrlCount());
2470 ContentViewCore cvc1 = getPanelContentViewCore(); 2464 ContentViewCore cvc1 = getPanelContentViewCore();
2471 2465
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 // Close the Panel without seeing the Content. 2500 // Close the Panel without seeing the Content.
2507 tapBasePageToClosePanel(); 2501 tapBasePageToClosePanel();
2508 2502
2509 // Now check that the URL has been removed from history. 2503 // Now check that the URL has been removed from history.
2510 assertTrue(mFakeServer.hasRemovedUrl(url)); 2504 assertTrue(mFakeServer.hasRemovedUrl(url));
2511 } 2505 }
2512 2506
2513 /** 2507 /**
2514 * Tests that a tap followed by opening the Panel does not remove the loaded URL from history. 2508 * Tests that a tap followed by opening the Panel does not remove the loaded URL from history.
2515 */ 2509 */
2516 @DisabledTest // https://crbug.com/551711
2517 @SmallTest 2510 @SmallTest
2518 @Feature({"ContextualSearch"}) 2511 @Feature({"ContextualSearch"})
2519 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE}) 2512 @Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
2520 public void testTapExpandNotRemovedFromHistory() 2513 public void testTapExpandNotRemovedFromHistory()
2521 throws InterruptedException, TimeoutException { 2514 throws InterruptedException, TimeoutException {
2522 // Simulate a tap and make sure a URL was loaded. 2515 // Simulate a tap and make sure a URL was loaded.
2523 simulateTapSearch("search"); 2516 simulateTapSearch("search");
2524 assertEquals(1, mFakeServer.getLoadedUrlCount()); 2517 assertEquals(1, mFakeServer.getLoadedUrlCount());
2525 String url = mFakeServer.getLoadedUrl(); 2518 String url = mFakeServer.getLoadedUrl();
2526 2519
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2594 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 2587 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
2595 @CommandLineFlags.Add(ContextualSearchFieldTrial.TRANSLATION_ONEBOX_ENABLED + "=true") 2588 @CommandLineFlags.Add(ContextualSearchFieldTrial.TRANSLATION_ONEBOX_ENABLED + "=true")
2596 public void testTapWithoutLanguage() throws InterruptedException, TimeoutExc eption { 2589 public void testTapWithoutLanguage() throws InterruptedException, TimeoutExc eption {
2597 // Tapping an English word should NOT trigger translation. 2590 // Tapping an English word should NOT trigger translation.
2598 simulateTapSearch("search"); 2591 simulateTapSearch("search");
2599 2592
2600 // Make sure we did not try to trigger translate. 2593 // Make sure we did not try to trigger translate.
2601 assertFalse(mManager.getRequest().isTranslationForced()); 2594 assertFalse(mManager.getRequest().isTranslationForced());
2602 } 2595 }
2603 } 2596 }
OLDNEW
« 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