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

Side by Side Diff: chrome/test/base/testing_profile.cc

Issue 9834056: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload rebase Created 8 years, 8 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
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/base/testing_profile.h" 5 #include "chrome/test/base/testing_profile.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 profile_dependency_manager_->DestroyProfileServices(this); 231 profile_dependency_manager_->DestroyProfileServices(this);
232 232
233 if (host_content_settings_map_) 233 if (host_content_settings_map_)
234 host_content_settings_map_->ShutdownOnUIThread(); 234 host_content_settings_map_->ShutdownOnUIThread();
235 235
236 DestroyTopSites(); 236 DestroyTopSites();
237 DestroyHistoryService(); 237 DestroyHistoryService();
238 // FaviconService depends on HistoryServce so destroying it later. 238 // FaviconService depends on HistoryServce so destroying it later.
239 DestroyFaviconService(); 239 DestroyFaviconService();
240 DestroyWebDataService();
241 240
242 if (pref_proxy_config_tracker_.get()) 241 if (pref_proxy_config_tracker_.get())
243 pref_proxy_config_tracker_->DetachFromPrefService(); 242 pref_proxy_config_tracker_->DetachFromPrefService();
244 } 243 }
245 244
246 void TestingProfile::CreateFaviconService() { 245 void TestingProfile::CreateFaviconService() {
247 favicon_service_.reset(new FaviconService(this)); 246 favicon_service_.reset(new FaviconService(this));
248 } 247 }
249 248
250 void TestingProfile::CreateHistoryService(bool delete_file, bool no_db) { 249 void TestingProfile::CreateHistoryService(bool delete_file, bool no_db) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 322
324 void TestingProfile::CreateAutocompleteClassifier() { 323 void TestingProfile::CreateAutocompleteClassifier() {
325 autocomplete_classifier_.reset(new AutocompleteClassifier(this)); 324 autocomplete_classifier_.reset(new AutocompleteClassifier(this));
326 } 325 }
327 326
328 void TestingProfile::CreateProtocolHandlerRegistry() { 327 void TestingProfile::CreateProtocolHandlerRegistry() {
329 protocol_handler_registry_ = new ProtocolHandlerRegistry(this, 328 protocol_handler_registry_ = new ProtocolHandlerRegistry(this,
330 new ProtocolHandlerRegistry::Delegate()); 329 new ProtocolHandlerRegistry::Delegate());
331 } 330 }
332 331
333 void TestingProfile::CreateWebDataService(bool delete_file) {
334 if (web_data_service_.get())
335 web_data_service_->Shutdown();
336
337 if (delete_file) {
338 FilePath path = GetPath();
339 path = path.Append(chrome::kWebDataFilename);
340 file_util::Delete(path, false);
341 }
342
343 web_data_service_ = new WebDataService;
344 if (web_data_service_.get())
345 web_data_service_->Init(GetPath());
346 }
347
348 void TestingProfile::BlockUntilBookmarkModelLoaded() { 332 void TestingProfile::BlockUntilBookmarkModelLoaded() {
349 DCHECK(bookmark_bar_model_.get()); 333 DCHECK(bookmark_bar_model_.get());
350 if (bookmark_bar_model_->IsLoaded()) 334 if (bookmark_bar_model_->IsLoaded())
351 return; 335 return;
352 BookmarkLoadObserver observer; 336 BookmarkLoadObserver observer;
353 bookmark_bar_model_->AddObserver(&observer); 337 bookmark_bar_model_->AddObserver(&observer);
354 MessageLoop::current()->Run(); 338 MessageLoop::current()->Run();
355 bookmark_bar_model_->RemoveObserver(&observer); 339 bookmark_bar_model_->RemoveObserver(&observer);
356 DCHECK(bookmark_bar_model_->IsLoaded()); 340 DCHECK(bookmark_bar_model_->IsLoaded());
357 } 341 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 471 }
488 472
489 AutocompleteClassifier* TestingProfile::GetAutocompleteClassifier() { 473 AutocompleteClassifier* TestingProfile::GetAutocompleteClassifier() {
490 return autocomplete_classifier_.get(); 474 return autocomplete_classifier_.get();
491 } 475 }
492 476
493 history::ShortcutsBackend* TestingProfile::GetShortcutsBackend() { 477 history::ShortcutsBackend* TestingProfile::GetShortcutsBackend() {
494 return NULL; 478 return NULL;
495 } 479 }
496 480
497 WebDataService* TestingProfile::GetWebDataService(ServiceAccessType access) {
498 return web_data_service_.get();
499 }
500
501 WebDataService* TestingProfile::GetWebDataServiceWithoutCreating() {
502 return web_data_service_.get();
503 }
504
505 void TestingProfile::SetPrefService(PrefService* prefs) { 481 void TestingProfile::SetPrefService(PrefService* prefs) {
506 #if defined(ENABLE_PROTECTOR_SERVICE) 482 #if defined(ENABLE_PROTECTOR_SERVICE)
507 // ProtectorService binds itself very closely to the PrefService at the moment 483 // ProtectorService binds itself very closely to the PrefService at the moment
508 // of Profile creation and watches pref changes to update their backup. 484 // of Profile creation and watches pref changes to update their backup.
509 // For tests that replace the PrefService after TestingProfile creation, 485 // For tests that replace the PrefService after TestingProfile creation,
510 // ProtectorService is disabled to prevent further invalid memory accesses. 486 // ProtectorService is disabled to prevent further invalid memory accesses.
511 protector::ProtectorServiceFactory::GetInstance()-> 487 protector::ProtectorServiceFactory::GetInstance()->
512 SetTestingFactory(this, NULL); 488 SetTestingFactory(this, NULL);
513 #endif 489 #endif
514 prefs_.reset(prefs); 490 prefs_.reset(prefs);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 } 688 }
713 689
714 PrefService* TestingProfile::GetOffTheRecordPrefs() { 690 PrefService* TestingProfile::GetOffTheRecordPrefs() {
715 return NULL; 691 return NULL;
716 } 692 }
717 693
718 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { 694 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() {
719 return GetExtensionSpecialStoragePolicy(); 695 return GetExtensionSpecialStoragePolicy();
720 } 696 }
721 697
722 void TestingProfile::DestroyWebDataService() {
723 if (!web_data_service_.get())
724 return;
725
726 web_data_service_->Shutdown();
727 }
728
729 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { 698 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
730 return true; 699 return true;
731 } 700 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698