Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Side by Side Diff: chrome/test/base/testing_profile.cc

Issue 2459823002: [Sync] Rename syncable_prefs to sync_preferences. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | chrome/test/base/testing_profile_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 7 #include <utility>
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "components/omnibox/browser/history_index_restore_observer.h" 70 #include "components/omnibox/browser/history_index_restore_observer.h"
71 #include "components/omnibox/browser/in_memory_url_index.h" 71 #include "components/omnibox/browser/in_memory_url_index.h"
72 #include "components/policy/core/common/configuration_policy_provider.h" 72 #include "components/policy/core/common/configuration_policy_provider.h"
73 #include "components/policy/core/common/policy_service.h" 73 #include "components/policy/core/common/policy_service.h"
74 #include "components/policy/core/common/policy_service_impl.h" 74 #include "components/policy/core/common/policy_service_impl.h"
75 #include "components/policy/core/common/schema.h" 75 #include "components/policy/core/common/schema.h"
76 #include "components/prefs/testing_pref_store.h" 76 #include "components/prefs/testing_pref_store.h"
77 #include "components/proxy_config/pref_proxy_config_tracker.h" 77 #include "components/proxy_config/pref_proxy_config_tracker.h"
78 #include "components/sync/model/fake_sync_change_processor.h" 78 #include "components/sync/model/fake_sync_change_processor.h"
79 #include "components/sync/model/sync_error_factory_mock.h" 79 #include "components/sync/model/sync_error_factory_mock.h"
80 #include "components/syncable_prefs/pref_service_mock_factory.h" 80 #include "components/sync_preferences/pref_service_mock_factory.h"
81 #include "components/syncable_prefs/pref_service_syncable.h" 81 #include "components/sync_preferences/pref_service_syncable.h"
82 #include "components/syncable_prefs/testing_pref_service_syncable.h" 82 #include "components/sync_preferences/testing_pref_service_syncable.h"
83 #include "components/user_prefs/user_prefs.h" 83 #include "components/user_prefs/user_prefs.h"
84 #include "components/webdata_services/web_data_service_wrapper.h" 84 #include "components/webdata_services/web_data_service_wrapper.h"
85 #include "components/zoom/zoom_event_manager.h" 85 #include "components/zoom/zoom_event_manager.h"
86 #include "content/public/browser/browser_thread.h" 86 #include "content/public/browser/browser_thread.h"
87 #include "content/public/browser/cookie_store_factory.h" 87 #include "content/public/browser/cookie_store_factory.h"
88 #include "content/public/browser/notification_service.h" 88 #include "content/public/browser/notification_service.h"
89 #include "content/public/browser/render_process_host.h" 89 #include "content/public/browser/render_process_host.h"
90 #include "content/public/browser/storage_partition.h" 90 #include "content/public/browser/storage_partition.h"
91 #include "content/public/browser/zoom_level_delegate.h" 91 #include "content/public/browser/zoom_level_delegate.h"
92 #include "content/public/test/mock_resource_context.h" 92 #include "content/public/test/mock_resource_context.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 FinishInit(); 325 FinishInit();
326 } 326 }
327 } 327 }
328 328
329 TestingProfile::TestingProfile( 329 TestingProfile::TestingProfile(
330 const base::FilePath& path, 330 const base::FilePath& path,
331 Delegate* delegate, 331 Delegate* delegate,
332 #if defined(ENABLE_EXTENSIONS) 332 #if defined(ENABLE_EXTENSIONS)
333 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy, 333 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
334 #endif 334 #endif
335 std::unique_ptr<syncable_prefs::PrefServiceSyncable> prefs, 335 std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs,
336 TestingProfile* parent, 336 TestingProfile* parent,
337 bool guest_session, 337 bool guest_session,
338 const std::string& supervised_user_id, 338 const std::string& supervised_user_id,
339 std::unique_ptr<policy::PolicyService> policy_service, 339 std::unique_ptr<policy::PolicyService> policy_service,
340 const TestingFactories& factories, 340 const TestingFactories& factories,
341 const std::string& profile_name) 341 const std::string& profile_name)
342 : start_time_(Time::Now()), 342 : start_time_(Time::Now()),
343 prefs_(prefs.release()), 343 prefs_(prefs.release()),
344 testing_prefs_(NULL), 344 testing_prefs_(NULL),
345 force_incognito_(false), 345 force_incognito_(false),
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 TestingProfile::CreateZoomLevelDelegate(const base::FilePath& partition_path) { 668 TestingProfile::CreateZoomLevelDelegate(const base::FilePath& partition_path) {
669 return base::MakeUnique<ChromeZoomLevelPrefs>( 669 return base::MakeUnique<ChromeZoomLevelPrefs>(
670 GetPrefs(), GetPath(), partition_path, 670 GetPrefs(), GetPath(), partition_path,
671 zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr()); 671 zoom::ZoomEventManager::GetForBrowserContext(this)->GetWeakPtr());
672 } 672 }
673 673
674 scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() { 674 scoped_refptr<base::SequencedTaskRunner> TestingProfile::GetIOTaskRunner() {
675 return base::ThreadTaskRunnerHandle::Get(); 675 return base::ThreadTaskRunnerHandle::Get();
676 } 676 }
677 677
678 syncable_prefs::TestingPrefServiceSyncable* 678 sync_preferences::TestingPrefServiceSyncable*
679 TestingProfile::GetTestingPrefService() { 679 TestingProfile::GetTestingPrefService() {
680 DCHECK(prefs_); 680 DCHECK(prefs_);
681 DCHECK(testing_prefs_); 681 DCHECK(testing_prefs_);
682 return testing_prefs_; 682 return testing_prefs_;
683 } 683 }
684 684
685 TestingProfile* TestingProfile::AsTestingProfile() { 685 TestingProfile* TestingProfile::AsTestingProfile() {
686 return this; 686 return this;
687 } 687 }
688 688
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 770 }
771 771
772 net::CookieStore* TestingProfile::GetCookieStore() { 772 net::CookieStore* TestingProfile::GetCookieStore() {
773 if (!GetRequestContext()) 773 if (!GetRequestContext())
774 return NULL; 774 return NULL;
775 return GetRequestContext()->GetURLRequestContext()->cookie_store(); 775 return GetRequestContext()->GetURLRequestContext()->cookie_store();
776 } 776 }
777 777
778 void TestingProfile::CreateTestingPrefService() { 778 void TestingProfile::CreateTestingPrefService() {
779 DCHECK(!prefs_.get()); 779 DCHECK(!prefs_.get());
780 testing_prefs_ = new syncable_prefs::TestingPrefServiceSyncable(); 780 testing_prefs_ = new sync_preferences::TestingPrefServiceSyncable();
781 prefs_.reset(testing_prefs_); 781 prefs_.reset(testing_prefs_);
782 user_prefs::UserPrefs::Set(this, prefs_.get()); 782 user_prefs::UserPrefs::Set(this, prefs_.get());
783 chrome::RegisterUserProfilePrefs(testing_prefs_->registry()); 783 chrome::RegisterUserProfilePrefs(testing_prefs_->registry());
784 } 784 }
785 785
786 void TestingProfile::CreatePrefServiceForSupervisedUser() { 786 void TestingProfile::CreatePrefServiceForSupervisedUser() {
787 DCHECK(!prefs_.get()); 787 DCHECK(!prefs_.get());
788 DCHECK(!supervised_user_id_.empty()); 788 DCHECK(!supervised_user_id_.empty());
789 syncable_prefs::PrefServiceMockFactory factory; 789 sync_preferences::PrefServiceMockFactory factory;
790 SupervisedUserSettingsService* supervised_user_settings = 790 SupervisedUserSettingsService* supervised_user_settings =
791 SupervisedUserSettingsServiceFactory::GetForProfile(this); 791 SupervisedUserSettingsServiceFactory::GetForProfile(this);
792 scoped_refptr<PrefStore> supervised_user_prefs = 792 scoped_refptr<PrefStore> supervised_user_prefs =
793 make_scoped_refptr(new SupervisedUserPrefStore(supervised_user_settings)); 793 make_scoped_refptr(new SupervisedUserPrefStore(supervised_user_settings));
794 794
795 factory.set_supervised_user_prefs(supervised_user_prefs); 795 factory.set_supervised_user_prefs(supervised_user_prefs);
796 796
797 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( 797 scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
798 new user_prefs::PrefRegistrySyncable); 798 new user_prefs::PrefRegistrySyncable);
799 799
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 } 1032 }
1033 1033
1034 #if defined(ENABLE_EXTENSIONS) 1034 #if defined(ENABLE_EXTENSIONS)
1035 void TestingProfile::Builder::SetExtensionSpecialStoragePolicy( 1035 void TestingProfile::Builder::SetExtensionSpecialStoragePolicy(
1036 scoped_refptr<ExtensionSpecialStoragePolicy> policy) { 1036 scoped_refptr<ExtensionSpecialStoragePolicy> policy) {
1037 extension_policy_ = policy; 1037 extension_policy_ = policy;
1038 } 1038 }
1039 #endif 1039 #endif
1040 1040
1041 void TestingProfile::Builder::SetPrefService( 1041 void TestingProfile::Builder::SetPrefService(
1042 std::unique_ptr<syncable_prefs::PrefServiceSyncable> prefs) { 1042 std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs) {
1043 pref_service_ = std::move(prefs); 1043 pref_service_ = std::move(prefs);
1044 } 1044 }
1045 1045
1046 void TestingProfile::Builder::SetGuestSession() { 1046 void TestingProfile::Builder::SetGuestSession() {
1047 guest_session_ = true; 1047 guest_session_ = true;
1048 } 1048 }
1049 1049
1050 void TestingProfile::Builder::SetSupervisedUserId( 1050 void TestingProfile::Builder::SetSupervisedUserId(
1051 const std::string& supervised_user_id) { 1051 const std::string& supervised_user_id) {
1052 supervised_user_id_ = supervised_user_id; 1052 supervised_user_id_ = supervised_user_id;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 // Note: Owned by |original_profile|. 1089 // Note: Owned by |original_profile|.
1090 return new TestingProfile(path_, delegate_, 1090 return new TestingProfile(path_, delegate_,
1091 #if defined(ENABLE_EXTENSIONS) 1091 #if defined(ENABLE_EXTENSIONS)
1092 extension_policy_, 1092 extension_policy_,
1093 #endif 1093 #endif
1094 std::move(pref_service_), original_profile, 1094 std::move(pref_service_), original_profile,
1095 guest_session_, supervised_user_id_, 1095 guest_session_, supervised_user_id_,
1096 std::move(policy_service_), testing_factories_, 1096 std::move(policy_service_), testing_factories_,
1097 profile_name_); 1097 profile_name_);
1098 } 1098 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | chrome/test/base/testing_profile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698