Commit c062ef9e authored by Moe Ahmadi's avatar Moe Ahmadi Committed by Commit Bot

Produces local history zero-prefix suggestions for signed-in users

Otherwise signing in could make the user experience worse, if there aren't
enough remote suggestions, e.g., a user with local history but a fresh
Google account or server's failure to return remote suggestions.

Bug: 996516,1021244
Change-Id: I9cbfebadc5a7e7e1d6e204890d668cc8b9f59984
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898299Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712322}
parent 240b7377
......@@ -68,9 +68,9 @@ void LocalHistoryZeroSuggestProvider::Start(const AutocompleteInput& input,
done_ = true;
matches_.clear();
// Allow local history query suggestions only when the user is unauthenticated
// and is not in an off-the-record context.
if (client_->IsAuthenticated() || client_->IsOffTheRecord())
// Allow local history query suggestions only when the user is not in an
// off-the-record context.
if (client_->IsOffTheRecord())
return;
// Allow local history query suggestions only when the omnibox is empty and is
......
......@@ -253,6 +253,26 @@ TEST_F(LocalHistoryZeroSuggestProviderTest, Input) {
"Omnibox.LocalHistoryZeroSuggest.AsyncDeleteTime", 0);
}
// Tests that suggestions are returned only user is not in an off-the-record
// context, regardless of the user's authentication state.
TEST_F(LocalHistoryZeroSuggestProviderTest, Incognito) {
LoadURLs({
{default_search_provider(), "hello world", "&foo=bar", 1},
});
EXPECT_CALL(*client_.get(), IsAuthenticated()).Times(0);
EXPECT_CALL(*client_.get(), IsOffTheRecord())
.Times(2)
.WillOnce(testing::Return(true))
.WillOnce(testing::Return(false));
StartProviderAndWaitUntilDone();
ExpectMatches({});
StartProviderAndWaitUntilDone();
ExpectMatches({{"hello world", 500}});
}
// Tests that suggestions are returned only if ZeroSuggestVariant is configured
// to return local history suggestions in the NTP.
TEST_F(LocalHistoryZeroSuggestProviderTest, ZeroSuggestVariant) {
......
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