Index: chrome/browser/search_engines/template_url_service_test_util.cc |
diff --git a/chrome/browser/search_engines/template_url_service_test_util.cc b/chrome/browser/search_engines/template_url_service_test_util.cc |
index fb80bdc839a49576eb3919a6296b0f40c4f08333..74b8b613f65c8122d546ef857a553a69aa90aeee 100644 |
--- a/chrome/browser/search_engines/template_url_service_test_util.cc |
+++ b/chrome/browser/search_engines/template_url_service_test_util.cc |
@@ -10,9 +10,9 @@ |
#include "chrome/browser/history/history_service_factory.h" |
#include "chrome/browser/search_engines/chrome_template_url_service_client.h" |
#include "chrome/test/base/testing_profile.h" |
-#include "components/search_engines/default_search_pref_test_util.h" |
#include "components/search_engines/keyword_table.h" |
#include "components/search_engines/keyword_web_data_service.h" |
+#include "components/search_engines/template_url_data_util.h" |
#include "components/search_engines/template_url_service.h" |
#include "components/search_engines/testing_search_terms_data.h" |
#include "components/sync_preferences/testing_pref_service_syncable.h" |
@@ -42,6 +42,21 @@ class TestingTemplateURLServiceClient : public ChromeTemplateURLServiceClient { |
} // namespace |
+void SetManagedDefaultSearchPreferences(const TemplateURLData& managed_data, |
+ bool enabled, |
+ TestingProfile* profile) { |
+ auto dict = TemplateURLDataToDictionary(managed_data); |
+ dict->SetBoolean(DefaultSearchManager::kDisabledByPolicy, !enabled); |
+ |
+ profile->GetTestingPrefService()->SetManagedPref( |
+ DefaultSearchManager::kDefaultSearchProviderDataPrefName, dict.release()); |
+} |
+ |
+void RemoveManagedDefaultSearchPreferences(TestingProfile* profile) { |
+ profile->GetTestingPrefService()->RemoveManagedPref( |
+ DefaultSearchManager::kDefaultSearchProviderDataPrefName); |
+} |
+ |
TemplateURLServiceTestUtil::TemplateURLServiceTestUtil() |
: changed_count_(0), |
search_terms_data_(NULL) { |
@@ -139,24 +154,3 @@ void TemplateURLServiceTestUtil::SetGoogleBaseURL(const GURL& base_url) { |
search_terms_data_->set_google_base_url(base_url.spec()); |
model_->GoogleBaseURLChanged(); |
} |
- |
-void TemplateURLServiceTestUtil::SetManagedDefaultSearchPreferences( |
- bool enabled, |
- const std::string& name, |
- const std::string& keyword, |
- const std::string& search_url, |
- const std::string& suggest_url, |
- const std::string& icon_url, |
- const std::string& encodings, |
- const std::string& alternate_url, |
- const std::string& search_terms_replacement_key) { |
- DefaultSearchPrefTestUtil::SetManagedPref( |
- profile()->GetTestingPrefService(), |
- enabled, name, keyword, search_url, suggest_url, icon_url, encodings, |
- alternate_url, search_terms_replacement_key); |
-} |
- |
-void TemplateURLServiceTestUtil::RemoveManagedDefaultSearchPreferences() { |
- DefaultSearchPrefTestUtil::RemoveManagedPref( |
- profile()->GetTestingPrefService()); |
-} |