From c0048b454d97599f3e4a02ed30d01345bb4216c1 Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Mon, 4 May 2009 21:47:17 +0000 Subject: Fixes bug in search provider. It wasn't setting template_url and correct fill_into_edit for keywords. BUG=11416 TEST=see bug Review URL: http://codereview.chromium.org/100350 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15245 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/autocomplete/search_provider.cc | 4 ++++ chrome/browser/autocomplete/search_provider_unittest.cc | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 2f123d8..b028587 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -697,6 +697,10 @@ void SearchProvider::AddMatchToMap(const std::wstring& query_string, match.fill_into_edit.assign(L"?"); ++search_start; } + if (is_keyword) { + match.fill_into_edit.append(providers_.keyword_provider().keyword() + L" "); + match.template_url = &providers_.keyword_provider(); + } match.fill_into_edit.append(query_string); // NOTE: All Google suggestions currently start with the original input, but // not all Yahoo! suggestions do. diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc index 530e7ee..5b81dc5 100644 --- a/chrome/browser/autocomplete/search_provider_unittest.cc +++ b/chrome/browser/autocomplete/search_provider_unittest.cc @@ -243,4 +243,11 @@ TEST_F(SearchProviderTest, QueryKeywordProvider) { // term keyword. AutocompleteMatch match = FindMatchWithDestination(keyword_url_); ASSERT_TRUE(!match.destination_url.is_empty()); + + // The match should have a TemplateURL. + EXPECT_TRUE(match.template_url); + + // The fill into edit should contain the keyword. + EXPECT_EQ(keyword_t_url_->keyword() + L" " + keyword_term_, + match.fill_into_edit); } -- cgit v1.1