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.content.browser.test.util.CriteriaHelper.DEFAULT_POLL ING_INTERVAL; | 8 import static org.chromium.content.browser.test.util.CriteriaHelper.DEFAULT_POLL ING_INTERVAL; |
9 | 9 |
10 import android.app.Activity; | 10 import android.app.Activity; |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 | 795 |
796 /** | 796 /** |
797 * Scrolls the base page. | 797 * Scrolls the base page. |
798 */ | 798 */ |
799 private void scrollBasePage() { | 799 private void scrollBasePage() { |
800 // TODO(pedrosimonetti): Consider using a swipe method instead. | 800 // TODO(pedrosimonetti): Consider using a swipe method instead. |
801 fling(0.f, 0.75f, 0.f, 0.7f, 100); | 801 fling(0.f, 0.75f, 0.f, 0.7f, 100); |
802 } | 802 } |
803 | 803 |
804 /** | 804 /** |
805 * Taps the base page near the top. | |
806 */ | |
807 private void tapBasePageToClosePanel() throws InterruptedException { | |
808 // TODO(pedrosimonetti): This is not reliable. Find a better approach. | |
809 // We use the far right side (x == 0.9f) to prevent simulating a tap on top of an | |
810 // existing long-press selection (the pins are a tap target). This might not work on RTL. | |
811 // We are using y == 0.35f because otherwise it will fail for long press cases. | |
812 // It might be better to get the position of the Panel and tap just abou t outside | |
813 // the Panel. I suspect some Flaky tests are caused by this problem (one s involving | |
814 // long press and trying to close with the bar peeking, with a long pres s selection | |
815 // established). | |
816 tapBasePage(0.9f, 0.35f); | |
817 waitForPanelToClose(); | |
818 } | |
819 | |
820 /** | |
821 * Taps the base page at the given x, y position. | 805 * Taps the base page at the given x, y position. |
822 */ | 806 */ |
823 private void tapBasePage(float x, float y) { | 807 private void tapBasePage(float x, float y) { |
Theresa
2016/09/12 22:59:19
Is this being used anywhere anymore?
Donn Denman
2016/09/14 00:18:22
Removed. Also consolidated to methods just below.
| |
824 View root = getActivity().getWindow().getDecorView().getRootView(); | 808 View root = getActivity().getWindow().getDecorView().getRootView(); |
825 x *= root.getWidth(); | 809 x *= root.getWidth(); |
826 y *= root.getHeight(); | 810 y *= root.getHeight(); |
827 TouchCommon.singleClickView(root, (int) x, (int) y); | 811 TouchCommon.singleClickView(root, (int) x, (int) y); |
828 } | 812 } |
829 | 813 |
830 /** | 814 /** |
831 * Click various places to cause the panel to show, expand, then close. | 815 * Click various places to cause the panel to show, expand, then close. |
832 */ | 816 */ |
833 private void clickToExpandAndClosePanel() throws InterruptedException, Timeo utException { | 817 private void clickToExpandAndClosePanel() throws InterruptedException, Timeo utException { |
834 clickWordNode("states"); | 818 clickWordNode("states"); |
835 tapBarToExpandAndClosePanel(); | 819 tapBarToExpandAndClosePanel(); |
836 waitForSelectionDissolved(); | 820 waitForSelectionDissolved(); |
837 } | 821 } |
838 | 822 |
839 /** | 823 /** |
840 * Tap on the peeking Bar to expand the panel, then taps on the base page to close it. | 824 * Tap on the peeking Bar to expand the panel, then taps on the base page to close it. |
Theresa
2016/09/12 22:59:19
this comment needs to be updated.
Donn Denman
2016/09/14 00:18:22
Removed due to consolidation.
Cleaned up a few
| |
841 */ | 825 */ |
842 private void tapBarToExpandAndClosePanel() throws InterruptedException { | 826 private void tapBarToExpandAndClosePanel() throws InterruptedException { |
843 tapPeekingBarToExpandAndAssert(); | 827 tapPeekingBarToExpandAndAssert(); |
844 tapBasePageToClosePanel(); | 828 closePanel(); |
845 } | 829 } |
846 | 830 |
847 /** | 831 /** |
848 * Generate a click in the panel's bar. | 832 * Generate a click in the panel's bar. |
849 * TODO(donnd): Replace this method with panelBarClick since this appears to be unreliable. | 833 * TODO(donnd): Replace this method with panelBarClick since this appears to be unreliable. |
850 * @barHeight The vertical position where the click should take place as a p ercentage | 834 * @barHeight The vertical position where the click should take place as a p ercentage |
851 * of the screen size. | 835 * of the screen size. |
852 */ | 836 */ |
853 private void clickPanelBar(float barPositionVertical) { | 837 private void clickPanelBar(float barPositionVertical) { |
854 View root = getActivity().getWindow().getDecorView().getRootView(); | 838 View root = getActivity().getWindow().getDecorView().getRootView(); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1094 | 1078 |
1095 waitForPanelToPeek(); | 1079 waitForPanelToPeek(); |
1096 assertLoadedNoUrl(); | 1080 assertLoadedNoUrl(); |
1097 assertNoContentViewCore(); | 1081 assertNoContentViewCore(); |
1098 flingPanelUp(); | 1082 flingPanelUp(); |
1099 waitForPanelToExpand(); | 1083 waitForPanelToExpand(); |
1100 assertContentViewCoreCreated(); | 1084 assertContentViewCoreCreated(); |
1101 assertLoadedNormalPriorityUrl(); | 1085 assertLoadedNormalPriorityUrl(); |
1102 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 1086 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
1103 | 1087 |
1104 // tap the base page to close. | 1088 // close the panel. |
1105 tapBasePageToClosePanel(); | 1089 closePanel(); |
1106 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 1090 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
1107 assertNoContentViewCore(); | 1091 assertNoContentViewCore(); |
1108 } | 1092 } |
1109 | 1093 |
1110 /** | 1094 /** |
1111 * Tests that only a single low-priority request is issued for a Tap/Open se quence. | 1095 * Tests that only a single low-priority request is issued for a Tap/Open se quence. |
1112 */ | 1096 */ |
1113 @SmallTest | 1097 @SmallTest |
1114 @Feature({"ContextualSearch"}) | 1098 @Feature({"ContextualSearch"}) |
1115 @Restriction({RESTRICTION_TYPE_NON_LOW_END_DEVICE}) | 1099 @Restriction({RESTRICTION_TYPE_NON_LOW_END_DEVICE}) |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1699 @Feature({"ContextualSearch"}) | 1683 @Feature({"ContextualSearch"}) |
1700 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) | 1684 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) |
1701 @DisableIf.Build(supported_abis_includes = "arm64-v8a", message = "crbug.com /596533") | 1685 @DisableIf.Build(supported_abis_includes = "arm64-v8a", message = "crbug.com /596533") |
1702 public void testAppMenuSuppressedWhenExpanded() throws InterruptedException, TimeoutException { | 1686 public void testAppMenuSuppressedWhenExpanded() throws InterruptedException, TimeoutException { |
1703 clickWordNode("states"); | 1687 clickWordNode("states"); |
1704 tapPeekingBarToExpandAndAssert(); | 1688 tapPeekingBarToExpandAndAssert(); |
1705 | 1689 |
1706 pressAppMenuKey(); | 1690 pressAppMenuKey(); |
1707 assertAppMenuVisibility(false); | 1691 assertAppMenuVisibility(false); |
1708 | 1692 |
1709 tapBasePageToClosePanel(); | 1693 closePanel(); |
1710 | 1694 |
1711 pressAppMenuKey(); | 1695 pressAppMenuKey(); |
1712 assertAppMenuVisibility(true); | 1696 assertAppMenuVisibility(true); |
1713 } | 1697 } |
1714 | 1698 |
1715 /** | 1699 /** |
1716 * Tests that the App Menu gets suppressed when Search Panel is maximized. | 1700 * Tests that the App Menu gets suppressed when Search Panel is maximized. |
1717 */ | 1701 */ |
1718 @SmallTest | 1702 @SmallTest |
1719 @Feature({"ContextualSearch"}) | 1703 @Feature({"ContextualSearch"}) |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1875 @SmallTest | 1859 @SmallTest |
1876 @Feature({"ContextualSearch"}) | 1860 @Feature({"ContextualSearch"}) |
1877 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) | 1861 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) |
1878 public void testNotifyObserverHideAfterLongPress() | 1862 public void testNotifyObserverHideAfterLongPress() |
1879 throws InterruptedException, TimeoutException { | 1863 throws InterruptedException, TimeoutException { |
1880 TestContextualSearchObserver observer = new TestContextualSearchObserver (); | 1864 TestContextualSearchObserver observer = new TestContextualSearchObserver (); |
1881 mManager.addObserver(observer); | 1865 mManager.addObserver(observer); |
1882 longPressNode("states"); | 1866 longPressNode("states"); |
1883 assertEquals(0, observer.hideCount); | 1867 assertEquals(0, observer.hideCount); |
1884 | 1868 |
1885 tapBasePageToClosePanel(); | 1869 closePanel(); |
1886 assertEquals(1, observer.hideCount); | 1870 assertEquals(1, observer.hideCount); |
1887 } | 1871 } |
1888 | 1872 |
1889 /** | 1873 /** |
1890 * Tests that ContextualSearchObserver gets notified when user brings up con textual search | 1874 * Tests that ContextualSearchObserver gets notified when user brings up con textual search |
1891 * panel via tap and then dismisses the panel by tapping on the base page. | 1875 * panel via tap and then dismisses the panel by tapping on the base page. |
1892 */ | 1876 */ |
1893 @SmallTest | 1877 @SmallTest |
1894 @Feature({"ContextualSearch"}) | 1878 @Feature({"ContextualSearch"}) |
1895 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) | 1879 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) |
1896 public void testNotifyObserverHideAfterTap() throws InterruptedException, Ti meoutException { | 1880 public void testNotifyObserverHideAfterTap() throws InterruptedException, Ti meoutException { |
1897 TestContextualSearchObserver observer = new TestContextualSearchObserver (); | 1881 TestContextualSearchObserver observer = new TestContextualSearchObserver (); |
1898 mManager.addObserver(observer); | 1882 mManager.addObserver(observer); |
1899 clickWordNode("states"); | 1883 clickWordNode("states"); |
1900 assertEquals(0, observer.hideCount); | 1884 assertEquals(0, observer.hideCount); |
1901 | 1885 |
1902 tapBasePageToClosePanel(); | 1886 closePanel(); |
1903 assertEquals(1, observer.hideCount); | 1887 assertEquals(1, observer.hideCount); |
1904 } | 1888 } |
1905 | 1889 |
1906 private void assertWaitForSelectActionBarVisible(final boolean visible) | 1890 private void assertWaitForSelectActionBarVisible(final boolean visible) |
1907 throws InterruptedException { | 1891 throws InterruptedException { |
1908 CriteriaHelper.pollUiThread(Criteria.equals(visible, new Callable<Boolea n>() { | 1892 CriteriaHelper.pollUiThread(Criteria.equals(visible, new Callable<Boolea n>() { |
1909 @Override | 1893 @Override |
1910 public Boolean call() { | 1894 public Boolean call() { |
1911 return getActivity().getActivityTab().getContentViewCore() | 1895 return getActivity().getActivityTab().getContentViewCore() |
1912 .isSelectActionBarShowing(); | 1896 .isSelectActionBarShowing(); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2108 longPressNode("intelligence"); | 2092 longPressNode("intelligence"); |
2109 waitForPanelToPeek(); | 2093 waitForPanelToPeek(); |
2110 assertTrue(mPanel.isPeekPromoVisible()); | 2094 assertTrue(mPanel.isPeekPromoVisible()); |
2111 | 2095 |
2112 // After expanding the Panel the Promo should be invisible. | 2096 // After expanding the Panel the Promo should be invisible. |
2113 flingPanelUp(); | 2097 flingPanelUp(); |
2114 waitForPanelToExpand(); | 2098 waitForPanelToExpand(); |
2115 assertFalse(mPanel.isPeekPromoVisible()); | 2099 assertFalse(mPanel.isPeekPromoVisible()); |
2116 | 2100 |
2117 // After closing the Panel the Promo should still be invisible. | 2101 // After closing the Panel the Promo should still be invisible. |
2118 tapBasePageToClosePanel(); | 2102 closePanel(); |
2119 assertFalse(mPanel.isPeekPromoVisible()); | 2103 assertFalse(mPanel.isPeekPromoVisible()); |
2120 | 2104 |
2121 // Click elsewhere to clear the selection. | 2105 // Click elsewhere to clear the selection. |
2122 clickNode("question-mark"); | 2106 clickNode("question-mark"); |
2123 waitForSelectionToBe(null); | 2107 waitForSelectionToBe(null); |
2124 | 2108 |
2125 // Now that the Panel was opened at least once, the Promo should not sho w again. | 2109 // Now that the Panel was opened at least once, the Promo should not sho w again. |
2126 longPressNode("intelligence"); | 2110 longPressNode("intelligence"); |
2127 waitForPanelToPeek(); | 2111 waitForPanelToPeek(); |
2128 assertFalse(mPanel.isPeekPromoVisible()); | 2112 assertFalse(mPanel.isPeekPromoVisible()); |
(...skipping 12 matching lines...) Expand all Loading... | |
2141 public void testTapContentVisibility() throws InterruptedException, TimeoutE xception { | 2125 public void testTapContentVisibility() throws InterruptedException, TimeoutE xception { |
2142 // Simulate a tap and make sure Content is not visible. | 2126 // Simulate a tap and make sure Content is not visible. |
2143 simulateTapSearch("search"); | 2127 simulateTapSearch("search"); |
2144 assertContentViewCoreCreatedButNeverMadeVisible(); | 2128 assertContentViewCoreCreatedButNeverMadeVisible(); |
2145 | 2129 |
2146 // Expanding the Panel should make the Content visible. | 2130 // Expanding the Panel should make the Content visible. |
2147 tapPeekingBarToExpandAndAssert(); | 2131 tapPeekingBarToExpandAndAssert(); |
2148 assertContentViewCoreVisible(); | 2132 assertContentViewCoreVisible(); |
2149 | 2133 |
2150 // Closing the Panel should destroy the Content. | 2134 // Closing the Panel should destroy the Content. |
2151 tapBasePageToClosePanel(); | 2135 closePanel(); |
2152 assertNoContentViewCore(); | 2136 assertNoContentViewCore(); |
2153 } | 2137 } |
2154 | 2138 |
2155 /** | 2139 /** |
2156 * Tests that long press followed by expand creates Content and makes it vis ible. | 2140 * Tests that long press followed by expand creates Content and makes it vis ible. |
2157 * | 2141 * |
2158 */ | 2142 */ |
2159 @SmallTest | 2143 @SmallTest |
2160 @Feature({"ContextualSearch"}) | 2144 @Feature({"ContextualSearch"}) |
2161 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) | 2145 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) |
2162 public void testLongPressContentVisibility() throws InterruptedException, Ti meoutException { | 2146 public void testLongPressContentVisibility() throws InterruptedException, Ti meoutException { |
2163 // Simulate a long press and make sure no Content is created. | 2147 // Simulate a long press and make sure no Content is created. |
2164 simulateLongPressSearch("search"); | 2148 simulateLongPressSearch("search"); |
2165 assertNoContentViewCore(); | 2149 assertNoContentViewCore(); |
2166 assertNoSearchesLoaded(); | 2150 assertNoSearchesLoaded(); |
2167 | 2151 |
2168 // Expanding the Panel should make the Content visible. | 2152 // Expanding the Panel should make the Content visible. |
2169 tapPeekingBarToExpandAndAssert(); | 2153 tapPeekingBarToExpandAndAssert(); |
2170 assertContentViewCoreCreated(); | 2154 assertContentViewCoreCreated(); |
2171 assertContentViewCoreVisible(); | 2155 assertContentViewCoreVisible(); |
2172 | 2156 |
2173 // Closing the Panel should destroy the Content. | 2157 // Closing the Panel should destroy the Content. |
2174 tapBasePageToClosePanel(); | 2158 closePanel(); |
2175 assertNoContentViewCore(); | 2159 assertNoContentViewCore(); |
2176 } | 2160 } |
2177 | 2161 |
2178 /** | 2162 /** |
2179 * Tests swiping panel up and down after a tap search will only load the Con tent once. | 2163 * Tests swiping panel up and down after a tap search will only load the Con tent once. |
2180 */ | 2164 */ |
2181 @SmallTest | 2165 @SmallTest |
2182 @Feature({"ContextualSearch"}) | 2166 @Feature({"ContextualSearch"}) |
2183 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) | 2167 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) |
2184 public void testTapMultipleSwipeOnlyLoadsContentOnce() | 2168 public void testTapMultipleSwipeOnlyLoadsContentOnce() |
(...skipping 13 matching lines...) Expand all Loading... | |
2198 waitForPanelToPeek(); | 2182 waitForPanelToPeek(); |
2199 assertContentViewCoreVisible(); | 2183 assertContentViewCoreVisible(); |
2200 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 2184 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
2201 | 2185 |
2202 // Expanding the Panel should not change the visibility or load content again. | 2186 // Expanding the Panel should not change the visibility or load content again. |
2203 tapPeekingBarToExpandAndAssert(); | 2187 tapPeekingBarToExpandAndAssert(); |
2204 assertContentViewCoreVisible(); | 2188 assertContentViewCoreVisible(); |
2205 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 2189 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
2206 | 2190 |
2207 // Closing the Panel should destroy the Content. | 2191 // Closing the Panel should destroy the Content. |
2208 tapBasePageToClosePanel(); | 2192 closePanel(); |
2209 assertNoContentViewCore(); | 2193 assertNoContentViewCore(); |
2210 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 2194 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
2211 } | 2195 } |
2212 | 2196 |
2213 /** | 2197 /** |
2214 * Tests swiping panel up and down after a long press search will only load the Content once. | 2198 * Tests swiping panel up and down after a long press search will only load the Content once. |
2215 */ | 2199 */ |
2216 @SmallTest | 2200 @SmallTest |
2217 @Feature({"ContextualSearch"}) | 2201 @Feature({"ContextualSearch"}) |
2218 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) | 2202 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) |
(...skipping 15 matching lines...) Expand all Loading... | |
2234 waitForPanelToPeek(); | 2218 waitForPanelToPeek(); |
2235 assertContentViewCoreVisible(); | 2219 assertContentViewCoreVisible(); |
2236 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 2220 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
2237 | 2221 |
2238 // Expanding the Panel should not change the visibility or load content again. | 2222 // Expanding the Panel should not change the visibility or load content again. |
2239 tapPeekingBarToExpandAndAssert(); | 2223 tapPeekingBarToExpandAndAssert(); |
2240 assertContentViewCoreVisible(); | 2224 assertContentViewCoreVisible(); |
2241 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 2225 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
2242 | 2226 |
2243 // Closing the Panel should destroy the Content. | 2227 // Closing the Panel should destroy the Content. |
2244 tapBasePageToClosePanel(); | 2228 closePanel(); |
2245 assertNoContentViewCore(); | 2229 assertNoContentViewCore(); |
2246 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 2230 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
2247 } | 2231 } |
2248 | 2232 |
2249 /** | 2233 /** |
2250 * Tests that chained tap searches create new Content. | 2234 * Tests that chained tap searches create new Content. |
2251 */ | 2235 */ |
2252 @SmallTest | 2236 @SmallTest |
2253 @Feature({"ContextualSearch"}) | 2237 @Feature({"ContextualSearch"}) |
2254 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) | 2238 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) |
(...skipping 17 matching lines...) Expand all Loading... | |
2272 waitToPreventDoubleTapRecognition(); | 2256 waitToPreventDoubleTapRecognition(); |
2273 | 2257 |
2274 // Simulate a new tap and make sure a new Content is created. | 2258 // Simulate a new tap and make sure a new Content is created. |
2275 simulateTapSearch("resolution"); | 2259 simulateTapSearch("resolution"); |
2276 assertContentViewCoreCreatedButNeverMadeVisible(); | 2260 assertContentViewCoreCreatedButNeverMadeVisible(); |
2277 assertEquals(3, mFakeServer.getLoadedUrlCount()); | 2261 assertEquals(3, mFakeServer.getLoadedUrlCount()); |
2278 ContentViewCore cvc3 = getPanelContentViewCore(); | 2262 ContentViewCore cvc3 = getPanelContentViewCore(); |
2279 assertNotSame(cvc2, cvc3); | 2263 assertNotSame(cvc2, cvc3); |
2280 | 2264 |
2281 // Closing the Panel should destroy the Content. | 2265 // Closing the Panel should destroy the Content. |
2282 tapBasePageToClosePanel(); | 2266 closePanel(); |
2283 assertNoContentViewCore(); | 2267 assertNoContentViewCore(); |
2284 assertEquals(3, mFakeServer.getLoadedUrlCount()); | 2268 assertEquals(3, mFakeServer.getLoadedUrlCount()); |
2285 } | 2269 } |
2286 | 2270 |
2287 /** | 2271 /** |
2288 * Tests that chained searches load correctly. | 2272 * Tests that chained searches load correctly. |
2289 */ | 2273 */ |
2290 @DisabledTest(message = "crbug.com/551711") | 2274 @DisabledTest(message = "crbug.com/551711") |
2291 @SmallTest | 2275 @SmallTest |
2292 @Feature({"ContextualSearch"}) | 2276 @Feature({"ContextualSearch"}) |
(...skipping 25 matching lines...) Expand all Loading... | |
2318 // Expanding the Panel should load and display the new search. | 2302 // Expanding the Panel should load and display the new search. |
2319 tapPeekingBarToExpandAndAssert(); | 2303 tapPeekingBarToExpandAndAssert(); |
2320 assertContentViewCoreCreated(); | 2304 assertContentViewCoreCreated(); |
2321 assertContentViewCoreVisible(); | 2305 assertContentViewCoreVisible(); |
2322 assertEquals(2, mFakeServer.getLoadedUrlCount()); | 2306 assertEquals(2, mFakeServer.getLoadedUrlCount()); |
2323 assertLoadedSearchTermMatches("Resolution"); | 2307 assertLoadedSearchTermMatches("Resolution"); |
2324 ContentViewCore cvc2 = getPanelContentViewCore(); | 2308 ContentViewCore cvc2 = getPanelContentViewCore(); |
2325 assertNotSame(cvc1, cvc2); | 2309 assertNotSame(cvc1, cvc2); |
2326 | 2310 |
2327 // Closing the Panel should destroy the Content. | 2311 // Closing the Panel should destroy the Content. |
2328 tapBasePageToClosePanel(); | 2312 closePanel(); |
2329 assertNoContentViewCore(); | 2313 assertNoContentViewCore(); |
2330 assertEquals(2, mFakeServer.getLoadedUrlCount()); | 2314 assertEquals(2, mFakeServer.getLoadedUrlCount()); |
2331 } | 2315 } |
2332 | 2316 |
2333 /** | 2317 /** |
2334 * Tests that chained searches make Content visible when opening the Panel. | 2318 * Tests that chained searches make Content visible when opening the Panel. |
2335 */ | 2319 */ |
2336 @SmallTest | 2320 @SmallTest |
2337 @Feature({"ContextualSearch"}) | 2321 @Feature({"ContextualSearch"}) |
2338 @Restriction({RESTRICTION_TYPE_NON_LOW_END_DEVICE}) | 2322 @Restriction({RESTRICTION_TYPE_NON_LOW_END_DEVICE}) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2371 @Feature({"ContextualSearch"}) | 2355 @Feature({"ContextualSearch"}) |
2372 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) | 2356 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) |
2373 public void testTapCloseRemovedFromHistory() | 2357 public void testTapCloseRemovedFromHistory() |
2374 throws InterruptedException, TimeoutException { | 2358 throws InterruptedException, TimeoutException { |
2375 // Simulate a tap and make sure a URL was loaded. | 2359 // Simulate a tap and make sure a URL was loaded. |
2376 simulateTapSearch("search"); | 2360 simulateTapSearch("search"); |
2377 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 2361 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
2378 String url = mFakeServer.getLoadedUrl(); | 2362 String url = mFakeServer.getLoadedUrl(); |
2379 | 2363 |
2380 // Close the Panel without seeing the Content. | 2364 // Close the Panel without seeing the Content. |
2381 tapBasePageToClosePanel(); | 2365 closePanel(); |
2382 | 2366 |
2383 // Now check that the URL has been removed from history. | 2367 // Now check that the URL has been removed from history. |
2384 assertTrue(mFakeServer.hasRemovedUrl(url)); | 2368 assertTrue(mFakeServer.hasRemovedUrl(url)); |
2385 } | 2369 } |
2386 | 2370 |
2387 /** | 2371 /** |
2388 * Tests that a tap followed by opening the Panel does not remove the loaded URL from history. | 2372 * Tests that a tap followed by opening the Panel does not remove the loaded URL from history. |
2389 */ | 2373 */ |
2390 @SmallTest | 2374 @SmallTest |
2391 @Feature({"ContextualSearch"}) | 2375 @Feature({"ContextualSearch"}) |
2392 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) | 2376 @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON _LOW_END_DEVICE}) |
2393 public void testTapExpandNotRemovedFromHistory() | 2377 public void testTapExpandNotRemovedFromHistory() |
2394 throws InterruptedException, TimeoutException { | 2378 throws InterruptedException, TimeoutException { |
2395 // Simulate a tap and make sure a URL was loaded. | 2379 // Simulate a tap and make sure a URL was loaded. |
2396 simulateTapSearch("search"); | 2380 simulateTapSearch("search"); |
2397 assertEquals(1, mFakeServer.getLoadedUrlCount()); | 2381 assertEquals(1, mFakeServer.getLoadedUrlCount()); |
2398 String url = mFakeServer.getLoadedUrl(); | 2382 String url = mFakeServer.getLoadedUrl(); |
2399 | 2383 |
2400 // Expand Panel so that the Content becomes visible. | 2384 // Expand Panel so that the Content becomes visible. |
2401 tapPeekingBarToExpandAndAssert(); | 2385 tapPeekingBarToExpandAndAssert(); |
2402 | 2386 |
2403 // Close the Panel. | 2387 // Close the Panel. |
2404 tapBasePageToClosePanel(); | 2388 closePanel(); |
2405 | 2389 |
2406 // Now check that the URL has not been removed from history, since the C ontent was seen. | 2390 // Now check that the URL has not been removed from history, since the C ontent was seen. |
2407 assertFalse(mFakeServer.hasRemovedUrl(url)); | 2391 assertFalse(mFakeServer.hasRemovedUrl(url)); |
2408 } | 2392 } |
2409 | 2393 |
2410 /** | 2394 /** |
2411 * Tests that chained searches without opening the Panel removes all loaded URLs from history. | 2395 * Tests that chained searches without opening the Panel removes all loaded URLs from history. |
2412 */ | 2396 */ |
2413 @SmallTest | 2397 @SmallTest |
2414 @Feature({"ContextualSearch"}) | 2398 @Feature({"ContextualSearch"}) |
(...skipping 13 matching lines...) Expand all Loading... | |
2428 assertNotSame(url1, url2); | 2412 assertNotSame(url1, url2); |
2429 | 2413 |
2430 waitToPreventDoubleTapRecognition(); | 2414 waitToPreventDoubleTapRecognition(); |
2431 | 2415 |
2432 // Simulate another tap and make sure another URL was loaded. | 2416 // Simulate another tap and make sure another URL was loaded. |
2433 simulateTapSearch("resolution"); | 2417 simulateTapSearch("resolution"); |
2434 String url3 = mFakeServer.getLoadedUrl(); | 2418 String url3 = mFakeServer.getLoadedUrl(); |
2435 assertNotSame(url2, url3); | 2419 assertNotSame(url2, url3); |
2436 | 2420 |
2437 // Close the Panel without seeing any Content. | 2421 // Close the Panel without seeing any Content. |
2438 tapBasePageToClosePanel(); | 2422 closePanel(); |
2439 | 2423 |
2440 // Now check that all three URLs have been removed from history. | 2424 // Now check that all three URLs have been removed from history. |
2441 assertEquals(3, mFakeServer.getLoadedUrlCount()); | 2425 assertEquals(3, mFakeServer.getLoadedUrlCount()); |
2442 assertTrue(mFakeServer.hasRemovedUrl(url1)); | 2426 assertTrue(mFakeServer.hasRemovedUrl(url1)); |
2443 assertTrue(mFakeServer.hasRemovedUrl(url2)); | 2427 assertTrue(mFakeServer.hasRemovedUrl(url2)); |
2444 assertTrue(mFakeServer.hasRemovedUrl(url3)); | 2428 assertTrue(mFakeServer.hasRemovedUrl(url3)); |
2445 } | 2429 } |
2446 | 2430 |
2447 //========================================================================== ================== | 2431 //========================================================================== ================== |
2448 // Translate Tests | 2432 // Translate Tests |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2562 | 2546 |
2563 // Simulate a tap and assert that the panel peeks. | 2547 // Simulate a tap and assert that the panel peeks. |
2564 simulateTapSearch("search"); | 2548 simulateTapSearch("search"); |
2565 | 2549 |
2566 // Expand the panel and assert that it ends up in the right place. | 2550 // Expand the panel and assert that it ends up in the right place. |
2567 tapPeekingBarToExpandAndAssert(); | 2551 tapPeekingBarToExpandAndAssert(); |
2568 assertEquals(mManager.getContextualSearchPanel().getHeight(), | 2552 assertEquals(mManager.getContextualSearchPanel().getHeight(), |
2569 mManager.getContextualSearchPanel().getPanelHeightFromState(Pane lState.EXPANDED)); | 2553 mManager.getContextualSearchPanel().getPanelHeightFromState(Pane lState.EXPANDED)); |
2570 | 2554 |
2571 // Tap the base page and assert that the panel is closed. | 2555 // Tap the base page and assert that the panel is closed. |
2572 tapBasePageToClosePanel(); | 2556 closePanel(); |
2573 } | 2557 } |
2574 | 2558 |
2575 /** | 2559 /** |
2576 * Tests that the Contextual Search panel is dismissed when entering or exit ing fullscreen. | 2560 * Tests that the Contextual Search panel is dismissed when entering or exit ing fullscreen. |
2577 */ | 2561 */ |
2578 @SmallTest | 2562 @SmallTest |
2579 @Feature({"ContextualSearch"}) | 2563 @Feature({"ContextualSearch"}) |
2580 @Restriction({RESTRICTION_TYPE_NON_LOW_END_DEVICE}) | 2564 @Restriction({RESTRICTION_TYPE_NON_LOW_END_DEVICE}) |
2581 public void testPanelDismissedOnToggleFullscreen() | 2565 public void testPanelDismissedOnToggleFullscreen() |
2582 throws InterruptedException, TimeoutException { | 2566 throws InterruptedException, TimeoutException { |
(...skipping 10 matching lines...) Expand all Loading... | |
2593 // Simulate a tap and assert that the panel peeks. | 2577 // Simulate a tap and assert that the panel peeks. |
2594 simulateTapSearch("search"); | 2578 simulateTapSearch("search"); |
2595 | 2579 |
2596 // Toggle tab to non-fullscreen. | 2580 // Toggle tab to non-fullscreen. |
2597 FullscreenTestUtils.togglePersistentFullscreenAndAssert(tab, false, getA ctivity()); | 2581 FullscreenTestUtils.togglePersistentFullscreenAndAssert(tab, false, getA ctivity()); |
2598 | 2582 |
2599 // Assert that the panel is closed. | 2583 // Assert that the panel is closed. |
2600 waitForPanelToClose(); | 2584 waitForPanelToClose(); |
2601 } | 2585 } |
2602 } | 2586 } |
OLD | NEW |