Chromium Code Reviews| 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 #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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 namespace history { | 24 namespace history { |
| 25 class TopSites; | 25 class TopSites; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace net { | 28 namespace net { |
| 29 class CookieMonster; | 29 class CookieMonster; |
| 30 class URLRequestContextGetter; | 30 class URLRequestContextGetter; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace policy { | 33 namespace policy { |
| 34 class PolicyService; | |
| 34 class ProfilePolicyConnector; | 35 class ProfilePolicyConnector; |
| 35 class SchemaRegistryService; | 36 class SchemaRegistryService; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace quota { | 39 namespace quota { |
| 39 class SpecialStoragePolicy; | 40 class SpecialStoragePolicy; |
| 40 } | 41 } |
| 41 | 42 |
| 42 class BrowserContextDependencyManager; | 43 class BrowserContextDependencyManager; |
| 43 class CommandLine; | 44 class CommandLine; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 // Sets the PrefService to be used by this profile. | 99 // Sets the PrefService to be used by this profile. |
| 99 void SetPrefService(scoped_ptr<PrefServiceSyncable> prefs); | 100 void SetPrefService(scoped_ptr<PrefServiceSyncable> prefs); |
| 100 | 101 |
| 101 // Makes the Profile being built an incognito profile. | 102 // Makes the Profile being built an incognito profile. |
| 102 void SetIncognito(); | 103 void SetIncognito(); |
| 103 | 104 |
| 104 // Sets the managed user ID (which is empty by default). If it is set to a | 105 // Sets the managed user ID (which is empty by default). If it is set to a |
| 105 // non-empty string, the profile is managed. | 106 // non-empty string, the profile is managed. |
| 106 void SetManagedUserId(const std::string& managed_user_id); | 107 void SetManagedUserId(const std::string& managed_user_id); |
| 107 | 108 |
| 109 void SetPolicyService(scoped_ptr<policy::PolicyService> policy_service); | |
|
Paweł Hajdan Jr.
2013/11/26 22:55:52
nit: Please add a trivial comment to keep the styl
bartfab (slow)
2013/11/27 14:31:25
Done.
| |
| 110 | |
| 108 // Creates the TestingProfile using previously-set settings. | 111 // Creates the TestingProfile using previously-set settings. |
| 109 scoped_ptr<TestingProfile> Build(); | 112 scoped_ptr<TestingProfile> Build(); |
| 110 | 113 |
| 111 private: | 114 private: |
| 112 // If true, Build() has already been called. | 115 // If true, Build() has already been called. |
| 113 bool build_called_; | 116 bool build_called_; |
| 114 | 117 |
| 115 // Various staging variables where values are held until Build() is invoked. | 118 // Various staging variables where values are held until Build() is invoked. |
| 116 scoped_ptr<PrefServiceSyncable> pref_service_; | 119 scoped_ptr<PrefServiceSyncable> pref_service_; |
| 117 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_; | 120 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_; |
| 118 base::FilePath path_; | 121 base::FilePath path_; |
| 119 Delegate* delegate_; | 122 Delegate* delegate_; |
| 120 bool incognito_; | 123 bool incognito_; |
| 121 std::string managed_user_id_; | 124 std::string managed_user_id_; |
| 125 scoped_ptr<policy::PolicyService> policy_service_; | |
| 122 TestingFactories testing_factories_; | 126 TestingFactories testing_factories_; |
| 123 | 127 |
| 124 DISALLOW_COPY_AND_ASSIGN(Builder); | 128 DISALLOW_COPY_AND_ASSIGN(Builder); |
| 125 }; | 129 }; |
| 126 | 130 |
| 127 // Multi-profile aware constructor that takes the path to a directory managed | 131 // Multi-profile aware constructor that takes the path to a directory managed |
| 128 // for this profile. This constructor is meant to be used by | 132 // for this profile. This constructor is meant to be used by |
| 129 // TestingProfileManager::CreateTestingProfile. If you need to create multi- | 133 // TestingProfileManager::CreateTestingProfile. If you need to create multi- |
| 130 // profile profiles, use that factory method instead of this directly. | 134 // profile profiles, use that factory method instead of this directly. |
| 131 // Exception: if you need to create multi-profile profiles for testing the | 135 // Exception: if you need to create multi-profile profiles for testing the |
| 132 // ProfileManager, then use the constructor below instead. | 136 // ProfileManager, then use the constructor below instead. |
| 133 explicit TestingProfile(const base::FilePath& path); | 137 explicit TestingProfile(const base::FilePath& path); |
| 134 | 138 |
| 135 // Multi-profile aware constructor that takes the path to a directory managed | 139 // Multi-profile aware constructor that takes the path to a directory managed |
| 136 // for this profile and a delegate. This constructor is meant to be used | 140 // for this profile and a delegate. This constructor is meant to be used |
| 137 // for unittesting the ProfileManager. | 141 // for unittesting the ProfileManager. |
| 138 TestingProfile(const base::FilePath& path, Delegate* delegate); | 142 TestingProfile(const base::FilePath& path, Delegate* delegate); |
| 139 | 143 |
| 140 // Full constructor allowing the setting of all possible instance data. | 144 // Full constructor allowing the setting of all possible instance data. |
| 141 // Callers should use Builder::Build() instead of invoking this constructor. | 145 // Callers should use Builder::Build() instead of invoking this constructor. |
| 142 TestingProfile(const base::FilePath& path, | 146 TestingProfile(const base::FilePath& path, |
| 143 Delegate* delegate, | 147 Delegate* delegate, |
| 144 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy, | 148 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy, |
| 145 scoped_ptr<PrefServiceSyncable> prefs, | 149 scoped_ptr<PrefServiceSyncable> prefs, |
| 146 bool incognito, | 150 bool incognito, |
| 147 const std::string& managed_user_id, | 151 const std::string& managed_user_id, |
| 152 scoped_ptr<policy::PolicyService> policy_service, | |
| 148 const TestingFactories& factories); | 153 const TestingFactories& factories); |
| 149 | 154 |
| 150 virtual ~TestingProfile(); | 155 virtual ~TestingProfile(); |
| 151 | 156 |
| 152 // Creates the favicon service. Consequent calls would recreate the service. | 157 // Creates the favicon service. Consequent calls would recreate the service. |
| 153 void CreateFaviconService(); | 158 void CreateFaviconService(); |
| 154 | 159 |
| 155 // Creates the history service. If |delete_file| is true, the history file is | 160 // Creates the history service. If |delete_file| is true, the history file is |
| 156 // deleted first, then the HistoryService is created. As TestingProfile | 161 // deleted first, then the HistoryService is created. As TestingProfile |
| 157 // deletes the directory containing the files used by HistoryService, this | 162 // deletes the directory containing the files used by HistoryService, this |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 | 400 |
| 396 #if defined(ENABLE_CONFIGURATION_POLICY) | 401 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 397 scoped_ptr<policy::SchemaRegistryService> schema_registry_service_; | 402 scoped_ptr<policy::SchemaRegistryService> schema_registry_service_; |
| 398 #endif | 403 #endif |
| 399 scoped_ptr<policy::ProfilePolicyConnector> profile_policy_connector_; | 404 scoped_ptr<policy::ProfilePolicyConnector> profile_policy_connector_; |
| 400 | 405 |
| 401 // Weak pointer to a delegate for indicating that a profile was created. | 406 // Weak pointer to a delegate for indicating that a profile was created. |
| 402 Delegate* delegate_; | 407 Delegate* delegate_; |
| 403 | 408 |
| 404 std::string profile_name_; | 409 std::string profile_name_; |
| 410 | |
| 411 scoped_ptr<policy::PolicyService> policy_service_; | |
| 405 }; | 412 }; |
| 406 | 413 |
| 407 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 414 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
| OLD | NEW |