diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 21:47:17 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-04 21:47:17 +0000 |
commit | c0048b454d97599f3e4a02ed30d01345bb4216c1 (patch) | |
tree | e996b09413c70f1d3992df90c3400908c92ca6d8 /chrome | |
parent | 8ee37f03d400794478584634d3d493a12f6b989d (diff) | |
download | chromium_src-c0048b454d97599f3e4a02ed30d01345bb4216c1.zip chromium_src-c0048b454d97599f3e4a02ed30d01345bb4216c1.tar.gz chromium_src-c0048b454d97599f3e4a02ed30d01345bb4216c1.tar.bz2 |
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
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/autocomplete/search_provider.cc | 4 | ||||
-rw-r--r-- | chrome/browser/autocomplete/search_provider_unittest.cc | 7 |
2 files changed, 11 insertions, 0 deletions
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); } |