Commit 751f9c67 authored by Mark Pearson's avatar Mark Pearson Committed by Commit Bot

Omnibox - Send Blank Query on Warm-Up Suggest Server Request

Fixes code and corresponding text.

Tested change interactively using the repro steps on the bug.

Bug: 868486
Change-Id: Id81cbddf28242b6c4efe5c50595fdb393d59d5b1
Reviewed-on: https://chromium-review.googlesource.com/1154432
Commit-Queue: Mark Pearson <mpearson@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579095}
parent da71e35a
......@@ -3672,11 +3672,12 @@ TEST_F(SearchProviderTest, SendsWarmUpRequestOnFocus) {
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(provider_->done());
EXPECT_TRUE(provider_->matches().empty());
// Make sure the default provider's suggest service was queried.
EXPECT_TRUE(test_url_loader_factory_.IsPending("http://defaultturl2/f"));
// Make sure the default provider's suggest service was queried with an
// empty query.
EXPECT_TRUE(test_url_loader_factory_.IsPending("http://defaultturl2/"));
// Even if the fetcher returns results, we should still have no suggestions
// (though the provider should now be done).
test_url_loader_factory_.AddResponse("http://defaultturl2/f",
test_url_loader_factory_.AddResponse("http://defaultturl2/",
R"(["",["a", "b"],[],[],{}])");
RunTillProviderDone();
EXPECT_TRUE(provider_->done());
......
......@@ -892,8 +892,14 @@ std::unique_ptr<network::SimpleURLLoader> SearchProvider::CreateSuggestLoader(
search_term_args.prefetch_query_type =
base::UTF16ToUTF8(prefetch_data_.query_type);
}
// If the request is from omnibox focus, send empty search term args. The
// purpose of such a request is to signal the server to warm up; no info
// is required.
GURL suggest_url(template_url->suggestions_url_ref().ReplaceSearchTerms(
search_term_args,
input.from_omnibox_focus()
? TemplateURLRef::SearchTermsArgs(base::string16())
: search_term_args,
client()->GetTemplateURLService()->search_terms_data()));
if (!suggest_url.is_valid())
return nullptr;
......
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