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

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

Issue 367863005: No chrome dependencies in TemplateURLService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename to TemplateURLServiceClient 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/search_engines/template_url_service_test_util.h" 5 #include "chrome/browser/search_engines/template_url_service_test_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "chrome/browser/search_engines/chrome_template_url_service_client.h"
11 #include "chrome/browser/search_engines/template_url_service.h" 12 #include "chrome/browser/search_engines/template_url_service.h"
12 #include "chrome/browser/search_engines/template_url_service_factory.h" 13 #include "chrome/browser/search_engines/template_url_service_factory.h"
13 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" 14 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
14 #include "chrome/browser/webdata/web_data_service_factory.h" 15 #include "chrome/browser/webdata/web_data_service_factory.h"
15 #include "chrome/test/base/testing_pref_service_syncable.h" 16 #include "chrome/test/base/testing_pref_service_syncable.h"
16 #include "chrome/test/base/testing_profile.h" 17 #include "chrome/test/base/testing_profile.h"
17 #include "components/google/core/browser/google_url_tracker.h" 18 #include "components/google/core/browser/google_url_tracker.h"
18 #include "components/search_engines/default_search_manager.h" 19 #include "components/search_engines/default_search_manager.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 #if defined(OS_CHROMEOS) 22 #if defined(OS_CHROMEOS)
22 #include "chrome/browser/google/google_brand_chromeos.h" 23 #include "chrome/browser/google/google_brand_chromeos.h"
23 #endif 24 #endif
24 25
25 // Trivial subclass of TemplateURLService that records the last invocation of 26 // Trivial subclass of TemplateURLService that records the last invocation of
26 // SetKeywordSearchTermsForURL. 27 // SetKeywordSearchTermsForURL.
27 class TestingTemplateURLService : public TemplateURLService { 28 class TestingTemplateURLService : public TemplateURLService {
28 public: 29 public:
29 static KeyedService* Build(content::BrowserContext* profile) { 30 static KeyedService* Build(content::BrowserContext* profile) {
30 return new TestingTemplateURLService(static_cast<Profile*>(profile)); 31 return new TestingTemplateURLService(static_cast<Profile*>(profile));
31 } 32 }
32 33
33 explicit TestingTemplateURLService(Profile* profile) 34 explicit TestingTemplateURLService(Profile* profile)
34 : TemplateURLService(profile, NULL, base::Closure()) { 35 : TemplateURLService(
36 profile->GetPrefs(),
37 scoped_ptr<SearchTermsData>(new UIThreadSearchTermsData(profile)),
38 WebDataServiceFactory::GetKeywordWebDataForProfile(
39 profile, Profile::EXPLICIT_ACCESS),
40 scoped_ptr<TemplateURLServiceClient>(
41 new ChromeTemplateURLServiceClient(profile)), NULL, NULL,
42 base::Closure()) {
35 } 43 }
36 44
37 base::string16 GetAndClearSearchTerm() { 45 base::string16 GetAndClearSearchTerm() {
38 base::string16 search_term; 46 base::string16 search_term;
39 search_term.swap(search_term_); 47 search_term.swap(search_term_);
40 return search_term; 48 return search_term;
41 } 49 }
42 50
43 protected: 51 protected:
44 virtual void SetKeywordSearchTermsForURL( 52 virtual void SetKeywordSearchTermsForURL(
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 233
226 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); 234 UIThreadSearchTermsData::SetGoogleBaseURL(std::string());
227 235
228 // Flush the message loop to make application verifiers happy. 236 // Flush the message loop to make application verifiers happy.
229 base::RunLoop().RunUntilIdle(); 237 base::RunLoop().RunUntilIdle();
230 } 238 }
231 239
232 TestingProfile* TemplateURLServiceTestUtil::profile() const { 240 TestingProfile* TemplateURLServiceTestUtil::profile() const {
233 return profile_.get(); 241 return profile_.get();
234 } 242 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698