OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // TemplateURLService::SetKeywordSearchTermsForURL and clears the search term. | 63 // TemplateURLService::SetKeywordSearchTermsForURL and clears the search term. |
64 base::string16 GetAndClearSearchTerm(); | 64 base::string16 GetAndClearSearchTerm(); |
65 | 65 |
66 // Sets the google base url. |base_url| must be valid. | 66 // Sets the google base url. |base_url| must be valid. |
67 void SetGoogleBaseURL(const GURL& base_url); | 67 void SetGoogleBaseURL(const GURL& base_url); |
68 | 68 |
69 // Adds extension controlled TemplateURL to the model and overrides default | 69 // Adds extension controlled TemplateURL to the model and overrides default |
70 // search pref in an extension controlled preferences, if extension wants to | 70 // search pref in an extension controlled preferences, if extension wants to |
71 // be default. | 71 // be default. |
72 TemplateURL* AddExtensionControlledTURL( | 72 TemplateURL* AddExtensionControlledTURL( |
73 std::unique_ptr<TemplateURL> extension_turl, | 73 std::unique_ptr<TemplateURL> extension_turl); |
74 const std::string& extension_id, | |
75 bool wants_to_be_default, | |
76 base::Time install_time = base::Time()); | |
77 | 74 |
78 // Removes a TemplateURL controlled by |extension_id| from the model, and, | 75 // Removes a TemplateURL controlled by |extension_id| from the model, and, |
79 // if necessary, from the extension-controlled default search preference. | 76 // if necessary, from the extension-controlled default search preference. |
80 // This TemplateURL must exist. | 77 // This TemplateURL must exist. |
81 void RemoveExtensionControlledTURL(const std::string& extension_id); | 78 void RemoveExtensionControlledTURL(const std::string& extension_id); |
82 | 79 |
83 KeywordWebDataService* web_data_service() { return web_data_service_.get(); } | 80 KeywordWebDataService* web_data_service() { return web_data_service_.get(); } |
84 TemplateURLService* model() { return model_.get(); } | 81 TemplateURLService* model() { return model_.get(); } |
85 TestingProfile* profile() { return profile_.get(); } | 82 TestingProfile* profile() { return profile_.get(); } |
86 | 83 |
87 private: | 84 private: |
88 std::unique_ptr<TestingProfile> profile_; | 85 std::unique_ptr<TestingProfile> profile_; |
89 base::ScopedTempDir temp_dir_; | 86 base::ScopedTempDir temp_dir_; |
90 int changed_count_; | 87 int changed_count_; |
91 base::string16 search_term_; | 88 base::string16 search_term_; |
92 scoped_refptr<KeywordWebDataService> web_data_service_; | 89 scoped_refptr<KeywordWebDataService> web_data_service_; |
93 TestingSearchTermsData* search_terms_data_; | 90 TestingSearchTermsData* search_terms_data_; |
94 std::unique_ptr<TemplateURLService> model_; | 91 std::unique_ptr<TemplateURLService> model_; |
95 | 92 |
96 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceTestUtil); | 93 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceTestUtil); |
97 }; | 94 }; |
98 | 95 |
99 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ | 96 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ |
OLD | NEW |