0

Fix consistency issue w/ RetainOmniboxOnFocus flag in testing.

Per attached bug, cached feature flags may use a different value in
batch testing for the first test in the batch versus in the rest of the
batch. This CL aligns the default value for `RetainOmniboxOnFocus` in
testing with that specified in `fieldtrial_testing_config.json`. Doing
so fixes the inconsistency.

Bug: 380113169
Change-Id: I10194df4dd3da645c763dd29ad325bfbef668e06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6085682
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Tomasz Wiszkowski <ender@google.com>
Cr-Commit-Position: refs/heads/main@{#1395714}
This commit is contained in:
dmblack
2024-12-12 17:39:39 -08:00
committed by Chromium LUCI CQ
parent d018ec8a3d
commit 1e18adf65f
4 changed files with 6 additions and 11 deletions
chrome/android/javatests/src/org/chromium/chrome/browser
components/omnibox/common/android/java/src/org/chromium/components/omnibox

@ -72,8 +72,7 @@ public class ChromeCachedFlagsTest {
ChromeFeatureList.sTabStripGroupCollapse,
ChromeFeatureList.sTraceBinderIpc,
OmniboxFeatures.sAndroidHubSearch,
OmniboxFeatures.sOmniboxAnswerActions,
OmniboxFeatures.sRetainOmniboxOnFocus);
OmniboxFeatures.sOmniboxAnswerActions);
/**
* Tests that the |defaultValueForTests| in the CachedFlag declaration matches

@ -337,7 +337,8 @@ public class LocationBarTest {
@MediumTest
public void testEditingText() {
testEditingText(
/* expectRetainOmniboxOnFocus= */ OmniboxFeatures.shouldRetainOmniboxOnFocus());
/* expectRetainOmniboxOnFocus= */ ThreadUtils.runOnUiThreadBlocking(
OmniboxFeatures::shouldRetainOmniboxOnFocus));
}
@Test
@ -635,7 +636,8 @@ public class LocationBarTest {
@Restriction(DeviceFormFactor.TABLET)
public void testFocusLogic_buttonVisibilityTablet() {
testFocusLogic_buttonVisibilityTablet(
/* expectRetainOmniboxOnFocus= */ OmniboxFeatures.shouldRetainOmniboxOnFocus());
/* expectRetainOmniboxOnFocus= */ ThreadUtils.runOnUiThreadBlocking(
OmniboxFeatures::shouldRetainOmniboxOnFocus));
}
@Test

@ -105,7 +105,7 @@ public class OmniboxFeatures {
/** See {@link #shouldRetainOmniboxOnFocus()}. */
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
public static final CachedFlag sRetainOmniboxOnFocus =
newFlag(OmniboxFeatureList.RETAIN_OMNIBOX_ON_FOCUS, FeatureState.DISABLED);
newFlag(OmniboxFeatureList.RETAIN_OMNIBOX_ON_FOCUS, FeatureState.ENABLED_IN_TEST);
public static final CachedFlag sAndroidHubSearch =
newFlag(OmniboxFeatureList.ANDROID_HUB_SEARCH, FeatureState.DISABLED);

@ -76,12 +76,6 @@ public class OmniboxFeaturesTest {
DeviceInput.setSupportsPrecisionPointerForTesting(mDeviceInputSupportsPrecisionPointer);
}
@Test
@SmallTest
public void testShouldRetainOmniboxOnFocus_withFeatureInDefaultState() {
testShouldRetainOmniboxOnFocus(/* expectFeatureEnabled= */ false);
}
@Test
@SmallTest
@DisableFeatures(OmniboxFeatureList.RETAIN_OMNIBOX_ON_FOCUS)