| 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 void TestingProfile::SetPrefService(PrefService* prefs) { | 488 void TestingProfile::SetPrefService(PrefService* prefs) { |
| 489 DCHECK(!prefs_.get()); | 489 DCHECK(!prefs_.get()); |
| 490 prefs_.reset(prefs); | 490 prefs_.reset(prefs); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void TestingProfile::CreateTestingPrefService() { | 493 void TestingProfile::CreateTestingPrefService() { |
| 494 DCHECK(!prefs_.get()); | 494 DCHECK(!prefs_.get()); |
| 495 testing_prefs_ = new TestingPrefService(); | 495 testing_prefs_ = new TestingPrefService(); |
| 496 prefs_.reset(testing_prefs_); | 496 prefs_.reset(testing_prefs_); |
| 497 Profile::RegisterUserPrefs(prefs_.get()); | 497 Profile::RegisterUserPrefs(prefs_.get()); |
| 498 browser::RegisterAllPrefs(prefs_.get(), prefs_.get()); | 498 local_state_.reset(new TestingPrefService()); |
| 499 browser::RegisterAllPrefs(prefs_.get(), local_state_.get()); |
| 499 } | 500 } |
| 500 | 501 |
| 501 PrefService* TestingProfile::GetPrefs() { | 502 PrefService* TestingProfile::GetPrefs() { |
| 502 if (!prefs_.get()) { | 503 if (!prefs_.get()) { |
| 503 CreateTestingPrefService(); | 504 CreateTestingPrefService(); |
| 504 } | 505 } |
| 505 return prefs_.get(); | 506 return prefs_.get(); |
| 506 } | 507 } |
| 507 | 508 |
| 509 PrefService* TestingProfile::GetLocalState() { |
| 510 if (!local_state_.get()) { |
| 511 CreateTestingPrefService(); |
| 512 } |
| 513 return local_state_.get(); |
| 514 } |
| 515 |
| 516 void TestingProfile::SetLocalState(PrefService* local_state) { |
| 517 DCHECK(!local_state_.get()); |
| 518 local_state_.reset(local_state); |
| 519 } |
| 520 |
| 508 TemplateURLModel* TestingProfile::GetTemplateURLModel() { | 521 TemplateURLModel* TestingProfile::GetTemplateURLModel() { |
| 509 return template_url_model_.get(); | 522 return template_url_model_.get(); |
| 510 } | 523 } |
| 511 | 524 |
| 512 TemplateURLFetcher* TestingProfile::GetTemplateURLFetcher() { | 525 TemplateURLFetcher* TestingProfile::GetTemplateURLFetcher() { |
| 513 return template_url_fetcher_.get(); | 526 return template_url_fetcher_.get(); |
| 514 } | 527 } |
| 515 | 528 |
| 516 history::TopSites* TestingProfile::GetTopSites() { | 529 history::TopSites* TestingProfile::GetTopSites() { |
| 517 return top_sites_.get(); | 530 return top_sites_.get(); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 PrefService* TestingProfile::GetOffTheRecordPrefs() { | 779 PrefService* TestingProfile::GetOffTheRecordPrefs() { |
| 767 return NULL; | 780 return NULL; |
| 768 } | 781 } |
| 769 | 782 |
| 770 void TestingProfile::DestroyWebDataService() { | 783 void TestingProfile::DestroyWebDataService() { |
| 771 if (!web_data_service_.get()) | 784 if (!web_data_service_.get()) |
| 772 return; | 785 return; |
| 773 | 786 |
| 774 web_data_service_->Shutdown(); | 787 web_data_service_->Shutdown(); |
| 775 } | 788 } |
| OLD | NEW |