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

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

Issue 88423002: Add CloudExternalDataPolicyObserverChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed suggestion. Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('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 <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
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
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 // Sets the PolicyService to be used by this profile.
110 void SetPolicyService(scoped_ptr<policy::PolicyService> policy_service);
111
108 // Creates the TestingProfile using previously-set settings. 112 // Creates the TestingProfile using previously-set settings.
109 scoped_ptr<TestingProfile> Build(); 113 scoped_ptr<TestingProfile> Build();
110 114
111 private: 115 private:
112 // If true, Build() has already been called. 116 // If true, Build() has already been called.
113 bool build_called_; 117 bool build_called_;
114 118
115 // Various staging variables where values are held until Build() is invoked. 119 // Various staging variables where values are held until Build() is invoked.
116 scoped_ptr<PrefServiceSyncable> pref_service_; 120 scoped_ptr<PrefServiceSyncable> pref_service_;
117 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_; 121 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy_;
118 base::FilePath path_; 122 base::FilePath path_;
119 Delegate* delegate_; 123 Delegate* delegate_;
120 bool incognito_; 124 bool incognito_;
121 std::string managed_user_id_; 125 std::string managed_user_id_;
126 scoped_ptr<policy::PolicyService> policy_service_;
122 TestingFactories testing_factories_; 127 TestingFactories testing_factories_;
123 128
124 DISALLOW_COPY_AND_ASSIGN(Builder); 129 DISALLOW_COPY_AND_ASSIGN(Builder);
125 }; 130 };
126 131
127 // Multi-profile aware constructor that takes the path to a directory managed 132 // Multi-profile aware constructor that takes the path to a directory managed
128 // for this profile. This constructor is meant to be used by 133 // for this profile. This constructor is meant to be used by
129 // TestingProfileManager::CreateTestingProfile. If you need to create multi- 134 // TestingProfileManager::CreateTestingProfile. If you need to create multi-
130 // profile profiles, use that factory method instead of this directly. 135 // profile profiles, use that factory method instead of this directly.
131 // Exception: if you need to create multi-profile profiles for testing the 136 // Exception: if you need to create multi-profile profiles for testing the
132 // ProfileManager, then use the constructor below instead. 137 // ProfileManager, then use the constructor below instead.
133 explicit TestingProfile(const base::FilePath& path); 138 explicit TestingProfile(const base::FilePath& path);
134 139
135 // Multi-profile aware constructor that takes the path to a directory managed 140 // 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 141 // for this profile and a delegate. This constructor is meant to be used
137 // for unittesting the ProfileManager. 142 // for unittesting the ProfileManager.
138 TestingProfile(const base::FilePath& path, Delegate* delegate); 143 TestingProfile(const base::FilePath& path, Delegate* delegate);
139 144
140 // Full constructor allowing the setting of all possible instance data. 145 // Full constructor allowing the setting of all possible instance data.
141 // Callers should use Builder::Build() instead of invoking this constructor. 146 // Callers should use Builder::Build() instead of invoking this constructor.
142 TestingProfile(const base::FilePath& path, 147 TestingProfile(const base::FilePath& path,
143 Delegate* delegate, 148 Delegate* delegate,
144 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy, 149 scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
145 scoped_ptr<PrefServiceSyncable> prefs, 150 scoped_ptr<PrefServiceSyncable> prefs,
146 bool incognito, 151 bool incognito,
147 const std::string& managed_user_id, 152 const std::string& managed_user_id,
153 scoped_ptr<policy::PolicyService> policy_service,
148 const TestingFactories& factories); 154 const TestingFactories& factories);
149 155
150 virtual ~TestingProfile(); 156 virtual ~TestingProfile();
151 157
152 // Creates the favicon service. Consequent calls would recreate the service. 158 // Creates the favicon service. Consequent calls would recreate the service.
153 void CreateFaviconService(); 159 void CreateFaviconService();
154 160
155 // Creates the history service. If |delete_file| is true, the history file is 161 // Creates the history service. If |delete_file| is true, the history file is
156 // deleted first, then the HistoryService is created. As TestingProfile 162 // deleted first, then the HistoryService is created. As TestingProfile
157 // deletes the directory containing the files used by HistoryService, this 163 // deletes the directory containing the files used by HistoryService, this
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 401
396 #if defined(ENABLE_CONFIGURATION_POLICY) 402 #if defined(ENABLE_CONFIGURATION_POLICY)
397 scoped_ptr<policy::SchemaRegistryService> schema_registry_service_; 403 scoped_ptr<policy::SchemaRegistryService> schema_registry_service_;
398 #endif 404 #endif
399 scoped_ptr<policy::ProfilePolicyConnector> profile_policy_connector_; 405 scoped_ptr<policy::ProfilePolicyConnector> profile_policy_connector_;
400 406
401 // Weak pointer to a delegate for indicating that a profile was created. 407 // Weak pointer to a delegate for indicating that a profile was created.
402 Delegate* delegate_; 408 Delegate* delegate_;
403 409
404 std::string profile_name_; 410 std::string profile_name_;
411
412 scoped_ptr<policy::PolicyService> policy_service_;
405 }; 413 };
406 414
407 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ 415 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/test/base/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698