| OLD | NEW |
| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 HistoryService* history_service = | 362 HistoryService* history_service = |
| 363 HistoryServiceFactory::GetForProfileWithoutCreating(this).get(); | 363 HistoryServiceFactory::GetForProfileWithoutCreating(this).get(); |
| 364 if (history_service) { | 364 if (history_service) { |
| 365 history_service->history_backend_->bookmark_service_ = | 365 history_service->history_backend_->bookmark_service_ = |
| 366 bookmark_service; | 366 bookmark_service; |
| 367 history_service->history_backend_->expirer_.bookmark_service_ = | 367 history_service->history_backend_->expirer_.bookmark_service_ = |
| 368 bookmark_service; | 368 bookmark_service; |
| 369 } | 369 } |
| 370 } | 370 } |
| 371 | 371 |
| 372 void TestingProfile::CreateProtocolHandlerRegistry() { | |
| 373 CreateProtocolHandlerRegistry( | |
| 374 new ProtocolHandlerRegistry::Delegate()); | |
| 375 } | |
| 376 | |
| 377 void TestingProfile::CreateProtocolHandlerRegistry( | |
| 378 ProtocolHandlerRegistry::Delegate* delegate) { | |
| 379 protocol_handler_registry_ = new ProtocolHandlerRegistry(this, delegate); | |
| 380 } | |
| 381 | |
| 382 static scoped_refptr<RefcountedProfileKeyedService> BuildWebDataService( | 372 static scoped_refptr<RefcountedProfileKeyedService> BuildWebDataService( |
| 383 Profile* profile) { | 373 Profile* profile) { |
| 384 WebDataService* web_data_service = new WebDataService(); | 374 WebDataService* web_data_service = new WebDataService(); |
| 385 if (web_data_service) | 375 if (web_data_service) |
| 386 web_data_service->Init(profile->GetPath()); | 376 web_data_service->Init(profile->GetPath()); |
| 387 return web_data_service; | 377 return web_data_service; |
| 388 } | 378 } |
| 389 | 379 |
| 390 void TestingProfile::CreateWebDataService() { | 380 void TestingProfile::CreateWebDataService() { |
| 391 WebDataServiceFactory::GetInstance()->SetTestingFactory( | 381 WebDataServiceFactory::GetInstance()->SetTestingFactory( |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |