| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/testing_profile.h" | 5 #include "chrome/test/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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 void TestingProfile::SetPrefService(PrefService* prefs) { | 490 void TestingProfile::SetPrefService(PrefService* prefs) { |
| 491 DCHECK(!prefs_.get()); | 491 DCHECK(!prefs_.get()); |
| 492 prefs_.reset(prefs); | 492 prefs_.reset(prefs); |
| 493 } | 493 } |
| 494 | 494 |
| 495 void TestingProfile::CreateTestingPrefService() { | 495 void TestingProfile::CreateTestingPrefService() { |
| 496 DCHECK(!prefs_.get()); | 496 DCHECK(!prefs_.get()); |
| 497 testing_prefs_ = new TestingPrefService(); | 497 testing_prefs_ = new TestingPrefService(); |
| 498 prefs_.reset(testing_prefs_); | 498 prefs_.reset(testing_prefs_); |
| 499 Profile::RegisterUserPrefs(prefs_.get()); | 499 Profile::RegisterUserPrefs(prefs_.get()); |
| 500 browser::RegisterAllPrefs(prefs_.get(), prefs_.get()); | 500 local_state_.reset(new TestingPrefService()); |
| 501 browser::RegisterAllPrefs(prefs_.get(), local_state_.get()); |
| 501 } | 502 } |
| 502 | 503 |
| 503 PrefService* TestingProfile::GetPrefs() { | 504 PrefService* TestingProfile::GetPrefs() { |
| 504 if (!prefs_.get()) { | 505 if (!prefs_.get()) { |
| 505 CreateTestingPrefService(); | 506 CreateTestingPrefService(); |
| 506 } | 507 } |
| 507 return prefs_.get(); | 508 return prefs_.get(); |
| 508 } | 509 } |
| 509 | 510 |
| 511 PrefService* TestingProfile::GetLocalState() { |
| 512 if (!local_state_.get()) { |
| 513 CreateTestingPrefService(); |
| 514 } |
| 515 return local_state_.get(); |
| 516 } |
| 517 |
| 518 void TestingProfile::SetLocalState(PrefService* local_state) { |
| 519 DCHECK(!local_state_.get()); |
| 520 local_state_.reset(local_state); |
| 521 } |
| 522 |
| 510 TemplateURLModel* TestingProfile::GetTemplateURLModel() { | 523 TemplateURLModel* TestingProfile::GetTemplateURLModel() { |
| 511 return template_url_model_.get(); | 524 return template_url_model_.get(); |
| 512 } | 525 } |
| 513 | 526 |
| 514 TemplateURLFetcher* TestingProfile::GetTemplateURLFetcher() { | 527 TemplateURLFetcher* TestingProfile::GetTemplateURLFetcher() { |
| 515 return template_url_fetcher_.get(); | 528 return template_url_fetcher_.get(); |
| 516 } | 529 } |
| 517 | 530 |
| 518 history::TopSites* TestingProfile::GetTopSites() { | 531 history::TopSites* TestingProfile::GetTopSites() { |
| 519 return top_sites_.get(); | 532 return top_sites_.get(); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 PrefService* TestingProfile::GetOffTheRecordPrefs() { | 787 PrefService* TestingProfile::GetOffTheRecordPrefs() { |
| 775 return NULL; | 788 return NULL; |
| 776 } | 789 } |
| 777 | 790 |
| 778 void TestingProfile::DestroyWebDataService() { | 791 void TestingProfile::DestroyWebDataService() { |
| 779 if (!web_data_service_.get()) | 792 if (!web_data_service_.get()) |
| 780 return; | 793 return; |
| 781 | 794 |
| 782 web_data_service_->Shutdown(); | 795 web_data_service_->Shutdown(); |
| 783 } | 796 } |
| OLD | NEW |