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

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

Issue 10458077: When the Google base URL changes and causes keyword updates, save those to the database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "chrome/browser/google/google_url_tracker.h"
13 #include "chrome/browser/search_engines/search_terms_data.h" 14 #include "chrome/browser/search_engines/search_terms_data.h"
14 #include "chrome/browser/search_engines/template_url_service.h" 15 #include "chrome/browser/search_engines/template_url_service.h"
15 #include "chrome/browser/search_engines/template_url_service_factory.h" 16 #include "chrome/browser/search_engines/template_url_service_factory.h"
16 #include "chrome/browser/webdata/web_data_service_factory.h" 17 #include "chrome/browser/webdata/web_data_service_factory.h"
17 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "chrome/test/base/testing_pref_service.h" 20 #include "chrome/test/base/testing_pref_service.h"
20 #include "chrome/test/base/testing_profile.h" 21 #include "chrome/test/base/testing_profile.h"
21 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
22 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 VerifyLoad(); 238 VerifyLoad();
238 } 239 }
239 240
240 string16 TemplateURLServiceTestUtil::GetAndClearSearchTerm() { 241 string16 TemplateURLServiceTestUtil::GetAndClearSearchTerm() {
241 return 242 return
242 static_cast<TestingTemplateURLService*>(model())->GetAndClearSearchTerm(); 243 static_cast<TestingTemplateURLService*>(model())->GetAndClearSearchTerm();
243 } 244 }
244 245
245 void TemplateURLServiceTestUtil::SetGoogleBaseURL(const GURL& base_url) const { 246 void TemplateURLServiceTestUtil::SetGoogleBaseURL(const GURL& base_url) const {
246 DCHECK(base_url.is_valid()); 247 DCHECK(base_url.is_valid());
248 UIThreadSearchTermsData data(profile_.get());
249 GoogleURLTracker::UpdatedDetails urls(GURL(data.GoogleBaseURLValue()),
250 base_url);
247 UIThreadSearchTermsData::SetGoogleBaseURL(base_url.spec()); 251 UIThreadSearchTermsData::SetGoogleBaseURL(base_url.spec());
248 content::NotificationService::current()->Notify( 252 content::NotificationService::current()->Notify(
249 chrome::NOTIFICATION_GOOGLE_URL_UPDATED, 253 chrome::NOTIFICATION_GOOGLE_URL_UPDATED,
250 content::Source<Profile>(profile_.get()), 254 content::Source<Profile>(profile_.get()),
251 content::Details<const GURL>(&base_url)); 255 content::Details<GoogleURLTracker::UpdatedDetails>(&urls));
252 } 256 }
253 257
254 void TemplateURLServiceTestUtil::SetManagedDefaultSearchPreferences( 258 void TemplateURLServiceTestUtil::SetManagedDefaultSearchPreferences(
255 bool enabled, 259 bool enabled,
256 const std::string& name, 260 const std::string& name,
257 const std::string& keyword, 261 const std::string& keyword,
258 const std::string& search_url, 262 const std::string& search_url,
259 const std::string& suggest_url, 263 const std::string& suggest_url,
260 const std::string& icon_url, 264 const std::string& icon_url,
261 const std::string& encodings) { 265 const std::string& encodings) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 return profile_.get(); 307 return profile_.get();
304 } 308 }
305 309
306 void TemplateURLServiceTestUtil::StartIOThread() { 310 void TemplateURLServiceTestUtil::StartIOThread() {
307 profile_->StartIOThread(); 311 profile_->StartIOThread();
308 } 312 }
309 313
310 void TemplateURLServiceTestUtil::PumpLoop() { 314 void TemplateURLServiceTestUtil::PumpLoop() {
311 message_loop_.RunAllPending(); 315 message_loop_.RunAllPending();
312 } 316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698