Commit 43b20143 authored by Tomasz Wiszkowski's avatar Tomasz Wiszkowski Committed by Commit Bot

Enable Local-history ZPS for signed-out users by default.

This change enables on-device history ZPS suggestions for users
who are not signed in to Chrome on Android.

Bug: 956837
Change-Id: I689960538b1087eac9355ba0b20da7310f5e3daa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132864
Commit-Queue: Ender <ender@google.com>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755854}
parent 6dc9cae6
...@@ -48,6 +48,19 @@ base::string16 GetSearchTermsFromURL(const GURL& url, ...@@ -48,6 +48,19 @@ base::string16 GetSearchTermsFromURL(const GURL& url,
return base::i18n::ToLower(base::CollapseWhitespace(search_terms, false)); return base::i18n::ToLower(base::CollapseWhitespace(search_terms, false));
} }
// Whether zero suggest suggestions are allowed in the given context.
// Invoked early, confirms all the conditions for zero suggestions are met.
bool AllowLocalHistoryZeroSuggestSuggestions(const AutocompleteInput& input) {
#if defined(OS_ANDROID) // Default-enabled on Android.
return true;
#else
return base::Contains(
OmniboxFieldTrial::GetZeroSuggestVariants(
input.current_page_classification()),
LocalHistoryZeroSuggestProvider::kZeroSuggestLocalVariant);
#endif
}
} // namespace } // namespace
// static // static
...@@ -91,11 +104,8 @@ void LocalHistoryZeroSuggestProvider::Start(const AutocompleteInput& input, ...@@ -91,11 +104,8 @@ void LocalHistoryZeroSuggestProvider::Start(const AutocompleteInput& input,
return; return;
} }
if (!base::Contains(OmniboxFieldTrial::GetZeroSuggestVariants( if (!AllowLocalHistoryZeroSuggestSuggestions(input))
input.current_page_classification()),
kZeroSuggestLocalVariant)) {
return; return;
}
QueryURLDatabase(input); QueryURLDatabase(input);
} }
......
...@@ -291,7 +291,11 @@ TEST_F(LocalHistoryZeroSuggestProviderTest, ZeroSuggestVariant) { ...@@ -291,7 +291,11 @@ TEST_F(LocalHistoryZeroSuggestProviderTest, ZeroSuggestVariant) {
SetZeroSuggestVariant(metrics::OmniboxEventProto::NTP_REALBOX, SetZeroSuggestVariant(metrics::OmniboxEventProto::NTP_REALBOX,
/*zero_suggest_variant_value=*/"blah"); /*zero_suggest_variant_value=*/"blah");
StartProviderAndWaitUntilDone(); StartProviderAndWaitUntilDone();
#if defined(OS_ANDROID) // Enabled by default.
ExpectMatches({{"hello world", 500}});
#else
ExpectMatches({}); ExpectMatches({});
#endif
SetZeroSuggestVariant( SetZeroSuggestVariant(
metrics::OmniboxEventProto::NTP_REALBOX, metrics::OmniboxEventProto::NTP_REALBOX,
......
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