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

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

Issue 2468723003: Move session service and supervised users to buildflags. (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/common/features.gni ('k') | no next file » | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" 42 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h"
43 #include "chrome/browser/profiles/profile_manager.h" 43 #include "chrome/browser/profiles/profile_manager.h"
44 #include "chrome/browser/profiles/storage_partition_descriptor.h" 44 #include "chrome/browser/profiles/storage_partition_descriptor.h"
45 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" 45 #include "chrome/browser/search_engines/template_url_fetcher_factory.h"
46 #include "chrome/browser/search_engines/template_url_service_factory.h" 46 #include "chrome/browser/search_engines/template_url_service_factory.h"
47 #include "chrome/browser/sync/glue/sync_start_util.h" 47 #include "chrome/browser/sync/glue/sync_start_util.h"
48 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" 48 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
49 #include "chrome/browser/web_data_service_factory.h" 49 #include "chrome/browser/web_data_service_factory.h"
50 #include "chrome/common/chrome_constants.h" 50 #include "chrome/common/chrome_constants.h"
51 #include "chrome/common/chrome_switches.h" 51 #include "chrome/common/chrome_switches.h"
52 #include "chrome/common/features.h"
52 #include "chrome/common/pref_names.h" 53 #include "chrome/common/pref_names.h"
53 #include "chrome/common/url_constants.h" 54 #include "chrome/common/url_constants.h"
54 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 55 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
55 #include "components/bookmarks/browser/bookmark_model.h" 56 #include "components/bookmarks/browser/bookmark_model.h"
56 #include "components/bookmarks/common/bookmark_constants.h" 57 #include "components/bookmarks/common/bookmark_constants.h"
57 #include "components/content_settings/core/browser/host_content_settings_map.h" 58 #include "components/content_settings/core/browser/host_content_settings_map.h"
58 #include "components/favicon/core/fallback_icon_service.h" 59 #include "components/favicon/core/fallback_icon_service.h"
59 #include "components/favicon/core/favicon_service.h" 60 #include "components/favicon/core/favicon_service.h"
60 #include "components/history/content/browser/content_visit_delegate.h" 61 #include "components/history/content/browser/content_visit_delegate.h"
61 #include "components/history/content/browser/history_database_helper.h" 62 #include "components/history/content/browser/history_database_helper.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 #include "extensions/browser/extension_prefs.h" 111 #include "extensions/browser/extension_prefs.h"
111 #include "extensions/browser/extension_prefs_factory.h" 112 #include "extensions/browser/extension_prefs_factory.h"
112 #include "extensions/browser/extension_prefs_observer.h" 113 #include "extensions/browser/extension_prefs_observer.h"
113 #include "extensions/browser/extension_system.h" 114 #include "extensions/browser/extension_system.h"
114 #endif 115 #endif
115 116
116 #if defined(OS_ANDROID) 117 #if defined(OS_ANDROID)
117 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" 118 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h"
118 #endif 119 #endif
119 120
120 #if defined(ENABLE_SUPERVISED_USERS) 121 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
121 #include "chrome/browser/supervised_user/supervised_user_constants.h" 122 #include "chrome/browser/supervised_user/supervised_user_constants.h"
122 #include "chrome/browser/supervised_user/supervised_user_pref_store.h" 123 #include "chrome/browser/supervised_user/supervised_user_pref_store.h"
123 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" 124 #include "chrome/browser/supervised_user/supervised_user_settings_service.h"
124 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h" 125 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor y.h"
125 #endif 126 #endif
126 127
127 #if BUILDFLAG(ANDROID_JAVA_UI) 128 #if BUILDFLAG(ANDROID_JAVA_UI)
128 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 129 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
129 #include "components/offline_pages/stub_offline_page_model.h" 130 #include "components/offline_pages/stub_offline_page_model.h"
130 #endif 131 #endif
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 #if defined(OS_ANDROID) 429 #if defined(OS_ANDROID)
429 // Make sure token service knows its running in tests. 430 // Make sure token service knows its running in tests.
430 OAuth2TokenServiceDelegateAndroid::set_is_testing_profile(); 431 OAuth2TokenServiceDelegateAndroid::set_is_testing_profile();
431 #endif 432 #endif
432 433
433 // Normally this would happen during browser startup, but for tests 434 // Normally this would happen during browser startup, but for tests
434 // we need to trigger creation of Profile-related services. 435 // we need to trigger creation of Profile-related services.
435 ChromeBrowserMainExtraPartsProfiles:: 436 ChromeBrowserMainExtraPartsProfiles::
436 EnsureBrowserContextKeyedServiceFactoriesBuilt(); 437 EnsureBrowserContextKeyedServiceFactoriesBuilt();
437 438
438 #if defined(ENABLE_SUPERVISED_USERS) 439 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
439 if (!IsOffTheRecord()) { 440 if (!IsOffTheRecord()) {
440 SupervisedUserSettingsService* settings_service = 441 SupervisedUserSettingsService* settings_service =
441 SupervisedUserSettingsServiceFactory::GetForProfile(this); 442 SupervisedUserSettingsServiceFactory::GetForProfile(this);
442 TestingPrefStore* store = new TestingPrefStore(); 443 TestingPrefStore* store = new TestingPrefStore();
443 settings_service->Init(store); 444 settings_service->Init(store);
444 settings_service->MergeDataAndStartSyncing( 445 settings_service->MergeDataAndStartSyncing(
445 syncer::SUPERVISED_USER_SETTINGS, syncer::SyncDataList(), 446 syncer::SUPERVISED_USER_SETTINGS, syncer::SyncDataList(),
446 std::unique_ptr<syncer::SyncChangeProcessor>( 447 std::unique_ptr<syncer::SyncChangeProcessor>(
447 new syncer::FakeSyncChangeProcessor), 448 new syncer::FakeSyncChangeProcessor),
448 std::unique_ptr<syncer::SyncErrorFactory>( 449 std::unique_ptr<syncer::SyncErrorFactory>(
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 GetPrefs()->SetString(prefs::kSupervisedUserId, id); 734 GetPrefs()->SetString(prefs::kSupervisedUserId, id);
734 else 735 else
735 GetPrefs()->ClearPref(prefs::kSupervisedUserId); 736 GetPrefs()->ClearPref(prefs::kSupervisedUserId);
736 } 737 }
737 738
738 bool TestingProfile::IsSupervised() const { 739 bool TestingProfile::IsSupervised() const {
739 return !supervised_user_id_.empty(); 740 return !supervised_user_id_.empty();
740 } 741 }
741 742
742 bool TestingProfile::IsChild() const { 743 bool TestingProfile::IsChild() const {
743 #if defined(ENABLE_SUPERVISED_USERS) 744 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
744 return supervised_user_id_ == supervised_users::kChildAccountSUID; 745 return supervised_user_id_ == supervised_users::kChildAccountSUID;
745 #else 746 #else
746 return false; 747 return false;
747 #endif 748 #endif
748 } 749 }
749 750
750 bool TestingProfile::IsLegacySupervised() const { 751 bool TestingProfile::IsLegacySupervised() const {
751 return IsSupervised() && !IsChild(); 752 return IsSupervised() && !IsChild();
752 } 753 }
753 754
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 // Note: Owned by |original_profile|. 1090 // Note: Owned by |original_profile|.
1090 return new TestingProfile(path_, delegate_, 1091 return new TestingProfile(path_, delegate_,
1091 #if defined(ENABLE_EXTENSIONS) 1092 #if defined(ENABLE_EXTENSIONS)
1092 extension_policy_, 1093 extension_policy_,
1093 #endif 1094 #endif
1094 std::move(pref_service_), original_profile, 1095 std::move(pref_service_), original_profile,
1095 guest_session_, supervised_user_id_, 1096 guest_session_, supervised_user_id_,
1096 std::move(policy_service_), testing_factories_, 1097 std::move(policy_service_), testing_factories_,
1097 profile_name_); 1098 profile_name_);
1098 } 1099 }
OLDNEW
« no previous file with comments | « chrome/common/features.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698