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 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/history/history_backend.h" | 31 #include "chrome/browser/history/history_backend.h" |
32 #include "chrome/browser/history/history_service.h" | 32 #include "chrome/browser/history/history_service.h" |
33 #include "chrome/browser/history/history_service_factory.h" | 33 #include "chrome/browser/history/history_service_factory.h" |
34 #include "chrome/browser/history/shortcuts_backend.h" | 34 #include "chrome/browser/history/shortcuts_backend.h" |
35 #include "chrome/browser/history/shortcuts_backend_factory.h" | 35 #include "chrome/browser/history/shortcuts_backend_factory.h" |
36 #include "chrome/browser/history/top_sites.h" | 36 #include "chrome/browser/history/top_sites.h" |
37 #include "chrome/browser/net/proxy_service_factory.h" | 37 #include "chrome/browser/net/proxy_service_factory.h" |
38 #include "chrome/browser/notifications/desktop_notification_service.h" | 38 #include "chrome/browser/notifications/desktop_notification_service.h" |
39 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 39 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
40 #include "chrome/browser/prefs/browser_prefs.h" | 40 #include "chrome/browser/prefs/browser_prefs.h" |
| 41 #include "chrome/browser/prefs/pref_service_syncable.h" |
41 #include "chrome/browser/prerender/prerender_manager.h" | 42 #include "chrome/browser/prerender/prerender_manager.h" |
42 #include "chrome/browser/profiles/profile_dependency_manager.h" | 43 #include "chrome/browser/profiles/profile_dependency_manager.h" |
43 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 44 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
44 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" | 45 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" |
45 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" | 46 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" |
46 #include "chrome/browser/webdata/web_data_service.h" | 47 #include "chrome/browser/webdata/web_data_service.h" |
47 #include "chrome/browser/webdata/web_data_service_factory.h" | 48 #include "chrome/browser/webdata/web_data_service_factory.h" |
48 #include "chrome/common/chrome_constants.h" | 49 #include "chrome/common/chrome_constants.h" |
49 #include "chrome/common/chrome_notification_types.h" | 50 #include "chrome/common/chrome_notification_types.h" |
50 #include "chrome/common/chrome_switches.h" | 51 #include "chrome/common/chrome_switches.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 552 } |
552 | 553 |
553 void TestingProfile::SetPrefService(PrefServiceSyncable* prefs) { | 554 void TestingProfile::SetPrefService(PrefServiceSyncable* prefs) { |
554 prefs_.reset(prefs); | 555 prefs_.reset(prefs); |
555 } | 556 } |
556 | 557 |
557 void TestingProfile::CreateTestingPrefService() { | 558 void TestingProfile::CreateTestingPrefService() { |
558 DCHECK(!prefs_.get()); | 559 DCHECK(!prefs_.get()); |
559 testing_prefs_ = new TestingPrefServiceSyncable(); | 560 testing_prefs_ = new TestingPrefServiceSyncable(); |
560 prefs_.reset(testing_prefs_); | 561 prefs_.reset(testing_prefs_); |
561 Profile::RegisterUserPrefs(prefs_.get()); | 562 Profile::RegisterUserPrefs(testing_prefs_->registry()); |
562 chrome::RegisterUserPrefs(prefs_.get()); | 563 chrome::RegisterUserPrefs(testing_prefs_, testing_prefs_->registry()); |
563 } | 564 } |
564 | 565 |
565 PrefServiceSyncable* TestingProfile::GetPrefs() { | 566 PrefService* TestingProfile::GetPrefs() { |
566 if (!prefs_.get()) { | 567 if (!prefs_.get()) { |
567 CreateTestingPrefService(); | 568 CreateTestingPrefService(); |
568 } | 569 } |
569 return prefs_.get(); | 570 return prefs_.get(); |
570 } | 571 } |
571 | 572 |
572 history::TopSites* TestingProfile::GetTopSites() { | 573 history::TopSites* TestingProfile::GetTopSites() { |
573 return top_sites_.get(); | 574 return top_sites_.get(); |
574 } | 575 } |
575 | 576 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 const base::Closure& completion) { | 738 const base::Closure& completion) { |
738 if (!completion.is_null()) { | 739 if (!completion.is_null()) { |
739 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, completion); | 740 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, completion); |
740 } | 741 } |
741 } | 742 } |
742 | 743 |
743 GURL TestingProfile::GetHomePage() { | 744 GURL TestingProfile::GetHomePage() { |
744 return GURL(chrome::kChromeUINewTabURL); | 745 return GURL(chrome::kChromeUINewTabURL); |
745 } | 746 } |
746 | 747 |
747 PrefServiceSyncable* TestingProfile::GetOffTheRecordPrefs() { | 748 PrefService* TestingProfile::GetOffTheRecordPrefs() { |
748 return NULL; | 749 return NULL; |
749 } | 750 } |
750 | 751 |
751 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { | 752 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { |
752 return GetExtensionSpecialStoragePolicy(); | 753 return GetExtensionSpecialStoragePolicy(); |
753 } | 754 } |
754 | 755 |
755 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { | 756 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { |
756 return true; | 757 return true; |
757 } | 758 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 795 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
795 DCHECK(!build_called_); | 796 DCHECK(!build_called_); |
796 build_called_ = true; | 797 build_called_ = true; |
797 return scoped_ptr<TestingProfile>(new TestingProfile( | 798 return scoped_ptr<TestingProfile>(new TestingProfile( |
798 path_, | 799 path_, |
799 delegate_, | 800 delegate_, |
800 extension_policy_, | 801 extension_policy_, |
801 pref_service_.Pass(), | 802 pref_service_.Pass(), |
802 off_the_record_)); | 803 off_the_record_)); |
803 } | 804 } |
OLD | NEW |