Commit 1cbc8312 authored by Robbie McElrath's avatar Robbie McElrath Committed by Chromium LUCI CQ

[WebLayer] Fix flakes in SiteSettingsTest#testSingleSiteLocationAccess

The test was failing because some Nexus5X test runners have location
access disabled system-wide, which disabled the UI the test was trying
to verify. The fix is to force the location service enabled at the
beginning of the test.

Bug: 1128184
Change-Id: I4166f2147ede1b2aa1d6f46684ba0a84507be31c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2638783Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845224}
parent dbf2380e
...@@ -17,6 +17,7 @@ import static org.hamcrest.core.StringContains.containsString; ...@@ -17,6 +17,7 @@ import static org.hamcrest.core.StringContains.containsString;
import android.app.Activity; import android.app.Activity;
import android.app.Instrumentation.ActivityResult; import android.app.Instrumentation.ActivityResult;
import android.content.Intent; import android.content.Intent;
import android.os.RemoteException;
import android.provider.Settings; import android.provider.Settings;
import androidx.test.espresso.intent.Intents; import androidx.test.espresso.intent.Intents;
...@@ -30,6 +31,7 @@ import org.junit.runner.RunWith; ...@@ -30,6 +31,7 @@ import org.junit.runner.RunWith;
import org.chromium.weblayer.SettingsTestUtils; import org.chromium.weblayer.SettingsTestUtils;
import org.chromium.weblayer.SiteSettingsActivity; import org.chromium.weblayer.SiteSettingsActivity;
import org.chromium.weblayer.TestWebLayer;
/** /**
* Tests the behavior of the Site Settings UI. * Tests the behavior of the Site Settings UI.
...@@ -105,9 +107,12 @@ public class SiteSettingsTest { ...@@ -105,9 +107,12 @@ public class SiteSettingsTest {
@Test @Test
@SmallTest @SmallTest
public void testSingleSiteLocationAccess() throws InterruptedException { public void testSingleSiteLocationAccess() throws InterruptedException, RemoteException {
try { try {
Intents.init(); Intents.init();
TestWebLayer testWebLayer =
TestWebLayer.getTestWebLayer(mSettingsTestRule.getContext());
testWebLayer.setSystemLocationSettingEnabled(true);
mSettingsTestRule.launchActivity( mSettingsTestRule.launchActivity(
SettingsTestUtils.createIntentForSiteSettingsSingleWebsite( SettingsTestUtils.createIntentForSiteSettingsSingleWebsite(
mSettingsTestRule.getContext(), PROFILE_NAME, /*isIncognito=*/false, mSettingsTestRule.getContext(), PROFILE_NAME, /*isIncognito=*/false,
......
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