Commit fffffd3d authored by yfriedman's avatar yfriedman Committed by Commit bot

Add a testing restriction for whether Google Play Services is up-to-date.

Rather than having these tests being forced into the flaky bucket,
condition their execution on a new restriction. It has the nice
side-effect that one bad bot or configuration doesn't cause the test to
get disabled and hopefully these will be running *somewhere*.

Tested locally that the tests passed, then removed all updates to google
play services and they were ignored.
BUG=514449

Review URL: https://codereview.chromium.org/1582513003

Cr-Commit-Position: refs/heads/master@{#371799}
parent 65da625b
......@@ -18,12 +18,6 @@ import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Restriction {
/** Specifies the test is only valid on phone form factors. */
public static final String RESTRICTION_TYPE_PHONE = "Phone";
/** Specifies the test is only valid on tablet form factors. */
public static final String RESTRICTION_TYPE_TABLET = "Tablet";
/** Specifies the test is only valid on low end devices that have less memory. */
public static final String RESTRICTION_TYPE_LOW_END_DEVICE = "Low_End_Device";
......
......@@ -143,6 +143,11 @@
*;
}
# Needed to run ChromeTest.apk
-keepnames class com.google.android.gms.common.GoogleApiAvailability {
*;
}
#-keep public class android.net.http.SslCertificate
#-keep public class android.webkit.WebVie
......
......@@ -19,6 +19,7 @@ import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
import org.chromium.chrome.test.util.ActivityUtils;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content_public.browser.LoadUrlParams;
......@@ -34,7 +35,7 @@ public class ChromeTabbedActivityLollipopAndAboveTest extends ChromeTabbedActivi
/**
* Confirm that you can't start DocumentActivity while the user is running in tabbed mode.
*/
@Restriction(Restriction.RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
public void testDontKeepDocumentActivityInTabbedMode() throws Exception {
// Make sure that ChromeTabbedActivity started up.
......
......@@ -4,8 +4,6 @@
package org.chromium.chrome.browser;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import android.test.FlakyTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
......@@ -20,6 +18,7 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManager;
import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeEventFilter.ScrollDirection;
import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandler;
import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.chrome.test.util.OverviewModeBehaviorWatcher;
import org.chromium.content.browser.test.util.Criteria;
......@@ -148,7 +147,7 @@ public class ContentViewFocusTest extends ChromeTabbedActivityTestBase {
*/
@MediumTest
@Feature({"TabContents"})
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
public void testHideSelectionOnPhoneTabSwitcher() throws Exception {
// Setup
OverviewModeBehaviorWatcher showWatcher = new OverviewModeBehaviorWatcher(
......
......@@ -4,8 +4,6 @@
package org.chromium.chrome.browser;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_TABLET;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.Smoke;
import android.text.TextUtils;
......@@ -26,6 +24,7 @@ import org.chromium.chrome.browser.tab.TabObserver;
import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.browser.tabmodel.TabModelUtils;
import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.chrome.test.util.OmniboxTestUtils;
import org.chromium.chrome.test.util.TestHttpServerClient;
......@@ -124,7 +123,7 @@ public class NavigateTest extends ChromeTabbedActivityTestBase {
}
@DisabledTest // https://crbug.com/516018
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@MediumTest
@Feature({"Navigation"})
public void testNavigateMany() throws Exception {
......@@ -289,7 +288,7 @@ public class NavigateTest extends ChromeTabbedActivityTestBase {
/**
* Test back and forward buttons.
*/
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@MediumTest
@Feature({"Navigation"})
public void testNavigateBackAndForwardButtons() throws Exception {
......
......@@ -4,8 +4,6 @@
package org.chromium.chrome.browser;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ImageButton;
......@@ -14,6 +12,7 @@ import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.toolbar.TabSwitcherDrawable;
import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.ChromeTabUtils;
/**
......@@ -39,7 +38,7 @@ public class TabCountLabelTest extends ChromeTabbedActivityTestBase {
*/
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
public void testTabCountLabel() throws InterruptedException {
final int tabCount = getActivity().getCurrentTabModel().getCount();
tabCountLabelCheck("Initial state", tabCount);
......
......@@ -5,7 +5,6 @@
package org.chromium.chrome.browser;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import android.content.DialogInterface;
import android.content.pm.ActivityInfo;
......@@ -53,6 +52,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl;
import org.chromium.chrome.browser.tabmodel.TabModelUtils;
import org.chromium.chrome.browser.toolbar.ToolbarPhone;
import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.chrome.test.util.MenuUtils;
import org.chromium.chrome.test.util.NewTabPageTestUtils;
......@@ -373,7 +373,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Feature({"Android-TabSwitcher"})
public void testTabSwitcherPortraitCloseButton() throws InterruptedException {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
......@@ -556,7 +556,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
Bug http://crbug.com/156746
*/
@DisabledTest
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTabsCulling() throws InterruptedException {
// Open one more tabs than maxTabsDrawn.
final int maxTabsDrawn = 8;
......@@ -601,7 +601,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
* @Feature({"Android-TabSwitcher"})
*/
@FlakyTest
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTabsStacking() throws InterruptedException {
final int count = openTabs(12, false);
......@@ -667,7 +667,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
* @Feature({"Android-TabSwitcher"})
*/
@FlakyTest
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
public void testTabSwitcherMemoryLeak() throws InterruptedException {
openTabs(4, true);
......@@ -696,7 +696,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
* Verify that switching back and forth stay stable. This test last for at least 8 seconds.
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Android-TabSwitcher"})
public void testTabSwitcherStability() throws InterruptedException {
openTabs(8, true);
......@@ -716,7 +716,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
@LargeTest
@Feature({"Android-TabSwitcher"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTabSelectionPortrait() throws InterruptedException {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
checkTabSelection(2, 0, false);
......@@ -740,7 +740,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
* @Feature({"Android-TabSwitcher"})
*/
@FlakyTest
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTabSelectionLandscape() throws InterruptedException {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
checkTabSelection(2, 0, true);
......@@ -762,7 +762,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
* Verify that we don't crash and show the overview mode after closing the last tab.
*/
@SmallTest
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Android-TabSwitcher"})
public void testCloseLastTabFromMain() throws InterruptedException {
OverviewModeBehaviorWatcher overviewModeWatcher = new OverviewModeBehaviorWatcher(
......@@ -936,7 +936,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
* Test closing few tabs by swiping them in Overview portrait mode.
*/
@MediumTest
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Feature({"Android-TabSwitcher", "Main"})
public void testCloseTabPortrait() throws InterruptedException {
startMainActivityWithURL(TestHttpServerClient.getUrl("chrome/test/data/android/test.html"));
......@@ -960,7 +960,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
*/
@MediumTest
@Feature({"Android-TabSwitcher", "Main"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testCloseTabLandscape() throws InterruptedException {
startMainActivityWithURL(TestHttpServerClient.getUrl("chrome/test/data/android/test.html"));
......@@ -985,7 +985,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
*/
@MediumTest
@Feature({"Android-TabSwitcher"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testCloseIncognitoTabPortrait() throws InterruptedException {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
newIncognitoTabsFromMenu(2);
......@@ -1000,7 +1000,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
*/
@Feature({"Android-TabSwitcher"})
@MediumTest
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testCloseFiveIncognitoTabPortrait() throws InterruptedException {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
newIncognitoTabsFromMenu(5);
......@@ -1014,7 +1014,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
* Simple swipe gesture should not close tabs when two Tabstacks are open in Overview mode.
* Test in Portrait Mode.
*/
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@MediumTest
@Feature({"Android-TabSwitcher"})
public void testSwitchTabStackWithoutClosingTabsInPortrait() throws InterruptedException {
......@@ -1061,7 +1061,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
@Feature({"Android-TabSwitcher"})
Bug http://crbug.com/157259
*/
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@DisabledTest
public void testSwitchTabStackWithoutClosingTabsInLandscape() throws InterruptedException {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
......@@ -1103,7 +1103,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
*/
@MediumTest
@Feature({"Android-TabSwitcher"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testCloseIncognitoTabLandscape() throws InterruptedException {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
newIncognitoTabFromMenu();
......@@ -1118,7 +1118,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
*/
@MediumTest
@Feature({"Android-TabSwitcher"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testCloseFiveIncognitoTabLandscape() throws InterruptedException {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
newIncognitoTabsFromMenu(5);
......@@ -1196,7 +1196,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
*/
@MediumTest
@Feature({"Android-TabSwitcher"})
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
public void testNewTabButton() throws InterruptedException {
MenuUtils.invokeCustomMenuActionSync(getInstrumentation(), getActivity(),
R.id.close_all_tabs_menu_id);
......@@ -1405,7 +1405,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
* Test that swipes and tab transitions are not causing URL bar to be focused.
*/
@MediumTest
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Feature({"Android-TabSwitcher"})
public void testOSKIsNotShownDuringSwipe() throws InterruptedException {
final View urlBar = getActivity().findViewById(R.id.url_bar);
......@@ -1507,7 +1507,7 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
*/
@MediumTest
@Feature({"Android-TabSwitcher"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testOrientationChangeCausesLiveTabReflowInTabSwitcher()
throws InterruptedException, TimeoutException {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
......
......@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.compositor.layouts;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import android.content.Context;
import android.graphics.PointF;
......@@ -34,6 +33,7 @@ import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabModelUtils;
import org.chromium.chrome.browser.util.MathUtils;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.browser.tabmodel.MockTabModel.MockTabModelDelegate;
import org.chromium.chrome.test.util.browser.tabmodel.MockTabModelSelector;
import org.chromium.content.browser.BrowserStartupController;
......@@ -198,14 +198,14 @@ public class LayoutManagerTest extends InstrumentationTestCase
@SmallTest
@Feature({"Android-TabSwitcher"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testCreation() {
initializeLayoutManagerPhone(0, 0);
}
@SmallTest
@Feature({"Android-TabSwitcher"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testStack() throws Exception {
initializeLayoutManagerPhone(3, 0);
mManagerPhone.showOverview(true);
......@@ -218,7 +218,7 @@ public class LayoutManagerTest extends InstrumentationTestCase
@SmallTest
@Feature({"Android-TabSwitcher"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testStackNoAnimation() throws Exception {
initializeLayoutManagerPhone(1, 0);
mManagerPhone.showOverview(false);
......@@ -233,7 +233,7 @@ public class LayoutManagerTest extends InstrumentationTestCase
*/
@SmallTest
@Feature({"Android-TabSwitcher"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testStackPinch() throws Exception {
initializeLayoutManagerPhone(5, 0);
// Setting the index to the second to last element ensure the stack can be scrolled in both
......
......@@ -4,8 +4,6 @@
package org.chromium.chrome.browser.compositor.overlays.strip;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_TABLET;
import android.content.pm.ActivityInfo;
import android.test.suitebuilder.annotation.LargeTest;
......@@ -19,6 +17,7 @@ import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver;
import org.chromium.chrome.browser.tabmodel.TabModelUtils;
import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.chrome.test.util.TabStripUtils;
import org.chromium.content.browser.test.util.CallbackHelper;
......@@ -41,7 +40,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testInitialState() throws InterruptedException {
getInstrumentation().waitForIdleSync();
......@@ -54,7 +53,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip", "Main"})
public void testNewTabButtonWithOneTab() throws InterruptedException {
getInstrumentation().waitForIdleSync();
......@@ -77,7 +76,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testNewTabButtonWithManyTabs() throws InterruptedException {
ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 3);
......@@ -107,7 +106,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testNewTabFromMenu() throws InterruptedException {
getInstrumentation().waitForIdleSync();
......@@ -125,7 +124,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testNewIncognitoTabFromMenuAtNormalStrip() throws InterruptedException {
getInstrumentation().waitForIdleSync();
......@@ -147,7 +146,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testSelectWithTwoTabs() throws InterruptedException {
ChromeTabUtils.newTabFromMenu(getInstrumentation(), getActivity());
......@@ -167,7 +166,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testSelectWithManyTabs() throws InterruptedException {
ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 4);
......@@ -190,7 +189,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testCloseTabWithTwoTabs() throws InterruptedException {
ChromeTabUtils.newTabFromMenu(getInstrumentation(), getActivity());
......@@ -217,7 +216,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testCloseTabWithManyTabs() throws InterruptedException {
ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 4);
......@@ -246,7 +245,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testCloseSelectedTab() throws InterruptedException {
ChromeTabUtils.newTabFromMenu(getInstrumentation(), getActivity());
......@@ -273,7 +272,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testCloseAllTabsFromTabMenuClosesAllTabs() throws InterruptedException {
// 1. Create a second tab
......@@ -315,7 +314,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testTabMenuDismissedOnOrientationChange() throws InterruptedException {
// 1. Set orientation to portrait
......@@ -346,7 +345,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testToggleIncognitoMode() throws InterruptedException {
getInstrumentation().waitForIdleSync();
......@@ -375,7 +374,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
*/
@LargeTest
@Feature({"TabStrip"})
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
public void testCloseLastIncognitoTab() throws InterruptedException {
getInstrumentation().waitForIdleSync();
assertFalse("Expected normal strip to be selected",
......@@ -400,7 +399,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
*/
@LargeTest
@Feature({"TabStrip"})
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
public void testCloseAllIncognitoTabsFromTabMenu() throws InterruptedException {
//1. Create two incognito tabs
getInstrumentation().waitForIdleSync();
......@@ -445,7 +444,7 @@ public class TabStripTest extends ChromeTabbedActivityTestBase {
* @throws InterruptedException
*/
@LargeTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"TabStrip"})
public void testTabSelectionViewDoesNotBreakModelSwitch() throws InterruptedException {
getInstrumentation().waitForIdleSync();
......
......@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.contextualsearch;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import static org.chromium.content.browser.test.util.CriteriaHelper.DEFAULT_POLLING_INTERVAL;
import android.app.Activity;
......@@ -47,6 +46,7 @@ import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver;
import org.chromium.chrome.browser.tabmodel.TabModelUtils;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.chrome.test.util.FullscreenTestUtils;
import org.chromium.chrome.test.util.OmniboxTestUtils;
......@@ -1010,7 +1010,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testSwipeExpand() throws InterruptedException, TimeoutException {
assertNoSearchesLoaded();
clickWordNode("intelligence");
......@@ -1036,7 +1036,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testLongPressSwipeExpand() throws InterruptedException, TimeoutException {
longPressNode("intelligence");
assertNoContentViewCore();
......@@ -1479,7 +1479,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTapResolveLimitForDecided() throws InterruptedException, TimeoutException {
mPolicy.setTapResolveLimitForDecidedForTesting(2);
clickToTriggerSearchTermResolution();
......@@ -1503,7 +1503,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTapResolveLimitForUndecided() throws InterruptedException, TimeoutException {
mPolicy.setTapResolveLimitForUndecidedForTesting(2);
mPolicy.overrideDecidedStateForTesting(false);
......@@ -1529,7 +1529,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTapPrefetchLimitForDecided() throws InterruptedException, TimeoutException {
mPolicy.setTapPrefetchLimitForDecidedForTesting(2);
clickToTriggerPrefetch();
......@@ -1553,7 +1553,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTapPrefetchLimitForUndecided() throws InterruptedException, TimeoutException {
mPolicy.setTapPrefetchLimitForUndecidedForTesting(2);
mPolicy.overrideDecidedStateForTesting(false);
......@@ -1700,7 +1700,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testAppMenuSuppressedWhenExpanded() throws InterruptedException, TimeoutException {
clickWordNode("states");
tapPeekingBarToExpandAndAssert();
......@@ -1791,7 +1791,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testPromoOpenCountForUndecided() throws InterruptedException, TimeoutException {
mPolicy.overrideDecidedStateForTesting(false);
......@@ -1818,7 +1818,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testPromoOpenCountForDecided() throws InterruptedException, TimeoutException {
mPolicy.overrideDecidedStateForTesting(true);
......@@ -1874,7 +1874,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testNotifyObserverHideAfterLongPress()
throws InterruptedException, TimeoutException {
TestContextualSearchObserver observer = new TestContextualSearchObserver();
......@@ -1892,7 +1892,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testNotifyObserverHideAfterTap() throws InterruptedException, TimeoutException {
TestContextualSearchObserver observer = new TestContextualSearchObserver();
mManager.addObserver(observer);
......@@ -2096,7 +2096,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.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.
......@@ -2137,7 +2137,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTapContentVisibility() throws InterruptedException, TimeoutException {
// Simulate a tap and make sure Content is not visible.
simulateTapSearch("search");
......@@ -2158,7 +2158,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testLongPressContentVisibility() throws InterruptedException, TimeoutException {
// Simulate a long press and make sure no Content is created.
simulateLongPressSearch("search");
......@@ -2180,7 +2180,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTapMultipleSwipeOnlyLoadsContentOnce()
throws InterruptedException, TimeoutException {
// Simulate a tap and make sure Content is not visible.
......@@ -2215,7 +2215,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testLongPressMultipleSwipeOnlyLoadsContentOnce()
throws InterruptedException, TimeoutException {
// Simulate a long press and make sure no Content is created.
......@@ -2290,7 +2290,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
@DisabledTest // https://crbug.com/551711
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testChainedSearchLoadsCorrectSearchTerm()
throws InterruptedException, TimeoutException {
// Simulate a tap and make sure Content is not visible.
......@@ -2389,7 +2389,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTapExpandNotRemovedFromHistory()
throws InterruptedException, TimeoutException {
// Simulate a tap and make sure a URL was loaded.
......@@ -2553,7 +2553,7 @@ public class ContextualSearchManagerTest extends ChromeActivityTestCaseBase<Chro
*/
@SmallTest
@Feature({"ContextualSearch"})
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testTapContentAndExpandPanelInFullscreen()
throws InterruptedException, TimeoutException {
// Toggle tab to fulllscreen.
......
......@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.customtabs;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import android.app.Activity;
import android.app.Application;
......@@ -52,6 +51,7 @@ import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.toolbar.CustomTabToolbar;
import org.chromium.chrome.browser.util.ColorUtils;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.TestHttpServerClient;
import org.chromium.chrome.test.util.browser.contextmenu.ContextMenuUtils;
import org.chromium.content.browser.BrowserStartupController;
......@@ -712,7 +712,7 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
* Non-regression test for crbug.com/547121.
*/
@SmallTest
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@CommandLineFlags.Add({
ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, ChromeSwitches.DISABLE_DOCUMENT_MODE})
public void testWarmupAndLaunchRegularChrome() {
......@@ -739,7 +739,7 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
* Non-regression test for crbug.com/547121.
*/
@SmallTest
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@CommandLineFlags.Add({
ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, ChromeSwitches.DISABLE_DOCUMENT_MODE})
public void testWarmupAndLaunchRightToolbarLayout() {
......@@ -846,8 +846,8 @@ public class CustomTabActivityTest extends CustomTabActivityTestBase {
*/
private static class OnFinishedForTest implements PendingIntent.OnFinished {
private PendingIntent mPi;
private AtomicBoolean mIsSent = new AtomicBoolean();
private final PendingIntent mPi;
private final AtomicBoolean mIsSent = new AtomicBoolean();
private String mUri;
/**
......
......@@ -4,8 +4,6 @@
package org.chromium.chrome.browser.externalnav;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_TABLET;
import android.app.Activity;
import android.app.Instrumentation;
import android.app.Instrumentation.ActivityMonitor;
......@@ -25,6 +23,7 @@ import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.TestHttpServerClient;
import org.chromium.content.browser.test.util.CallbackHelper;
import org.chromium.content.browser.test.util.Criteria;
......@@ -272,7 +271,7 @@ public class UrlOverridingTest extends ChromeActivityTestCaseBase<ChromeActivity
}
@SmallTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
public void testOpenWindowFromUserGesture() throws InterruptedException {
loadUrlAndWaitForIntentUrl(TestHttpServerClient.getUrl(OPEN_WINDOW_FROM_USER_GESTURE_PAGE),
true, 1, true, null, true);
......
......@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.media.ui;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import android.test.suitebuilder.annotation.SmallTest;
......@@ -16,6 +15,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.browser.TabTitleObserver;
import org.chromium.content.browser.test.util.JavaScriptUtils;
import org.chromium.content_public.browser.WebContentsObserver;
......@@ -73,7 +73,7 @@ public class NotificationTitleUpdatedTest extends ChromeActivityTestCaseBase<Chr
* the notification should have the title of newTab.
*/
@SmallTest
@Restriction({RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
@Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE, RESTRICTION_TYPE_NON_LOW_END_DEVICE})
public void testMultipleTabs() throws Throwable {
simulateMediaSessionStateChanged(mTab, true, false);
assertTitleMatches("title1");
......
......@@ -4,8 +4,6 @@
package org.chromium.chrome.browser.omaha;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import android.content.Context;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
......@@ -17,6 +15,7 @@ import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.UrlConstants;
import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.OverviewModeBehaviorWatcher;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
......@@ -186,7 +185,7 @@ public class UpdateMenuItemHelperTest extends ChromeTabbedActivityTestBase {
@MediumTest
@Feature({"Omaha"})
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
public void testMenuItemNotShownInOverview() throws Exception {
checkUpdateMenuItemIsShowing("0.0.0.0", "1.2.3.4");
......
......@@ -20,6 +20,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.util.ColorUtils;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.DisableInTabbedMode;
import org.chromium.content.browser.InterstitialPageDelegateAndroid;
import org.chromium.content.browser.test.util.Criteria;
......@@ -114,7 +115,7 @@ public class BrandColorTest extends ChromeActivityTestCaseBase<ChromeActivity> {
* Test for having default primary color working correctly.
*/
@SmallTest
@Restriction(Restriction.RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Omnibox"})
public void testNoBrandColor() throws InterruptedException {
startMainActivityWithURL(getUrlWithBrandColor(""));
......@@ -125,7 +126,7 @@ public class BrandColorTest extends ChromeActivityTestCaseBase<ChromeActivity> {
* Test for adding a brand color for a url.
*/
@SmallTest
@Restriction(Restriction.RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Omnibox"})
public void testBrandColorNoAlpha() throws InterruptedException {
startMainActivityWithURL(getUrlWithBrandColor(BRAND_COLOR_1));
......@@ -136,7 +137,7 @@ public class BrandColorTest extends ChromeActivityTestCaseBase<ChromeActivity> {
* Test to make sure onLoadStarted doesn't reset the brand color.
*/
@SmallTest
@Restriction(Restriction.RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Omnibox"})
public void testBrandColorWithLoadStarted() throws InterruptedException {
startMainActivityWithURL(getUrlWithBrandColor(BRAND_COLOR_1));
......@@ -154,7 +155,7 @@ public class BrandColorTest extends ChromeActivityTestCaseBase<ChromeActivity> {
* Test for checking navigating to new brand color updates correctly.
*/
@SmallTest
@Restriction(Restriction.RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Omnibox"})
public void testNavigatingToNewBrandColor() throws InterruptedException {
startMainActivityWithURL(getUrlWithBrandColor(BRAND_COLOR_1));
......@@ -168,7 +169,7 @@ public class BrandColorTest extends ChromeActivityTestCaseBase<ChromeActivity> {
* back again.
*/
@SmallTest
@Restriction(Restriction.RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Omnibox"})
public void testNavigatingToBrandColorAndBack() throws InterruptedException {
startMainActivityWithURL("about:blank");
......@@ -199,7 +200,7 @@ public class BrandColorTest extends ChromeActivityTestCaseBase<ChromeActivity> {
* TODO(aurimas): investigate why this test is crasing in tabbed mode.
*/
@SmallTest
@Restriction(Restriction.RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@DisableInTabbedMode
@Feature({"Omnibox"})
public void testBrandColorInterstitial() throws InterruptedException {
......
......@@ -4,8 +4,6 @@
package org.chromium.chrome.browser.toolbar;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_TABLET;
import android.test.suitebuilder.annotation.MediumTest;
import org.chromium.base.test.util.Feature;
......@@ -15,6 +13,7 @@ import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.omnibox.UrlBar;
import org.chromium.chrome.browser.widget.findinpage.FindToolbar;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.MenuUtils;
import org.chromium.chrome.test.util.OmniboxTestUtils;
import org.chromium.content.browser.test.util.Criteria;
......@@ -55,7 +54,7 @@ public class ToolbarTest extends ChromeActivityTestCaseBase<ChromeActivity> {
}
@MediumTest
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@Feature({"Omnibox"})
public void testFindInPageDismissedOnOmniboxFocus() throws InterruptedException {
findInPageFromMenu();
......
......@@ -4,11 +4,16 @@
package org.chromium.chrome.browser.translate;
import android.test.suitebuilder.annotation.MediumTest;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.infobar.InfoBar;
import org.chromium.chrome.browser.infobar.InfoBarContainer;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.InfoBarTestAnimationListener;
import org.chromium.chrome.test.util.InfoBarUtil;
import org.chromium.chrome.test.util.TestHttpServerClient;
......@@ -50,12 +55,10 @@ public class TranslateInfoBarTest extends ChromeActivityTestCaseBase<ChromeActiv
/**
* Test the translate language panel.
*
* Bug http://crbug.com/514449
* @MediumTest
* @Feature({"Browser", "Main"})
*/
@DisabledTest
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
public void testTranslateLanguagePanel() throws InterruptedException {
loadUrl(TestHttpServerClient.getUrl(TRANSLATE_PAGE));
assertTrue("InfoBar not opened.", mListener.addInfoBarAnimationFinished());
......@@ -67,12 +70,10 @@ public class TranslateInfoBarTest extends ChromeActivityTestCaseBase<ChromeActiv
/**
* Test the "never translate" panel.
*
* Bug http://crbug.com/514449
* @MediumTest
* @Feature({"Browser", "Main"})
*/
@DisabledTest
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
public void testTranslateNeverPanel() throws InterruptedException {
loadUrl(TestHttpServerClient.getUrl(TRANSLATE_PAGE));
assertTrue("InfoBar not opened.", mListener.addInfoBarAnimationFinished());
......
......@@ -4,9 +4,6 @@
package org.chromium.chrome.browser.widget;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_TABLET;
import android.os.SystemClock;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.View;
......@@ -26,6 +23,7 @@ import org.chromium.chrome.browser.tabmodel.EmptyTabModelObserver;
import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.browser.widget.accessibility.AccessibilityTabModelListItem;
import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.chrome.test.util.MenuUtils;
import org.chromium.chrome.test.util.TabStripUtils;
......@@ -149,7 +147,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
});
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testCanEnterSwitcher() {
......@@ -160,7 +158,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
assertNotNull("Accessibility container was not visible", getContainer().getParent());
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testCanLeaveSwitcher() {
......@@ -175,7 +173,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
assertNull("Accessibility container was not visible", getContainer().getParent());
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testCanCloseWithCloseButton() throws InterruptedException, TimeoutException {
......@@ -205,7 +203,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
});
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testCanSwipeClosed() throws InterruptedException, TimeoutException {
......@@ -240,7 +238,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
});
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testResetSwipe() throws InterruptedException {
......@@ -261,7 +259,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
});
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testCloseAndUndo() throws InterruptedException, TimeoutException {
......@@ -296,7 +294,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
});
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testCloseAll() throws InterruptedException {
......@@ -310,7 +308,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
assertFalse(getActivity().findViewById(R.id.tab_switcher_button).isEnabled());
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testCloseAllIncognito() throws InterruptedException {
......@@ -335,7 +333,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
assertFalse(getActivity().findViewById(R.id.tab_switcher_button).isEnabled());
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testModelSwitcherVisibility() throws InterruptedException {
......@@ -355,7 +353,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
switcherButtons.getVisibility());
}
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@MediumTest
@Feature({"Accessibility"})
public void testModelSwitcherFunctionality() throws InterruptedException {
......@@ -411,7 +409,7 @@ public class OverviewListLayoutTest extends ChromeTabbedActivityTestBase {
assertEquals("Page 2", getTabTitleOfListItem(0));
}
@Restriction(RESTRICTION_TYPE_TABLET)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
@MediumTest
@Feature({"Accessibility"})
public void testCloseTabThroughTabStrip() throws InterruptedException, TimeoutException {
......
......@@ -4,8 +4,6 @@
package org.chromium.chrome.browser.widget;
import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.test.suitebuilder.annotation.MediumTest;
......@@ -17,6 +15,7 @@ import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
......@@ -44,7 +43,7 @@ public class ToolbarProgressBarTest extends ChromeActivityTestCaseBase<ChromeAct
*/
@Feature({"Android-Toolbar"})
@MediumTest
@Restriction(RESTRICTION_TYPE_PHONE)
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
public void testProgressBarDisappearsAfterFastShowHide() throws InterruptedException {
// onAnimationEnd will be signaled on progress bar showing/hiding animation end.
final Object onAnimationEnd = new Object();
......
......@@ -3186,6 +3186,7 @@
'../net/net.gyp:net_java_test_support',
'../sync/sync.gyp:sync_java',
'../sync/sync.gyp:sync_java_test_support',
'../third_party/android_tools/android_tools.gyp:google_play_services_javalib'
],
'includes': [ '../build/java.gypi' ],
},
......
......@@ -30,5 +30,6 @@ android_library("chrome_java_test_support") {
"//third_party/android_tools:legacy_http_javalib",
"//third_party/jsr-305:jsr_305_javalib",
"//ui/android:ui_java",
google_play_services_library,
]
}
......@@ -10,13 +10,16 @@ import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import junit.framework.TestCase;
import org.chromium.base.test.BaseInstrumentationTestRunner;
import org.chromium.base.test.BaseTestResult;
import org.chromium.base.test.util.Restriction;
import org.chromium.base.test.util.SkipCheck;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.chrome.test.util.DisableInTabbedMode;
import org.chromium.net.test.BaseHttpTestServer;
import org.chromium.policy.test.annotations.Policies;
......@@ -220,16 +223,23 @@ public class ChromeInstrumentationTestRunner extends BaseInstrumentationTestRunn
}
private class ChromeRestrictionSkipCheck extends RestrictionSkipCheck {
@Override
protected boolean restrictionApplies(String restriction) {
if (TextUtils.equals(restriction, Restriction.RESTRICTION_TYPE_PHONE)
if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE_PHONE)
&& DeviceFormFactor.isTablet(getTargetContext())) {
return true;
}
if (TextUtils.equals(restriction, Restriction.RESTRICTION_TYPE_TABLET)
if (TextUtils.equals(restriction, ChromeRestriction.RESTRICTION_TYPE_TABLET)
&& !DeviceFormFactor.isTablet(getTargetContext())) {
return true;
}
if (TextUtils.equals(restriction,
ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
&& (ConnectionResult.SUCCESS != GoogleApiAvailability.getInstance()
.isGooglePlayServicesAvailable(getTargetContext()))) {
return true;
}
return false;
}
}
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.test.util;
/**
* Restrictions that are usable with the @Restriction enum but in the chrome/ layer.
* e.g. @Restriction({ChromeRestriction.RESTRICTION_TYPE_PHONE})
*/
public final class ChromeRestriction {
/** Specifies the test is only valid on a device that has up to date play services. */
public static final String RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES = "Google_Play_Services";
/** Specifies the test is only valid on phone form factors. */
public static final String RESTRICTION_TYPE_PHONE = "Phone";
/** Specifies the test is only valid on tablet form factors. */
public static final String RESTRICTION_TYPE_TABLET = "Tablet";
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment