OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autocomplete/autocomplete_match.h" | 7 #include "chrome/browser/autocomplete/autocomplete_match.h" |
8 #include "chrome/browser/autocomplete/keyword_provider.h" | 8 #include "chrome/browser/autocomplete/keyword_provider.h" |
9 #include "chrome/browser/search_engines/template_url.h" | 9 #include "chrome/browser/search_engines/template_url.h" |
10 #include "chrome/browser/search_engines/template_url_service.h" | 10 #include "chrome/browser/search_engines/template_url_service.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 template_url->set_short_name(ASCIIToUTF16("Test")); | 209 template_url->set_short_name(ASCIIToUTF16("Test")); |
210 model_->Add(template_url); | 210 model_->Add(template_url); |
211 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword)); | 211 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword)); |
212 } | 212 } |
213 | 213 |
214 TEST_F(KeywordProviderTest, RemoveKeyword) { | 214 TEST_F(KeywordProviderTest, RemoveKeyword) { |
215 string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c")); | 215 string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c")); |
216 model_->Remove(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa"))); | 216 model_->Remove(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa"))); |
217 ASSERT_TRUE(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")) == NULL); | 217 ASSERT_TRUE(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")) == NULL); |
218 } | 218 } |
| 219 |
| 220 TEST_F(KeywordProviderTest, GetKeywordForInput) { |
| 221 EXPECT_EQ(ASCIIToUTF16("aa"), |
| 222 kw_provider_->GetKeywordForText(ASCIIToUTF16("aa"))); |
| 223 EXPECT_EQ(string16(), |
| 224 kw_provider_->GetKeywordForText(ASCIIToUTF16("aafoo"))); |
| 225 EXPECT_EQ(string16(), |
| 226 kw_provider_->GetKeywordForText(ASCIIToUTF16("aa foo"))); |
| 227 } |
| 228 |
OLD | NEW |