OLD | NEW |
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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 fling(0.f, 0.75f, 0.f, 0.7f, 100); | 742 fling(0.f, 0.75f, 0.f, 0.7f, 100); |
743 } | 743 } |
744 | 744 |
745 /** | 745 /** |
746 * Taps the base page near the top. | 746 * Taps the base page near the top. |
747 */ | 747 */ |
748 private void tapBasePageToClosePanel() throws InterruptedException { | 748 private void tapBasePageToClosePanel() throws InterruptedException { |
749 // TODO(pedrosimonetti): This is not reliable. Find a better approach. | 749 // TODO(pedrosimonetti): This is not reliable. Find a better approach. |
750 // We use the far right side (x == 0.9f) to prevent simulating a tap on
top of an | 750 // We use the far right side (x == 0.9f) to prevent simulating a tap on
top of an |
751 // existing long-press selection (the pins are a tap target). This might
not work on RTL. | 751 // existing long-press selection (the pins are a tap target). This might
not work on RTL. |
752 // We are using y == 0.2f because otherwise it will fail for long press
cases. | 752 // We are using y == 0.35f because otherwise it will fail for long press
cases. |
753 // It might be better to get the position of the Panel and tap just abou
t outside | 753 // It might be better to get the position of the Panel and tap just abou
t outside |
754 // the Panel. I suspect some Flaky tests are caused by this problem (one
s involving | 754 // the Panel. I suspect some Flaky tests are caused by this problem (one
s involving |
755 // long press and trying to close with the bar peeking, with a long pres
s selection | 755 // long press and trying to close with the bar peeking, with a long pres
s selection |
756 // established). | 756 // established). |
757 tapBasePage(0.9f, 0.2f); | 757 tapBasePage(0.9f, 0.35f); |
758 waitForPanelToCloseAndAssert(); | 758 waitForPanelToCloseAndAssert(); |
759 } | 759 } |
760 | 760 |
761 /** | 761 /** |
762 * Taps the base page at the given x, y position. | 762 * Taps the base page at the given x, y position. |
763 */ | 763 */ |
764 private void tapBasePage(float x, float y) { | 764 private void tapBasePage(float x, float y) { |
765 View root = getActivity().getWindow().getDecorView().getRootView(); | 765 View root = getActivity().getWindow().getDecorView().getRootView(); |
766 x *= root.getWidth(); | 766 x *= root.getWidth(); |
767 y *= root.getHeight(); | 767 y *= root.getHeight(); |
(...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2579 @Feature({"ContextualSearch"}) | 2579 @Feature({"ContextualSearch"}) |
2580 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) | 2580 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) |
2581 public void testTapWithoutLanguage() throws InterruptedException, TimeoutExc
eption { | 2581 public void testTapWithoutLanguage() throws InterruptedException, TimeoutExc
eption { |
2582 // Tapping an English word should NOT trigger translation. | 2582 // Tapping an English word should NOT trigger translation. |
2583 simulateTapSearch("search"); | 2583 simulateTapSearch("search"); |
2584 | 2584 |
2585 // Make sure we did not try to trigger translate. | 2585 // Make sure we did not try to trigger translate. |
2586 assertFalse(mManager.getRequest().isTranslationForced()); | 2586 assertFalse(mManager.getRequest().isTranslationForced()); |
2587 } | 2587 } |
2588 } | 2588 } |
OLD | NEW |