app_shell: Add version number in user agent
[chromium-blink-merge.git] / chrome / browser / search_engines / template_url_service_factory_test_util.cc
blobb4bba853c120c3906ff8aaabd5e08577d35eac6c
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/search_engines/template_url_service_factory_test_util.h"
7 #include "base/run_loop.h"
8 #include "chrome/browser/search_engines/template_url_service_factory.h"
9 #include "chrome/test/base/testing_pref_service_syncable.h"
10 #include "chrome/test/base/testing_profile.h"
11 #include "components/search_engines/default_search_pref_test_util.h"
12 #include "components/search_engines/template_url_service.h"
14 TemplateURLServiceFactoryTestUtil::TemplateURLServiceFactoryTestUtil(
15 TestingProfile* profile)
16 : profile_(profile) {
17 profile_->CreateWebDataService();
19 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
20 profile_, TemplateURLServiceFactory::BuildInstanceFor);
23 TemplateURLServiceFactoryTestUtil::~TemplateURLServiceFactoryTestUtil() {
24 // Flush the message loop to make application verifiers happy.
25 base::RunLoop().RunUntilIdle();
28 void TemplateURLServiceFactoryTestUtil::VerifyLoad() {
29 model()->Load();
30 base::RunLoop().RunUntilIdle();
33 void TemplateURLServiceFactoryTestUtil::SetManagedDefaultSearchPreferences(
34 bool enabled,
35 const std::string& name,
36 const std::string& keyword,
37 const std::string& search_url,
38 const std::string& suggest_url,
39 const std::string& icon_url,
40 const std::string& encodings,
41 const std::string& alternate_url,
42 const std::string& search_terms_replacement_key) {
43 DefaultSearchPrefTestUtil::SetManagedPref(
44 profile_->GetTestingPrefService(),
45 enabled, name, keyword, search_url, suggest_url, icon_url, encodings,
46 alternate_url, search_terms_replacement_key);
49 void
50 TemplateURLServiceFactoryTestUtil::RemoveManagedDefaultSearchPreferences() {
51 DefaultSearchPrefTestUtil::RemoveManagedPref(
52 profile_->GetTestingPrefService());
55 TemplateURLService* TemplateURLServiceFactoryTestUtil::model() const {
56 return TemplateURLServiceFactory::GetForProfile(profile_);