| Index: chrome/browser/autocomplete/keyword_provider_unittest.cc | 
| diff --git a/chrome/browser/autocomplete/keyword_provider_unittest.cc b/chrome/browser/autocomplete/keyword_provider_unittest.cc | 
| index ef192d7fbe800d5dcb250b873b27c5446569c623..9c6b5633f7db62ec554f628ef3d1ef8176c252dc 100644 | 
| --- a/chrome/browser/autocomplete/keyword_provider_unittest.cc | 
| +++ b/chrome/browser/autocomplete/keyword_provider_unittest.cc | 
| @@ -224,3 +224,37 @@ TEST_F(KeywordProviderTest, GetKeywordForInput) { | 
| EXPECT_EQ(string16(), | 
| kw_provider_->GetKeywordForText(ASCIIToUTF16("aa foo"))); | 
| } | 
| + | 
| +TEST_F(KeywordProviderTest, GetSubstitutingTemplateURLForInput) { | 
| +  struct { | 
| +    const std::string text; | 
| +    const size_t cursor_position; | 
| +    const bool allow_exact_keyword_match; | 
| +    const std::string expected_url; | 
| +    const std::string updated_text; | 
| +    const size_t updated_cursor_position; | 
| +  } cases[] = { | 
| +    { "foo", string16::npos, true, "", "foo", string16::npos }, | 
| +    { "aa foo", string16::npos, true, "aa.com?foo={searchTerms}", "foo", | 
| +      string16::npos }, | 
| +    // Ignore cursor. | 
| +    { "aa foo", 4u, true, "aa.com?foo={searchTerms}", "foo", string16::npos }, | 
| +    // Disallow exact keyword match. | 
| +    { "aa foo", string16::npos, false, "", "aa foo", string16::npos }, | 
| +  }; | 
| +  for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) { | 
| +    AutocompleteInput input(ASCIIToUTF16(cases[i].text), | 
| +                            cases[i].cursor_position, string16(), | 
| +                            false, false, cases[i].allow_exact_keyword_match, | 
| +                            AutocompleteInput::ALL_MATCHES); | 
| +    const TemplateURL* url = | 
| +        KeywordProvider::GetSubstitutingTemplateURLForInput(model_.get(), | 
| +                                                            &input); | 
| +    if (cases[i].expected_url.empty()) | 
| +      EXPECT_FALSE(url); | 
| +    else | 
| +      EXPECT_EQ(cases[i].expected_url, url->url()); | 
| +    EXPECT_EQ(ASCIIToUTF16(cases[i].updated_text), input.text()); | 
| +    EXPECT_EQ(cases[i].updated_cursor_position, input.cursor_position()); | 
| +  } | 
| +} | 
|  |