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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 WebDataService* TestingProfile::GetWebDataService(ServiceAccessType access) { | 536 WebDataService* TestingProfile::GetWebDataService(ServiceAccessType access) { |
537 return web_data_service_.get(); | 537 return web_data_service_.get(); |
538 } | 538 } |
539 | 539 |
540 WebDataService* TestingProfile::GetWebDataServiceWithoutCreating() { | 540 WebDataService* TestingProfile::GetWebDataServiceWithoutCreating() { |
541 return web_data_service_.get(); | 541 return web_data_service_.get(); |
542 } | 542 } |
543 | 543 |
544 void TestingProfile::SetPrefService(PrefService* prefs) { | 544 void TestingProfile::SetPrefService(PrefService* prefs) { |
| 545 #if defined(ENABLE_PROTECTOR_SERVICE) |
545 // ProtectorService binds itself very closely to the PrefService at the moment | 546 // ProtectorService binds itself very closely to the PrefService at the moment |
546 // of Profile creation and watches pref changes to update their backup. | 547 // of Profile creation and watches pref changes to update their backup. |
547 // For tests that replace the PrefService after TestingProfile creation, | 548 // For tests that replace the PrefService after TestingProfile creation, |
548 // ProtectorService is disabled to prevent further invalid memory accesses. | 549 // ProtectorService is disabled to prevent further invalid memory accesses. |
549 protector::ProtectorServiceFactory::GetInstance()-> | 550 protector::ProtectorServiceFactory::GetInstance()-> |
550 SetTestingFactory(this, NULL); | 551 SetTestingFactory(this, NULL); |
| 552 #endif |
551 prefs_.reset(prefs); | 553 prefs_.reset(prefs); |
552 } | 554 } |
553 | 555 |
554 void TestingProfile::CreateTestingPrefService() { | 556 void TestingProfile::CreateTestingPrefService() { |
555 DCHECK(!prefs_.get()); | 557 DCHECK(!prefs_.get()); |
556 testing_prefs_ = new TestingPrefService(); | 558 testing_prefs_ = new TestingPrefService(); |
557 prefs_.reset(testing_prefs_); | 559 prefs_.reset(testing_prefs_); |
558 Profile::RegisterUserPrefs(prefs_.get()); | 560 Profile::RegisterUserPrefs(prefs_.get()); |
559 browser::RegisterUserPrefs(prefs_.get()); | 561 browser::RegisterUserPrefs(prefs_.get()); |
560 } | 562 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 void TestingProfile::DestroyWebDataService() { | 771 void TestingProfile::DestroyWebDataService() { |
770 if (!web_data_service_.get()) | 772 if (!web_data_service_.get()) |
771 return; | 773 return; |
772 | 774 |
773 web_data_service_->Shutdown(); | 775 web_data_service_->Shutdown(); |
774 } | 776 } |
775 | 777 |
776 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { | 778 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { |
777 return true; | 779 return true; |
778 } | 780 } |
OLD | NEW |