#include "chrome/browser/search_engines/template_url_service_test_util.h"
#include <memory>
#include <utility>
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/search_engines/chrome_template_url_service_client.h"
#include "chrome/test/base/scoped_testing_local_state.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "components/search_engines/keyword_table.h"
#include "components/search_engines/keyword_web_data_service.h"
#include "components/search_engines/search_engine_choice/search_engine_choice_service.h"
#include "components/search_engines/search_engines_test_util.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"
#include "components/webdata/common/web_database_service.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
class TestingTemplateURLServiceClient : public ChromeTemplateURLServiceClient { … };
}
void SetManagedDefaultSearchPreferences(const TemplateURLData& managed_data,
bool enabled,
TestingProfile* profile) { … }
void RemoveManagedDefaultSearchPreferences(TestingProfile* profile) { … }
void SetRecommendedDefaultSearchPreferences(const TemplateURLData& data,
bool enabled,
TestingProfile* profile) { … }
void SetManagedSiteSearchSettingsPreference(
const EnterpriseSiteSearchManager::OwnedTemplateURLDataVector&
site_search_engines,
TestingProfile* profile) { … }
std::unique_ptr<TemplateURL> CreateTestTemplateURL(
const std::u16string& keyword,
const std::string& url,
const std::string& guid,
base::Time last_modified,
bool safe_for_autoreplace,
TemplateURLData::CreatedByPolicy created_by_policy,
int prepopulate_id) { … }
TemplateURLServiceTestUtil::TemplateURLServiceTestUtil()
: … { … }
TemplateURLServiceTestUtil::TemplateURLServiceTestUtil(PrefService& local_state)
: … { … }
TemplateURLServiceTestUtil::TemplateURLServiceTestUtil(
TestingProfile::TestingFactories testing_factories,
PrefService* local_state)
: … { … }
TemplateURLServiceTestUtil::~TemplateURLServiceTestUtil() { … }
void TemplateURLServiceTestUtil::OnTemplateURLServiceChanged() { … }
int TemplateURLServiceTestUtil::GetObserverCount() { … }
void TemplateURLServiceTestUtil::ResetObserverCount() { … }
void TemplateURLServiceTestUtil::VerifyLoad() { … }
void TemplateURLServiceTestUtil::ChangeModelToLoadState() { … }
void TemplateURLServiceTestUtil::ClearModel() { … }
void TemplateURLServiceTestUtil::ResetModel(bool verify_load) { … }
std::u16string TemplateURLServiceTestUtil::GetAndClearSearchTerm() { … }
TemplateURL* TemplateURLServiceTestUtil::AddExtensionControlledTURL(
std::unique_ptr<TemplateURL> extension_turl) { … }
void TemplateURLServiceTestUtil::RemoveExtensionControlledTURL(
const std::string& extension_id) { … }