| 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" |
| 11 #include "chrome/test/testing_browser_process.h" | 11 #include "chrome/test/base/testing_browser_process.h" |
| 12 #include "chrome/test/testing_browser_process_test.h" | 12 #include "chrome/test/base/testing_browser_process_test.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 class KeywordProviderTest : public TestingBrowserProcessTest { | 16 class KeywordProviderTest : public TestingBrowserProcessTest { |
| 17 protected: | 17 protected: |
| 18 template<class ResultType> | 18 template<class ResultType> |
| 19 struct test_data { | 19 struct test_data { |
| 20 const string16 input; | 20 const string16 input; |
| 21 const size_t num_results; | 21 const size_t num_results; |
| 22 const ResultType output[3]; | 22 const ResultType output[3]; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 template_url->set_short_name(ASCIIToUTF16("Test")); | 210 template_url->set_short_name(ASCIIToUTF16("Test")); |
| 211 model_->Add(template_url); | 211 model_->Add(template_url); |
| 212 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword)); | 212 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword)); |
| 213 } | 213 } |
| 214 | 214 |
| 215 TEST_F(KeywordProviderTest, RemoveKeyword) { | 215 TEST_F(KeywordProviderTest, RemoveKeyword) { |
| 216 string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c")); | 216 string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c")); |
| 217 model_->Remove(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa"))); | 217 model_->Remove(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa"))); |
| 218 ASSERT_TRUE(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")) == NULL); | 218 ASSERT_TRUE(model_->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")) == NULL); |
| 219 } | 219 } |
| OLD | NEW |