Commit 568372e8 authored by Josh Simmons's avatar Josh Simmons Committed by Commit Bot

Add network restriction for translate tests so we can reenable them.

These tests were failing on networkless phones in lab. We should probably figure out how to mock out the translate service for these, but for now this is a step in the right direction.

Bug: 1130712
Bug: 1127786

Change-Id: Ifd7cb1176ae9beb89c1f44268af9c0add9f29a99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2446894
Commit-Queue: Josh Simmons <jds@google.com>
Reviewed-by: default avatarScott Little <sclittle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813456}
parent 4cd6dcd2
......@@ -17,7 +17,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags;
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.R;
......@@ -73,9 +72,11 @@ public class TranslateCompactInfoBarTest {
@Test
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
@DisabledTest(message = "https://crbug.com/1130712")
public void testTranslateCompactInfoBarAppears() throws TimeoutException {
// TODO(crbug.com/1134812): Remove the reliance on a network connection for these tests.
@Restriction({ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES,
Restriction.RESTRICTION_TYPE_INTERNET})
public void
testTranslateCompactInfoBarAppears() throws TimeoutException {
mActivityTestRule.loadUrl(mTestServer.getURL(TRANSLATE_PAGE));
mListener.addInfoBarAnimationFinished("InfoBar not opened.");
InfoBar infoBar = mInfoBarContainer.getInfoBarsForTesting().get(0);
......@@ -89,9 +90,10 @@ public class TranslateCompactInfoBarTest {
@Test
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
@DisabledTest(message = "https://crbug.com/1130712")
public void testTranslateCompactInfoBarOverflowMenus() throws TimeoutException {
@Restriction({ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES,
Restriction.RESTRICTION_TYPE_INTERNET})
public void
testTranslateCompactInfoBarOverflowMenus() throws TimeoutException {
mActivityTestRule.loadUrl(mTestServer.getURL(TRANSLATE_PAGE));
mListener.addInfoBarAnimationFinished("InfoBar not opened.");
TranslateCompactInfoBar infoBar =
......@@ -112,9 +114,10 @@ public class TranslateCompactInfoBarTest {
@Test
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
@DisabledTest(message = "https://crbug.com/1130712")
public void testTabMenuDismissedOnOrientationChange() throws Exception {
@Restriction({ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES,
Restriction.RESTRICTION_TYPE_INTERNET})
public void
testTabMenuDismissedOnOrientationChange() throws Exception {
mActivityTestRule.loadUrl(mTestServer.getURL(TRANSLATE_PAGE));
mListener.addInfoBarAnimationFinished("InfoBar not opened.");
TranslateCompactInfoBar infoBar =
......@@ -142,9 +145,10 @@ public class TranslateCompactInfoBarTest {
@Test
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
@DisabledTest(message = "https://crbug.com/1130712")
public void testTranslateCompactInfoBarReopenOnTarget() throws TimeoutException {
@Restriction({ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES,
Restriction.RESTRICTION_TYPE_INTERNET})
public void
testTranslateCompactInfoBarReopenOnTarget() throws TimeoutException {
mActivityTestRule.loadUrl(mTestServer.getURL(TRANSLATE_PAGE));
mListener.addInfoBarAnimationFinished("InfoBar not opened.");
......@@ -177,9 +181,10 @@ public class TranslateCompactInfoBarTest {
@Test
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
@DisabledTest(message = "https://crbug.com/1130712")
public void testStartTranslateOnManualInitiation() throws TimeoutException {
@Restriction({ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES,
Restriction.RESTRICTION_TYPE_INTERNET})
public void
testStartTranslateOnManualInitiation() throws TimeoutException {
// Load a page that won't trigger the translate recommendation.
mActivityTestRule.loadUrl(mTestServer.getURL(NON_TRANSLATE_PAGE));
......@@ -204,9 +209,10 @@ public class TranslateCompactInfoBarTest {
@Test
@MediumTest
@Feature({"Browser", "Main"})
@Restriction(ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES)
@DisabledTest(message = "https://crbug.com/1130712")
public void testManualInitiationWithBarOpen() throws TimeoutException {
@Restriction({ChromeRestriction.RESTRICTION_TYPE_GOOGLE_PLAY_SERVICES,
Restriction.RESTRICTION_TYPE_INTERNET})
public void
testManualInitiationWithBarOpen() throws TimeoutException {
mActivityTestRule.loadUrl(mTestServer.getURL(TRANSLATE_PAGE));
mListener.addInfoBarAnimationFinished("InfoBar not opened.");
......
......@@ -8,7 +8,6 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build.VERSION_CODES;
import androidx.test.filters.MediumTest;
import androidx.test.filters.SmallTest;
......@@ -25,7 +24,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.ContextUtils;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
......@@ -136,12 +135,10 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
// TODO(crbug.com/1134812): Remove the reliance on a network connection for these tests.
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.DisableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentDisabled() throws TimeoutException {
public void testTranslateIntentDisabled() throws TimeoutException {
final String url = sActivityTestRule.getTestServer().getURL(TRANSLATE_PAGE);
// Load a page that triggers the translate recommendation.
sActivityTestRule.loadUrl(url);
......@@ -156,12 +153,9 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.EnableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentOnTranslatePage() throws TimeoutException {
public void testTranslateIntentOnTranslatePage() throws TimeoutException {
final String url = sActivityTestRule.getTestServer().getURL(TRANSLATE_PAGE);
// Load a page that triggers the translate recommendation.
sActivityTestRule.loadUrl(url);
......@@ -176,12 +170,9 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.EnableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentOnNonTranslatePage() throws TimeoutException {
public void testTranslateIntentOnNonTranslatePage() throws TimeoutException {
final String url = sActivityTestRule.getTestServer().getURL(NON_TRANSLATE_PAGE);
// Load a page that doesn't trigger the translate recommendation.
sActivityTestRule.loadUrl(url);
......@@ -198,12 +189,10 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.EnableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentWithTargetLanguage() throws TimeoutException, ExecutionException {
public void testTranslateIntentWithTargetLanguage()
throws TimeoutException, ExecutionException {
final String url = sActivityTestRule.getTestServer().getURL(NON_TRANSLATE_PAGE);
// Load a page that doesn't trigger the translate recommendation.
sActivityTestRule.loadUrl(url);
......@@ -229,12 +218,9 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.EnableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentWithUnsupportedTargetLanguage() throws TimeoutException {
public void testTranslateIntentWithUnsupportedTargetLanguage() throws TimeoutException {
final String url = sActivityTestRule.getTestServer().getURL(NON_TRANSLATE_PAGE);
// Load a page that doesn't trigger the translate recommendation.
sActivityTestRule.loadUrl(url);
......@@ -249,12 +235,9 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.EnableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentOnIncognito() throws TimeoutException {
public void testTranslateIntentOnIncognito() throws TimeoutException {
final String url = sActivityTestRule.getTestServer().getURL(TRANSLATE_PAGE);
// Load a page that triggers the translate recommendation.
sActivityTestRule.loadUrlInNewTab(url, /*incognito=*/true);
......@@ -273,12 +256,9 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.EnableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentWithUrlMismatch() throws TimeoutException {
public void testTranslateIntentWithUrlMismatch() throws TimeoutException {
final String url = sActivityTestRule.getTestServer().getURL(TRANSLATE_PAGE);
// Load a page that triggers the translate recommendation.
sActivityTestRule.loadUrl(url);
......@@ -293,12 +273,9 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.EnableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentWithoutExpectedUrl() throws TimeoutException {
public void testTranslateIntentWithoutExpectedUrl() throws TimeoutException {
final String url = sActivityTestRule.getTestServer().getURL(TRANSLATE_PAGE);
// Load a page that triggers the translate recommendation.
sActivityTestRule.loadUrl(url);
......@@ -313,12 +290,9 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.EnableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentVerifyComponent() throws TimeoutException {
public void testTranslateIntentVerifyComponent() throws TimeoutException {
final String url = sActivityTestRule.getTestServer().getURL(TRANSLATE_PAGE);
// Load a page that triggers the translate recommendation.
sActivityTestRule.loadUrl(url);
......@@ -339,12 +313,9 @@ public class TranslateIntentTest {
@Test
@MediumTest
@DisableIf.
Build(sdk_is_greater_than = VERSION_CODES.LOLLIPOP_MR1, sdk_is_less_than = VERSION_CODES.N,
message = "Consistently failing on Marshmallow https://crbug.com/1127786")
@Restriction(Restriction.RESTRICTION_TYPE_INTERNET)
@Features.EnableFeatures({ChromeFeatureList.TRANSLATE_INTENT})
public void
testTranslateIntentIncorrectComponent() throws TimeoutException {
public void testTranslateIntentIncorrectComponent() throws TimeoutException {
final String url = sActivityTestRule.getTestServer().getURL(TRANSLATE_PAGE);
// Load a page that triggers the translate recommendation.
sActivityTestRule.loadUrl(url);
......
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