OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // Creates an ExtensionService initialized with the testing profile and | 132 // Creates an ExtensionService initialized with the testing profile and |
133 // returns it. The profile keeps its own copy of a scoped_refptr to the | 133 // returns it. The profile keeps its own copy of a scoped_refptr to the |
134 // ExtensionService to make sure that is still alive to be notified when the | 134 // ExtensionService to make sure that is still alive to be notified when the |
135 // profile is destroyed. | 135 // profile is destroyed. |
136 ExtensionService* CreateExtensionService(const CommandLine* command_line, | 136 ExtensionService* CreateExtensionService(const CommandLine* command_line, |
137 const FilePath& install_directory, | 137 const FilePath& install_directory, |
138 bool autoupdate_enabled); | 138 bool autoupdate_enabled); |
139 | 139 |
140 TestingPrefService* GetTestingPrefService(); | 140 TestingPrefService* GetTestingPrefService(); |
141 | 141 |
142 virtual TestingProfile* AsTestingProfile(); | 142 virtual TestingProfile* AsTestingProfile() OVERRIDE; |
143 virtual std::string GetProfileName(); | 143 virtual std::string GetProfileName() OVERRIDE; |
144 virtual FilePath GetPath(); | 144 virtual FilePath GetPath() OVERRIDE; |
145 void set_incognito(bool incognito) { incognito_ = incognito; } | 145 void set_incognito(bool incognito) { incognito_ = incognito; } |
146 virtual bool IsOffTheRecord(); | 146 virtual bool IsOffTheRecord() OVERRIDE; |
147 // Assumes ownership. | 147 // Assumes ownership. |
148 virtual void SetOffTheRecordProfile(Profile* profile); | 148 virtual void SetOffTheRecordProfile(Profile* profile); |
149 virtual Profile* GetOffTheRecordProfile(); | 149 virtual Profile* GetOffTheRecordProfile() OVERRIDE; |
150 virtual void DestroyOffTheRecordProfile() {} | 150 virtual void DestroyOffTheRecordProfile() OVERRIDE {} |
151 virtual bool HasOffTheRecordProfile(); | 151 virtual bool HasOffTheRecordProfile() OVERRIDE; |
152 virtual Profile* GetOriginalProfile(); | 152 virtual Profile* GetOriginalProfile() OVERRIDE; |
153 void SetAppCacheService(ChromeAppCacheService* appcache_service); | 153 void SetAppCacheService(ChromeAppCacheService* appcache_service); |
154 virtual ChromeAppCacheService* GetAppCacheService(); | 154 virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE; |
155 virtual webkit_database::DatabaseTracker* GetDatabaseTracker(); | 155 virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE; |
156 virtual VisitedLinkMaster* GetVisitedLinkMaster(); | 156 virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE; |
157 virtual ExtensionService* GetExtensionService(); | 157 virtual ExtensionService* GetExtensionService() OVERRIDE; |
158 virtual UserScriptMaster* GetUserScriptMaster(); | 158 virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE; |
159 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager(); | 159 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() OVERRIDE; |
160 virtual ExtensionProcessManager* GetExtensionProcessManager(); | 160 virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE; |
161 virtual ExtensionMessageService* GetExtensionMessageService(); | 161 virtual ExtensionMessageService* GetExtensionMessageService() OVERRIDE; |
162 virtual ExtensionEventRouter* GetExtensionEventRouter(); | 162 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; |
163 void SetExtensionSpecialStoragePolicy( | 163 void SetExtensionSpecialStoragePolicy( |
164 ExtensionSpecialStoragePolicy* extension_special_storage_policy); | 164 ExtensionSpecialStoragePolicy* extension_special_storage_policy); |
165 virtual ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy(); | 165 virtual ExtensionSpecialStoragePolicy* |
166 virtual SSLHostState* GetSSLHostState(); | 166 GetExtensionSpecialStoragePolicy() OVERRIDE; |
167 virtual FaviconService* GetFaviconService(ServiceAccessType access); | 167 virtual SSLHostState* GetSSLHostState() OVERRIDE; |
168 virtual HistoryService* GetHistoryService(ServiceAccessType access); | 168 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; |
169 virtual HistoryService* GetHistoryServiceWithoutCreating(); | 169 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; |
| 170 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; |
170 // The CookieMonster will only be returned if a Context has been created. Do | 171 // The CookieMonster will only be returned if a Context has been created. Do |
171 // this by calling CreateRequestContext(). See the note at GetRequestContext | 172 // this by calling CreateRequestContext(). See the note at GetRequestContext |
172 // for more information. | 173 // for more information. |
173 net::CookieMonster* GetCookieMonster(); | 174 net::CookieMonster* GetCookieMonster(); |
174 virtual AutocompleteClassifier* GetAutocompleteClassifier(); | 175 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; |
175 virtual history::ShortcutsBackend* GetShortcutsBackend(); | 176 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; |
176 virtual WebDataService* GetWebDataService(ServiceAccessType access); | 177 virtual WebDataService* GetWebDataService(ServiceAccessType access) OVERRIDE; |
177 virtual WebDataService* GetWebDataServiceWithoutCreating(); | 178 virtual WebDataService* GetWebDataServiceWithoutCreating() OVERRIDE; |
178 virtual PasswordStore* GetPasswordStore(ServiceAccessType access); | 179 virtual PasswordStore* GetPasswordStore(ServiceAccessType access) OVERRIDE; |
179 // Sets the profile's PrefService. If a pref service hasn't been explicitly | 180 // Sets the profile's PrefService. If a pref service hasn't been explicitly |
180 // set GetPrefs creates one, so normally you need not invoke this. If you need | 181 // set GetPrefs creates one, so normally you need not invoke this. If you need |
181 // to set a pref service you must invoke this before GetPrefs. | 182 // to set a pref service you must invoke this before GetPrefs. |
182 // TestingPrefService takes ownership of |prefs|. | 183 // TestingPrefService takes ownership of |prefs|. |
183 void SetPrefService(PrefService* prefs); | 184 void SetPrefService(PrefService* prefs); |
184 virtual PrefService* GetPrefs(); | 185 virtual PrefService* GetPrefs() OVERRIDE; |
185 virtual TemplateURLFetcher* GetTemplateURLFetcher(); | 186 virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE; |
186 virtual history::TopSites* GetTopSites(); | 187 virtual history::TopSites* GetTopSites() OVERRIDE; |
187 virtual history::TopSites* GetTopSitesWithoutCreating(); | 188 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; |
188 virtual DownloadManager* GetDownloadManager(); | 189 virtual DownloadManager* GetDownloadManager() OVERRIDE; |
189 virtual fileapi::FileSystemContext* GetFileSystemContext(); | 190 virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE; |
190 virtual void SetQuotaManager(quota::QuotaManager* manager); | 191 virtual void SetQuotaManager(quota::QuotaManager* manager); |
191 virtual quota::QuotaManager* GetQuotaManager(); | 192 virtual quota::QuotaManager* GetQuotaManager() OVERRIDE; |
192 | 193 |
193 // Returns a testing ContextGetter (if one has been created via | 194 // Returns a testing ContextGetter (if one has been created via |
194 // CreateRequestContext) or NULL. This is not done on-demand for two reasons: | 195 // CreateRequestContext) or NULL. This is not done on-demand for two reasons: |
195 // (1) Some tests depend on GetRequestContext() returning NULL. (2) Because | 196 // (1) Some tests depend on GetRequestContext() returning NULL. (2) Because |
196 // of the special memory management considerations for the | 197 // of the special memory management considerations for the |
197 // TestURLRequestContextGetter class, many tests would find themseleves | 198 // TestURLRequestContextGetter class, many tests would find themseleves |
198 // leaking if they called this method without the necessary IO thread. This | 199 // leaking if they called this method without the necessary IO thread. This |
199 // getter is currently only capable of returning a Context that helps test | 200 // getter is currently only capable of returning a Context that helps test |
200 // the CookieMonster. See implementation comments for more details. | 201 // the CookieMonster. See implementation comments for more details. |
201 virtual net::URLRequestContextGetter* GetRequestContext(); | 202 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
202 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | 203 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
203 int renderer_child_id); | 204 int renderer_child_id) OVERRIDE; |
204 void CreateRequestContext(); | 205 void CreateRequestContext(); |
205 // Clears out the created request context (which must be done before shutting | 206 // Clears out the created request context (which must be done before shutting |
206 // down the IO thread to avoid leaks). | 207 // down the IO thread to avoid leaks). |
207 void ResetRequestContext(); | 208 void ResetRequestContext(); |
208 | 209 |
209 virtual net::URLRequestContextGetter* GetRequestContextForMedia(); | 210 virtual net::URLRequestContextGetter* GetRequestContextForMedia() OVERRIDE; |
210 virtual net::URLRequestContextGetter* GetRequestContextForExtensions(); | 211 virtual net::URLRequestContextGetter* |
| 212 GetRequestContextForExtensions() OVERRIDE; |
211 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( | 213 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( |
212 const std::string& app_id); | 214 const std::string& app_id) OVERRIDE; |
213 | 215 |
214 virtual const content::ResourceContext& GetResourceContext(); | 216 virtual const content::ResourceContext& GetResourceContext() OVERRIDE; |
215 | 217 |
216 virtual net::SSLConfigService* GetSSLConfigService(); | 218 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; |
217 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher(); | 219 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() OVERRIDE; |
218 virtual FindBarState* GetFindBarState(); | 220 virtual FindBarState* GetFindBarState() OVERRIDE; |
219 virtual HostContentSettingsMap* GetHostContentSettingsMap(); | 221 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; |
220 virtual GeolocationPermissionContext* GetGeolocationPermissionContext(); | 222 virtual GeolocationPermissionContext* |
221 virtual SpeechInputPreferences* GetSpeechInputPreferences(); | 223 GetGeolocationPermissionContext() OVERRIDE; |
222 virtual HostZoomMap* GetHostZoomMap(); | 224 virtual SpeechInputPreferences* GetSpeechInputPreferences() OVERRIDE; |
223 virtual bool HasProfileSyncService() const; | 225 virtual HostZoomMap* GetHostZoomMap() OVERRIDE; |
| 226 virtual bool HasProfileSyncService() const OVERRIDE; |
224 virtual std::wstring GetName(); | 227 virtual std::wstring GetName(); |
225 virtual void SetName(const std::wstring& name) {} | 228 virtual void SetName(const std::wstring& name) {} |
226 virtual std::wstring GetID(); | 229 virtual std::wstring GetID(); |
227 virtual void SetID(const std::wstring& id); | 230 virtual void SetID(const std::wstring& id); |
228 void set_last_session_exited_cleanly(bool value) { | 231 void set_last_session_exited_cleanly(bool value) { |
229 last_session_exited_cleanly_ = value; | 232 last_session_exited_cleanly_ = value; |
230 } | 233 } |
231 virtual bool DidLastSessionExitCleanly(); | 234 virtual bool DidLastSessionExitCleanly() OVERRIDE; |
232 virtual void MergeResourceString(int message_id, | 235 virtual void MergeResourceString(int message_id, |
233 std::wstring* output_string) {} | 236 std::wstring* output_string) {} |
234 virtual void MergeResourceInteger(int message_id, int* output_value) {} | 237 virtual void MergeResourceInteger(int message_id, int* output_value) {} |
235 virtual void MergeResourceBoolean(int message_id, bool* output_value) {} | 238 virtual void MergeResourceBoolean(int message_id, bool* output_value) {} |
236 virtual BookmarkModel* GetBookmarkModel(); | 239 virtual BookmarkModel* GetBookmarkModel() OVERRIDE; |
237 virtual bool IsSameProfile(Profile *p); | 240 virtual bool IsSameProfile(Profile *p) OVERRIDE; |
238 virtual base::Time GetStartTime() const; | 241 virtual base::Time GetStartTime() const OVERRIDE; |
239 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); | 242 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; |
240 virtual SpellCheckHost* GetSpellCheckHost(); | 243 virtual SpellCheckHost* GetSpellCheckHost() OVERRIDE; |
241 virtual void ReinitializeSpellCheckHost(bool force) { } | 244 virtual void ReinitializeSpellCheckHost(bool force) OVERRIDE { } |
242 virtual WebKitContext* GetWebKitContext(); | 245 virtual WebKitContext* GetWebKitContext() OVERRIDE; |
243 virtual WebKitContext* GetOffTheRecordWebKitContext(); | 246 virtual WebKitContext* GetOffTheRecordWebKitContext(); |
244 virtual void MarkAsCleanShutdown() {} | 247 virtual void MarkAsCleanShutdown() OVERRIDE {} |
245 virtual void InitExtensions(bool extensions_enabled) {} | 248 virtual void InitExtensions(bool extensions_enabled) OVERRIDE {} |
246 virtual void InitPromoResources() {} | 249 virtual void InitPromoResources() OVERRIDE {} |
247 virtual void InitRegisteredProtocolHandlers() {} | 250 virtual void InitRegisteredProtocolHandlers() OVERRIDE {} |
248 | 251 |
249 virtual FilePath last_selected_directory(); | 252 virtual FilePath last_selected_directory() OVERRIDE; |
250 virtual void set_last_selected_directory(const FilePath& path); | 253 virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; |
251 #if defined(OS_CHROMEOS) | 254 #if defined(OS_CHROMEOS) |
252 virtual void SetupChromeOSEnterpriseExtensionObserver() { | 255 virtual void SetupChromeOSEnterpriseExtensionObserver() OVERRIDE { |
253 } | 256 } |
254 virtual void InitChromeOSPreferences() { | 257 virtual void InitChromeOSPreferences() OVERRIDE { |
255 } | 258 } |
256 virtual void ChangeAppLocale(const std::string&, AppLocaleChangedVia) { | 259 virtual void ChangeAppLocale(const std::string&, |
| 260 AppLocaleChangedVia) OVERRIDE { |
257 } | 261 } |
258 virtual void OnLogin() { | 262 virtual void OnLogin() OVERRIDE { |
259 } | 263 } |
260 #endif // defined(OS_CHROMEOS) | 264 #endif // defined(OS_CHROMEOS) |
261 | 265 |
262 virtual PrefProxyConfigTracker* GetProxyConfigTracker(); | 266 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; |
263 | 267 |
264 // Schedules a task on the history backend and runs a nested loop until the | 268 // Schedules a task on the history backend and runs a nested loop until the |
265 // task is processed. This has the effect of blocking the caller until the | 269 // task is processed. This has the effect of blocking the caller until the |
266 // history service processes all pending requests. | 270 // history service processes all pending requests. |
267 void BlockUntilHistoryProcessesPendingRequests(); | 271 void BlockUntilHistoryProcessesPendingRequests(); |
268 | 272 |
269 // Creates and initializes a profile sync service if the tests require one. | 273 // Creates and initializes a profile sync service if the tests require one. |
270 virtual TokenService* GetTokenService(); | 274 virtual TokenService* GetTokenService() OVERRIDE; |
271 virtual ProfileSyncService* GetProfileSyncService(); | 275 virtual ProfileSyncService* GetProfileSyncService() OVERRIDE; |
272 virtual ProfileSyncService* GetProfileSyncService( | 276 virtual ProfileSyncService* GetProfileSyncService( |
273 const std::string& cros_notes); | 277 const std::string& cros_notes) OVERRIDE; |
274 virtual ChromeBlobStorageContext* GetBlobStorageContext(); | 278 virtual ChromeBlobStorageContext* GetBlobStorageContext() OVERRIDE; |
275 virtual ExtensionInfoMap* GetExtensionInfoMap(); | 279 virtual ExtensionInfoMap* GetExtensionInfoMap() OVERRIDE; |
276 virtual PromoCounter* GetInstantPromoCounter(); | 280 virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; |
277 virtual ChromeURLDataManager* GetChromeURLDataManager(); | 281 virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; |
278 virtual chrome_browser_net::Predictor* GetNetworkPredictor(); | 282 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; |
279 virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; | 283 virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; |
280 virtual GURL GetHomePage() OVERRIDE; | 284 virtual GURL GetHomePage() OVERRIDE; |
281 virtual NetworkActionPredictor* GetNetworkActionPredictor() OVERRIDE; | 285 virtual NetworkActionPredictor* GetNetworkActionPredictor() OVERRIDE; |
282 | 286 |
283 virtual PrefService* GetOffTheRecordPrefs(); | 287 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; |
284 | 288 |
285 // TODO(jam): remove me once webkit_context_unittest.cc doesn't use Profile | 289 // TODO(jam): remove me once webkit_context_unittest.cc doesn't use Profile |
286 // and gets the quota::SpecialStoragePolicy* from whatever ends up replacing | 290 // and gets the quota::SpecialStoragePolicy* from whatever ends up replacing |
287 // it in the content module. | 291 // it in the content module. |
288 quota::SpecialStoragePolicy* GetSpecialStoragePolicy(); | 292 quota::SpecialStoragePolicy* GetSpecialStoragePolicy(); |
289 | 293 |
290 protected: | 294 protected: |
291 base::Time start_time_; | 295 base::Time start_time_; |
292 scoped_ptr<PrefService> prefs_; | 296 scoped_ptr<PrefService> prefs_; |
293 // ref only for right type, lifecycle is managed by prefs_ | 297 // ref only for right type, lifecycle is managed by prefs_ |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // testing. | 406 // testing. |
403 ProfileDependencyManager* profile_dependency_manager_; | 407 ProfileDependencyManager* profile_dependency_manager_; |
404 | 408 |
405 scoped_refptr<ChromeAppCacheService> appcache_service_; | 409 scoped_refptr<ChromeAppCacheService> appcache_service_; |
406 | 410 |
407 // The QuotaManager, only available if set explicitly via SetQuotaManager. | 411 // The QuotaManager, only available if set explicitly via SetQuotaManager. |
408 scoped_refptr<quota::QuotaManager> quota_manager_; | 412 scoped_refptr<quota::QuotaManager> quota_manager_; |
409 }; | 413 }; |
410 | 414 |
411 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 415 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
OLD | NEW |