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

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

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge 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_browser_process.cc ('k') | chrome/test/base/testing_profile.cc » ('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 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_ 5 #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_
6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_ 6 #define CHROME_TEST_BASE_TESTING_PROFILE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "components/domain_reliability/clear_mode.h" 18 #include "components/domain_reliability/clear_mode.h"
19 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 19 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
20 #include "extensions/features/features.h"
20 21
21 class BrowserContextDependencyManager; 22 class BrowserContextDependencyManager;
22 class ExtensionSpecialStoragePolicy; 23 class ExtensionSpecialStoragePolicy;
23 class HostContentSettingsMap; 24 class HostContentSettingsMap;
24 25
25 namespace content { 26 namespace content {
26 class MockResourceContext; 27 class MockResourceContext;
27 class SSLHostStateDelegate; 28 class SSLHostStateDelegate;
28 class ZoomLevelDelegate; 29 class ZoomLevelDelegate;
29 } 30 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // and must manage its lifetime so it continues to exist until profile 82 // and must manage its lifetime so it continues to exist until profile
82 // initialization is complete. 83 // initialization is complete.
83 void SetDelegate(Delegate* delegate); 84 void SetDelegate(Delegate* delegate);
84 85
85 // Adds a testing factory to the TestingProfile. These testing factories 86 // Adds a testing factory to the TestingProfile. These testing factories
86 // are applied before the ProfileKeyedServices are created. 87 // are applied before the ProfileKeyedServices are created.
87 void AddTestingFactory( 88 void AddTestingFactory(
88 BrowserContextKeyedServiceFactory* service_factory, 89 BrowserContextKeyedServiceFactory* service_factory,
89 BrowserContextKeyedServiceFactory::TestingFactoryFunction callback); 90 BrowserContextKeyedServiceFactory::TestingFactoryFunction callback);
90 91
91 #if defined(ENABLE_EXTENSIONS) 92 #if BUILDFLAG(ENABLE_EXTENSIONS)
92 // Sets the ExtensionSpecialStoragePolicy to be returned by 93 // Sets the ExtensionSpecialStoragePolicy to be returned by
93 // GetExtensionSpecialStoragePolicy(). 94 // GetExtensionSpecialStoragePolicy().
94 void SetExtensionSpecialStoragePolicy( 95 void SetExtensionSpecialStoragePolicy(
95 scoped_refptr<ExtensionSpecialStoragePolicy> policy); 96 scoped_refptr<ExtensionSpecialStoragePolicy> policy);
96 #endif 97 #endif
97 98
98 // Sets the path to the directory to be used to hold profile data. 99 // Sets the path to the directory to be used to hold profile data.
99 void SetPath(const base::FilePath& path); 100 void SetPath(const base::FilePath& path);
100 101
101 // Sets the PrefService to be used by this profile. 102 // Sets the PrefService to be used by this profile.
(...skipping 21 matching lines...) Expand all
123 // need to customize the Builder, or access TestingProfile member functions, 124 // need to customize the Builder, or access TestingProfile member functions,
124 // you can use original_profile->GetOffTheRecordProfile(). 125 // you can use original_profile->GetOffTheRecordProfile().
125 TestingProfile* BuildIncognito(TestingProfile* original_profile); 126 TestingProfile* BuildIncognito(TestingProfile* original_profile);
126 127
127 private: 128 private:
128 // If true, Build() has already been called. 129 // If true, Build() has already been called.
129 bool build_called_; 130 bool build_called_;
130 131
131 // Various staging variables where values are held until Build() is invoked. 132 // Various staging variables where values are held until Build() is invoked.
132 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service_; 133 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service_;
133 #if defined(ENABLE_EXTENSIONS) 134 #if BUILDFLAG(ENABLE_EXTENSIONS)
134 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_; 135 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_;
135 #endif 136 #endif
136 base::FilePath path_; 137 base::FilePath path_;
137 Delegate* delegate_; 138 Delegate* delegate_;
138 bool guest_session_; 139 bool guest_session_;
139 std::string supervised_user_id_; 140 std::string supervised_user_id_;
140 std::unique_ptr<policy::PolicyService> policy_service_; 141 std::unique_ptr<policy::PolicyService> policy_service_;
141 TestingFactories testing_factories_; 142 TestingFactories testing_factories_;
142 std::string profile_name_; 143 std::string profile_name_;
143 144
(...skipping 10 matching lines...) Expand all
154 155
155 // Multi-profile aware constructor that takes the path to a directory managed 156 // Multi-profile aware constructor that takes the path to a directory managed
156 // for this profile and a delegate. This constructor is meant to be used 157 // for this profile and a delegate. This constructor is meant to be used
157 // for unittesting the ProfileManager. 158 // for unittesting the ProfileManager.
158 TestingProfile(const base::FilePath& path, Delegate* delegate); 159 TestingProfile(const base::FilePath& path, Delegate* delegate);
159 160
160 // Full constructor allowing the setting of all possible instance data. 161 // Full constructor allowing the setting of all possible instance data.
161 // Callers should use Builder::Build() instead of invoking this constructor. 162 // Callers should use Builder::Build() instead of invoking this constructor.
162 TestingProfile(const base::FilePath& path, 163 TestingProfile(const base::FilePath& path,
163 Delegate* delegate, 164 Delegate* delegate,
164 #if defined(ENABLE_EXTENSIONS) 165 #if BUILDFLAG(ENABLE_EXTENSIONS)
165 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy, 166 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
166 #endif 167 #endif
167 std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs, 168 std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs,
168 TestingProfile* parent, 169 TestingProfile* parent,
169 bool guest_session, 170 bool guest_session,
170 const std::string& supervised_user_id, 171 const std::string& supervised_user_id,
171 std::unique_ptr<policy::PolicyService> policy_service, 172 std::unique_ptr<policy::PolicyService> policy_service,
172 const TestingFactories& factories, 173 const TestingFactories& factories,
173 const std::string& profile_name); 174 const std::string& profile_name);
174 175
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 force_incognito_ = force_incognito; 268 force_incognito_ = force_incognito;
268 } 269 }
269 270
270 Profile* GetOffTheRecordProfile() override; 271 Profile* GetOffTheRecordProfile() override;
271 void DestroyOffTheRecordProfile() override {} 272 void DestroyOffTheRecordProfile() override {}
272 bool HasOffTheRecordProfile() override; 273 bool HasOffTheRecordProfile() override;
273 Profile* GetOriginalProfile() override; 274 Profile* GetOriginalProfile() override;
274 bool IsSupervised() const override; 275 bool IsSupervised() const override;
275 bool IsChild() const override; 276 bool IsChild() const override;
276 bool IsLegacySupervised() const override; 277 bool IsLegacySupervised() const override;
277 #if defined(ENABLE_EXTENSIONS) 278 #if BUILDFLAG(ENABLE_EXTENSIONS)
278 void SetExtensionSpecialStoragePolicy( 279 void SetExtensionSpecialStoragePolicy(
279 ExtensionSpecialStoragePolicy* extension_special_storage_policy); 280 ExtensionSpecialStoragePolicy* extension_special_storage_policy);
280 #endif 281 #endif
281 ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override; 282 ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
282 // TODO(ajwong): Remove this API in favor of directly retrieving the 283 // TODO(ajwong): Remove this API in favor of directly retrieving the
283 // CookieStore from the StoragePartition after ExtensionURLRequestContext 284 // CookieStore from the StoragePartition after ExtensionURLRequestContext
284 // has been removed. 285 // has been removed.
285 net::CookieStore* GetCookieStore(); 286 net::CookieStore* GetCookieStore();
286 287
287 PrefService* GetPrefs() override; 288 PrefService* GetPrefs() override;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 379
379 std::string supervised_user_id_; 380 std::string supervised_user_id_;
380 381
381 // Did the last session exit cleanly? Default is true. 382 // Did the last session exit cleanly? Default is true.
382 bool last_session_exited_cleanly_; 383 bool last_session_exited_cleanly_;
383 384
384 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; 385 scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
385 386
386 base::FilePath last_selected_directory_; 387 base::FilePath last_selected_directory_;
387 388
388 #if defined(ENABLE_EXTENSIONS) 389 #if BUILDFLAG(ENABLE_EXTENSIONS)
389 scoped_refptr<ExtensionSpecialStoragePolicy> 390 scoped_refptr<ExtensionSpecialStoragePolicy>
390 extension_special_storage_policy_; 391 extension_special_storage_policy_;
391 #endif 392 #endif
392 393
393 // The proxy prefs tracker. 394 // The proxy prefs tracker.
394 std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; 395 std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
395 396
396 // The path to this profile. This will be valid in either of the two above 397 // The path to this profile. This will be valid in either of the two above
397 // cases. 398 // cases.
398 base::FilePath profile_path_; 399 base::FilePath profile_path_;
(...skipping 14 matching lines...) Expand all
413 414
414 // Weak pointer to a delegate for indicating that a profile was created. 415 // Weak pointer to a delegate for indicating that a profile was created.
415 Delegate* delegate_; 416 Delegate* delegate_;
416 417
417 std::string profile_name_; 418 std::string profile_name_;
418 419
419 std::unique_ptr<policy::PolicyService> policy_service_; 420 std::unique_ptr<policy::PolicyService> policy_service_;
420 }; 421 };
421 422
422 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ 423 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_
OLDNEW
« no previous file with comments | « chrome/test/base/testing_browser_process.cc ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698