Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: components/search_engines/default_search_pref_test_util.h

Issue 2541493002: Refactor search_engines tests to better reuse code (Closed)
Patch Set: Fixed after review Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/search_engines/BUILD.gn ('k') | components/search_engines/default_search_pref_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/search_engines/default_search_pref_test_util.h
diff --git a/components/search_engines/default_search_pref_test_util.h b/components/search_engines/default_search_pref_test_util.h
deleted file mode 100644
index 1732119b3bb770d552767e4ed3088ccc75307118..0000000000000000000000000000000000000000
--- a/components/search_engines/default_search_pref_test_util.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_PREF_TEST_UTIL_H_
-#define COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_PREF_TEST_UTIL_H_
-
-#include <memory>
-#include <string>
-
-#include "base/values.h"
-#include "components/search_engines/default_search_manager.h"
-
-class DefaultSearchPrefTestUtil {
- public:
- // Creates a DictionaryValue which can be used as a
- // kDefaultSearchProviderDataPrefName preference value.
- static std::unique_ptr<base::DictionaryValue>
- CreateDefaultSearchPreferenceValue(
- 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);
-
- // Set the managed preferences for the default search provider and trigger
- // notification. If |alternate_url| is empty, uses an empty list of alternate
- // URLs, otherwise use a list containing a single entry.
- template<typename TestingPrefService>
- static void SetManagedPref(TestingPrefService* pref_service,
- 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) {
- pref_service->SetManagedPref(
- DefaultSearchManager::kDefaultSearchProviderDataPrefName,
- CreateDefaultSearchPreferenceValue(
- enabled, name, keyword, search_url, suggest_url, icon_url,
- encodings, alternate_url, search_terms_replacement_key).release());
- }
-
- // Remove all the managed preferences for the default search provider and
- // trigger notification.
- template<typename TestingPrefService>
- static void RemoveManagedPref(TestingPrefService* pref_service) {
- pref_service->RemoveManagedPref(
- DefaultSearchManager::kDefaultSearchProviderDataPrefName);
- }
-};
-
-#endif // COMPONENTS_SEARCH_ENGINES_DEFAULT_SEARCH_PREF_TEST_UTIL_H_
« no previous file with comments | « components/search_engines/BUILD.gn ('k') | components/search_engines/default_search_pref_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698