Chromium Code Reviews| Index: chrome/browser/autocomplete/keyword_provider_unittest.cc |
| =================================================================== |
| --- chrome/browser/autocomplete/keyword_provider_unittest.cc (revision 108642) |
| +++ chrome/browser/autocomplete/keyword_provider_unittest.cc (working copy) |
| @@ -32,6 +32,8 @@ |
| int num_cases, |
| ResultType AutocompleteMatch::* member); |
| + void RunTest(const char* input, const char* keyword); |
|
Peter Kasting
2011/12/15 22:56:04
I'd prefer not to add a function with the same nam
|
| + |
| protected: |
| scoped_refptr<KeywordProvider> kw_provider_; |
| scoped_ptr<TemplateURLService> model_; |
| @@ -80,6 +82,14 @@ |
| } |
| } |
| +void KeywordProviderTest::RunTest(const char* input, |
| + const char* keyword) { |
| + string16 keyword16(ASCIIToUTF16(keyword)); |
| + string16 detected_keyword = |
| + kw_provider_->GetKeywordForText(ASCIIToUTF16(input)); |
| + EXPECT_EQ(keyword16, detected_keyword); |
| +} |
| + |
| // http://crbug.com/80612 |
| TEST_F(KeywordProviderTest, DISABLED_Edit) { |
| test_data<string16> edit_cases[] = { |
| @@ -216,3 +226,10 @@ |
| model_->Remove(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa"))); |
| ASSERT_TRUE(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")) == NULL); |
| } |
| + |
| +TEST_F(KeywordProviderTest, GetKeywordForInput) { |
| + RunTest("aa", "aa"); |
| + RunTest("aafoo", ""); |
| + RunTest("aa foo", "aa"); |
| +} |
| + |