| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void ResetModel(bool verify_load); | 71 void ResetModel(bool verify_load); |
| 72 | 72 |
| 73 // Returns the search term from the last invocation of | 73 // Returns the search term from the last invocation of |
| 74 // TemplateURLService::SetKeywordSearchTermsForURL and clears the search term. | 74 // TemplateURLService::SetKeywordSearchTermsForURL and clears the search term. |
| 75 string16 GetAndClearSearchTerm(); | 75 string16 GetAndClearSearchTerm(); |
| 76 | 76 |
| 77 // Set the google base url. |base_url| must be valid. | 77 // Set the google base url. |base_url| must be valid. |
| 78 void SetGoogleBaseURL(const GURL& base_url) const; | 78 void SetGoogleBaseURL(const GURL& base_url) const; |
| 79 | 79 |
| 80 // Set the managed preferences for the default search provider and trigger | 80 // Set the managed preferences for the default search provider and trigger |
| 81 // notification. | 81 // notification. If |alternate_url| is empty, uses an empty list of alternate |
| 82 void SetManagedDefaultSearchPreferences(bool enabled, | 82 // URLs, otherwise use a list containing a single entry. |
| 83 const std::string& name, | 83 void SetManagedDefaultSearchPreferences( |
| 84 const std::string& keyword, | 84 bool enabled, |
| 85 const std::string& search_url, | 85 const std::string& name, |
| 86 const std::string& suggest_url, | 86 const std::string& keyword, |
| 87 const std::string& icon_url, | 87 const std::string& search_url, |
| 88 const std::string& encodings); | 88 const std::string& suggest_url, |
| 89 const std::string& icon_url, |
| 90 const std::string& encodings, |
| 91 const std::string& alternate_url, |
| 92 const std::string& search_terms_replacement_key); |
| 89 | 93 |
| 90 // Remove all the managed preferences for the default search provider and | 94 // Remove all the managed preferences for the default search provider and |
| 91 // trigger notification. | 95 // trigger notification. |
| 92 void RemoveManagedDefaultSearchPreferences(); | 96 void RemoveManagedDefaultSearchPreferences(); |
| 93 | 97 |
| 94 // Returns the TemplateURLService. | 98 // Returns the TemplateURLService. |
| 95 TemplateURLService* model() const; | 99 TemplateURLService* model() const; |
| 96 | 100 |
| 97 // Returns the TestingProfile. | 101 // Returns the TestingProfile. |
| 98 TestingProfile* profile() const; | 102 TestingProfile* profile() const; |
| 99 | 103 |
| 100 // Starts an I/O thread. | 104 // Starts an I/O thread. |
| 101 void StartIOThread(); | 105 void StartIOThread(); |
| 102 | 106 |
| 103 // Runs all pending tasks on the UI loop. | 107 // Runs all pending tasks on the UI loop. |
| 104 void PumpLoop(); | 108 void PumpLoop(); |
| 105 | 109 |
| 106 private: | 110 private: |
| 107 MessageLoopForUI message_loop_; | 111 MessageLoopForUI message_loop_; |
| 108 // Needed to make the DeleteOnUIThread trait of WebDataService work | 112 // Needed to make the DeleteOnUIThread trait of WebDataService work |
| 109 // properly. | 113 // properly. |
| 110 content::TestBrowserThread ui_thread_; | 114 content::TestBrowserThread ui_thread_; |
| 111 scoped_ptr<TemplateURLServiceTestingProfile> profile_; | 115 scoped_ptr<TemplateURLServiceTestingProfile> profile_; |
| 112 int changed_count_; | 116 int changed_count_; |
| 113 | 117 |
| 114 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceTestUtil); | 118 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceTestUtil); |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ | 121 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_TEST_UTIL_H_ |
| OLD | NEW |