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

Side by Side Diff: chrome/browser/search_engines/template_url_service_factory_test_util.cc

Issue 376413002: Stop using TemplateURLServiceTestUtil to initialize TemplateURLServiceFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix TemplateURLServiceWithoutFallbackTest Created 6 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/search_engines/template_url_service_factory_test_util.h "
6
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"
13
14 TemplateURLServiceFactoryTestUtil::TemplateURLServiceFactoryTestUtil(
15 TestingProfile* profile)
16 : profile_(profile) {
17 profile_->CreateWebDataService();
18
19 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
20 profile_, TemplateURLServiceFactory::BuildInstanceFor);
21 }
22
23 TemplateURLServiceFactoryTestUtil::~TemplateURLServiceFactoryTestUtil() {
24 // Flush the message loop to make application verifiers happy.
25 base::RunLoop().RunUntilIdle();
26 }
27
28 void TemplateURLServiceFactoryTestUtil::VerifyLoad() {
29 model()->Load();
30 base::RunLoop().RunUntilIdle();
31 }
32
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);
47 }
48
49 void
50 TemplateURLServiceFactoryTestUtil::RemoveManagedDefaultSearchPreferences() {
51 DefaultSearchPrefTestUtil::RemoveManagedPref(
52 profile_->GetTestingPrefService());
53 }
54
55 TemplateURLService* TemplateURLServiceFactoryTestUtil::model() const {
56 return TemplateURLServiceFactory::GetForProfile(profile_);
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698