Commit 151c9146 authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

[ntp] Add feature flag to force disable search suggest chips

This flag allows us to run experiments where the realbox is enabled but
search suggest chips are disabled.

Bug: 1082535
Change-Id: I50973578f96bde82654fdd23f7d8a0c9c15d601a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2208079
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Auto-Submit: Tibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#769921}
parent c3ef6722
......@@ -42,10 +42,15 @@ const base::Feature kRealboxUseGoogleGIcon{"NtpRealboxUseGoogleGIcon",
const base::Feature kRealbox{"NtpRealbox", base::FEATURE_DISABLED_BY_DEFAULT};
// If enabled, shows Vasco suggestion chips in the NTP below fakebox/realbox
// despite other config.
// despite other config except DisableSearchSuggestChips below.
const base::Feature kSearchSuggestChips{"SearchSuggestChips",
base::FEATURE_DISABLED_BY_DEFAULT};
// If enabled, hides Vasco suggestion chips in the NTP below fakebox/realbox
// despite other config.
const base::Feature kDisableSearchSuggestChips{
"DisableSearchSuggestChips", base::FEATURE_DISABLED_BY_DEFAULT};
// If enabled, the WebUI new tab page will load when a new tab is created
// instead of the local NTP.
const base::Feature kWebUI{"NtpWebUI", base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -24,6 +24,7 @@ extern const base::Feature kWebUIRealbox;
extern const base::Feature kRealbox;
extern const base::Feature kSearchSuggestChips;
extern const base::Feature kDisableSearchSuggestChips;
// Returns true if either kRealbox or omnibox::kZeroSuggestionsOnNTPRealbox
// are enabled; or omnibox::kOnFocusSuggestions is enabled and configured to
......
......@@ -99,6 +99,9 @@ class SearchSuggestService::SigninObserver
// static
bool SearchSuggestService::IsEnabled() {
if (base::FeatureList::IsEnabled(ntp_features::kDisableSearchSuggestChips))
return false;
if (base::FeatureList::IsEnabled(ntp_features::kSearchSuggestChips))
return true;
......
......@@ -209,8 +209,39 @@ TEST_F(SearchSuggestServiceTest, IsEnabled) {
feature_list.InitWithFeaturesAndParameters(
{{omnibox::kZeroSuggestionsOnNTP, {}},
{omnibox::kZeroSuggestionsOnNTPRealbox, {}},
{omnibox::kOnFocusSuggestions, feature_params}},
{ntp_features::kSearchSuggestChips});
{omnibox::kOnFocusSuggestions, feature_params},
{ntp_features::kSearchSuggestChips, {}}},
{});
EXPECT_TRUE(SearchSuggestService::IsEnabled());
}
{
// Disabling ntp_features::kDisableSearchSuggestChips does not enable the
// service.
base::test::ScopedFeatureList feature_list;
std::map<std::string, std::string> feature_params;
// Note: ZPS variant 15 is NTP Realbox as starting focus.
feature_params["ZeroSuggestVariant:15:*"] = kRemoteNoUrlLocal;
feature_list.InitWithFeaturesAndParameters(
{{omnibox::kOnFocusSuggestions, feature_params}},
{ntp_features::kDisableSearchSuggestChips});
EXPECT_FALSE(SearchSuggestService::IsEnabled());
}
{
// Enabling ntp_features::kDisableSearchSuggestChips disables the service
// despite the other configs.
base::test::ScopedFeatureList feature_list;
std::map<std::string, std::string> feature_params;
// Note: ZPS variant 7 is NTP with Omnibox as starting focus.
feature_params["ZeroSuggestVariant:7:*"] = kRemoteNoUrlLocal;
// Note: ZPS variant 15 is NTP Realbox as starting focus.
feature_params["ZeroSuggestVariant:15:*"] = kRemoteNoUrlLocal;
feature_list.InitWithFeaturesAndParameters(
{{omnibox::kZeroSuggestionsOnNTP, {}},
{omnibox::kZeroSuggestionsOnNTPRealbox, {}},
{omnibox::kOnFocusSuggestions, feature_params},
{ntp_features::kSearchSuggestChips, {}},
{ntp_features::kDisableSearchSuggestChips, {}}},
{});
EXPECT_FALSE(SearchSuggestService::IsEnabled());
}
}
......
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