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

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

Issue 10546083: Convert ProtocolHandlerRegistry to be a ProfileKeyedService. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update content_setting_bubble_model tests to use injected ProtocolHandlerRegistry (integrating Greg… Created 8 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
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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 HistoryService* history_service = 361 HistoryService* history_service =
362 HistoryServiceFactory::GetForProfileWithoutCreating(this).get(); 362 HistoryServiceFactory::GetForProfileWithoutCreating(this).get();
363 if (history_service) { 363 if (history_service) {
364 history_service->history_backend_->bookmark_service_ = 364 history_service->history_backend_->bookmark_service_ =
365 bookmark_service; 365 bookmark_service;
366 history_service->history_backend_->expirer_.bookmark_service_ = 366 history_service->history_backend_->expirer_.bookmark_service_ =
367 bookmark_service; 367 bookmark_service;
368 } 368 }
369 } 369 }
370 370
371 void TestingProfile::CreateProtocolHandlerRegistry() {
372 CreateProtocolHandlerRegistry(
373 new ProtocolHandlerRegistry::Delegate());
374 }
375
376 void TestingProfile::CreateProtocolHandlerRegistry(
377 ProtocolHandlerRegistry::Delegate* delegate) {
378 protocol_handler_registry_ = new ProtocolHandlerRegistry(this, delegate);
379 }
380
381 static scoped_refptr<RefcountedProfileKeyedService> BuildWebDataService( 371 static scoped_refptr<RefcountedProfileKeyedService> BuildWebDataService(
382 Profile* profile) { 372 Profile* profile) {
383 WebDataService* web_data_service = new WebDataService(); 373 WebDataService* web_data_service = new WebDataService();
384 if (web_data_service) 374 if (web_data_service)
385 web_data_service->Init(profile->GetPath()); 375 web_data_service->Init(profile->GetPath());
386 return web_data_service; 376 return web_data_service;
387 } 377 }
388 378
389 void TestingProfile::CreateWebDataService() { 379 void TestingProfile::CreateWebDataService() {
390 WebDataServiceFactory::GetInstance()->SetTestingFactory( 380 WebDataServiceFactory::GetInstance()->SetTestingFactory(
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 671
682 bool TestingProfile::IsSameProfile(Profile *p) { 672 bool TestingProfile::IsSameProfile(Profile *p) {
683 return this == p; 673 return this == p;
684 } 674 }
685 675
686 base::Time TestingProfile::GetStartTime() const { 676 base::Time TestingProfile::GetStartTime() const {
687 return start_time_; 677 return start_time_;
688 } 678 }
689 679
690 ProtocolHandlerRegistry* TestingProfile::GetProtocolHandlerRegistry() { 680 ProtocolHandlerRegistry* TestingProfile::GetProtocolHandlerRegistry() {
691 return protocol_handler_registry_.get(); 681 NOTREACHED() << "ProtocolHandlerRegistry not available via testing profile.";
682 return NULL;
692 } 683 }
693 684
694 FilePath TestingProfile::last_selected_directory() { 685 FilePath TestingProfile::last_selected_directory() {
695 return last_selected_directory_; 686 return last_selected_directory_;
696 } 687 }
697 688
698 void TestingProfile::set_last_selected_directory(const FilePath& path) { 689 void TestingProfile::set_last_selected_directory(const FilePath& path) {
699 last_selected_directory_ = path; 690 last_selected_directory_ = path;
700 } 691 }
701 692
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 } 730 }
740 731
741 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { 732 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
742 return true; 733 return true;
743 } 734 }
744 735
745 base::Callback<ChromeURLDataManagerBackend*(void)> 736 base::Callback<ChromeURLDataManagerBackend*(void)>
746 TestingProfile::GetChromeURLDataManagerBackendGetter() const { 737 TestingProfile::GetChromeURLDataManagerBackendGetter() const {
747 return base::Callback<ChromeURLDataManagerBackend*(void)>(); 738 return base::Callback<ChromeURLDataManagerBackend*(void)>();
748 } 739 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698