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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // TemplateURLFetcher is NULL. | 127 // TemplateURLFetcher is NULL. |
128 void CreateTemplateURLFetcher(); | 128 void CreateTemplateURLFetcher(); |
129 | 129 |
130 // Creates a TemplateURLService. If not invoked, the TemplateURLService is | 130 // Creates a TemplateURLService. If not invoked, the TemplateURLService is |
131 // NULL. | 131 // NULL. |
132 void CreateTemplateURLService(); | 132 void CreateTemplateURLService(); |
133 | 133 |
134 // Blocks until TempalteURLService finishes loading. | 134 // Blocks until TempalteURLService finishes loading. |
135 void BlockUntilTemplateURLServiceLoaded(); | 135 void BlockUntilTemplateURLServiceLoaded(); |
136 | 136 |
137 // Creates an ExtensionProcessManager. If not invoked, the | |
138 // ExtensionProcessManager is NULL. | |
139 void CreateExtensionProcessManager(); | |
140 | |
141 // Creates an ExtensionService initialized with the testing profile and | |
142 // returns it. The profile keeps its own copy of a scoped_refptr to the | |
143 // ExtensionService to make sure that is still alive to be notified when the | |
144 // profile is destroyed. | |
145 ExtensionService* CreateExtensionService(const CommandLine* command_line, | |
146 const FilePath& install_directory, | |
147 bool autoupdate_enabled); | |
148 | |
149 TestingPrefService* GetTestingPrefService(); | 137 TestingPrefService* GetTestingPrefService(); |
150 | 138 |
151 // content::BrowserContext | 139 // content::BrowserContext |
152 virtual FilePath GetPath() OVERRIDE; | 140 virtual FilePath GetPath() OVERRIDE; |
153 virtual bool IsOffTheRecord() OVERRIDE; | 141 virtual bool IsOffTheRecord() OVERRIDE; |
154 virtual content::DownloadManager* GetDownloadManager() OVERRIDE; | 142 virtual content::DownloadManager* GetDownloadManager() OVERRIDE; |
155 // Returns a testing ContextGetter (if one has been created via | 143 // Returns a testing ContextGetter (if one has been created via |
156 // CreateRequestContext) or NULL. This is not done on-demand for two reasons: | 144 // CreateRequestContext) or NULL. This is not done on-demand for two reasons: |
157 // (1) Some tests depend on GetRequestContext() returning NULL. (2) Because | 145 // (1) Some tests depend on GetRequestContext() returning NULL. (2) Because |
158 // of the special memory management considerations for the | 146 // of the special memory management considerations for the |
(...skipping 16 matching lines...) Expand all Loading... |
175 virtual std::string GetProfileName() OVERRIDE; | 163 virtual std::string GetProfileName() OVERRIDE; |
176 void set_incognito(bool incognito) { incognito_ = incognito; } | 164 void set_incognito(bool incognito) { incognito_ = incognito; } |
177 // Assumes ownership. | 165 // Assumes ownership. |
178 virtual void SetOffTheRecordProfile(Profile* profile); | 166 virtual void SetOffTheRecordProfile(Profile* profile); |
179 virtual Profile* GetOffTheRecordProfile() OVERRIDE; | 167 virtual Profile* GetOffTheRecordProfile() OVERRIDE; |
180 virtual void DestroyOffTheRecordProfile() OVERRIDE {} | 168 virtual void DestroyOffTheRecordProfile() OVERRIDE {} |
181 virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; | 169 virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; |
182 virtual bool HasOffTheRecordProfile() OVERRIDE; | 170 virtual bool HasOffTheRecordProfile() OVERRIDE; |
183 virtual Profile* GetOriginalProfile() OVERRIDE; | 171 virtual Profile* GetOriginalProfile() OVERRIDE; |
184 virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE; | 172 virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE; |
| 173 virtual ExtensionPrefValueMap* GetExtensionPrefValueMap() OVERRIDE; |
185 virtual ExtensionService* GetExtensionService() OVERRIDE; | 174 virtual ExtensionService* GetExtensionService() OVERRIDE; |
186 virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE; | 175 virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE; |
187 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() OVERRIDE; | |
188 virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE; | 176 virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE; |
189 virtual ExtensionMessageService* GetExtensionMessageService() OVERRIDE; | |
190 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; | 177 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; |
191 void SetExtensionSpecialStoragePolicy( | 178 void SetExtensionSpecialStoragePolicy( |
192 ExtensionSpecialStoragePolicy* extension_special_storage_policy); | 179 ExtensionSpecialStoragePolicy* extension_special_storage_policy); |
193 virtual ExtensionSpecialStoragePolicy* | 180 virtual ExtensionSpecialStoragePolicy* |
194 GetExtensionSpecialStoragePolicy() OVERRIDE; | 181 GetExtensionSpecialStoragePolicy() OVERRIDE; |
195 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; | 182 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; |
196 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; | 183 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; |
197 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; | 184 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; |
198 // The CookieMonster will only be returned if a Context has been created. Do | 185 // The CookieMonster will only be returned if a Context has been created. Do |
199 // this by calling CreateRequestContext(). See the note at GetRequestContext | 186 // this by calling CreateRequestContext(). See the note at GetRequestContext |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 virtual void MergeResourceString(int message_id, | 224 virtual void MergeResourceString(int message_id, |
238 std::wstring* output_string) {} | 225 std::wstring* output_string) {} |
239 virtual void MergeResourceInteger(int message_id, int* output_value) {} | 226 virtual void MergeResourceInteger(int message_id, int* output_value) {} |
240 virtual void MergeResourceBoolean(int message_id, bool* output_value) {} | 227 virtual void MergeResourceBoolean(int message_id, bool* output_value) {} |
241 virtual BookmarkModel* GetBookmarkModel() OVERRIDE; | 228 virtual BookmarkModel* GetBookmarkModel() OVERRIDE; |
242 virtual bool IsSameProfile(Profile *p) OVERRIDE; | 229 virtual bool IsSameProfile(Profile *p) OVERRIDE; |
243 virtual base::Time GetStartTime() const OVERRIDE; | 230 virtual base::Time GetStartTime() const OVERRIDE; |
244 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; | 231 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; |
245 virtual WebKitContext* GetOffTheRecordWebKitContext(); | 232 virtual WebKitContext* GetOffTheRecordWebKitContext(); |
246 virtual void MarkAsCleanShutdown() OVERRIDE {} | 233 virtual void MarkAsCleanShutdown() OVERRIDE {} |
247 virtual void InitExtensions(bool extensions_enabled) OVERRIDE {} | |
248 virtual void InitPromoResources() OVERRIDE {} | 234 virtual void InitPromoResources() OVERRIDE {} |
249 virtual void InitRegisteredProtocolHandlers() OVERRIDE {} | 235 virtual void InitRegisteredProtocolHandlers() OVERRIDE {} |
250 | 236 |
251 virtual FilePath last_selected_directory() OVERRIDE; | 237 virtual FilePath last_selected_directory() OVERRIDE; |
252 virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; | 238 virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; |
253 #if defined(OS_CHROMEOS) | 239 #if defined(OS_CHROMEOS) |
254 virtual void SetupChromeOSEnterpriseExtensionObserver() OVERRIDE { | 240 virtual void SetupChromeOSEnterpriseExtensionObserver() OVERRIDE { |
255 } | 241 } |
256 virtual void InitChromeOSPreferences() OVERRIDE { | 242 virtual void InitChromeOSPreferences() OVERRIDE { |
257 } | 243 } |
258 virtual void ChangeAppLocale(const std::string&, | 244 virtual void ChangeAppLocale(const std::string&, |
259 AppLocaleChangedVia) OVERRIDE { | 245 AppLocaleChangedVia) OVERRIDE { |
260 } | 246 } |
261 virtual void OnLogin() OVERRIDE { | 247 virtual void OnLogin() OVERRIDE { |
262 } | 248 } |
263 #endif // defined(OS_CHROMEOS) | 249 #endif // defined(OS_CHROMEOS) |
264 | 250 |
265 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; | 251 virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; |
266 | 252 |
267 // Schedules a task on the history backend and runs a nested loop until the | 253 // Schedules a task on the history backend and runs a nested loop until the |
268 // task is processed. This has the effect of blocking the caller until the | 254 // task is processed. This has the effect of blocking the caller until the |
269 // history service processes all pending requests. | 255 // history service processes all pending requests. |
270 void BlockUntilHistoryProcessesPendingRequests(); | 256 void BlockUntilHistoryProcessesPendingRequests(); |
271 | 257 |
272 virtual TokenService* GetTokenService() OVERRIDE; | 258 virtual TokenService* GetTokenService() OVERRIDE; |
273 virtual ExtensionInfoMap* GetExtensionInfoMap() OVERRIDE; | |
274 virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; | 259 virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; |
275 virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; | 260 virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; |
276 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; | 261 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; |
277 virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; | 262 virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; |
278 virtual GURL GetHomePage() OVERRIDE; | 263 virtual GURL GetHomePage() OVERRIDE; |
279 | 264 |
280 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; | 265 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; |
281 | 266 |
282 protected: | 267 protected: |
283 base::Time start_time_; | 268 base::Time start_time_; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 332 |
348 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 333 scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
349 scoped_refptr<content::GeolocationPermissionContext> | 334 scoped_refptr<content::GeolocationPermissionContext> |
350 geolocation_permission_context_; | 335 geolocation_permission_context_; |
351 | 336 |
352 scoped_refptr<content::SpeechInputPreferences> speech_input_preferences_; | 337 scoped_refptr<content::SpeechInputPreferences> speech_input_preferences_; |
353 | 338 |
354 FilePath last_selected_directory_; | 339 FilePath last_selected_directory_; |
355 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. | 340 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. |
356 | 341 |
357 // The Extension Preferences. Only created if CreateExtensionService is | |
358 // invoked. | |
359 scoped_ptr<ExtensionPrefs> extension_prefs_; | |
360 | |
361 scoped_ptr<ExtensionService> extension_service_; | |
362 | |
363 scoped_ptr<ExtensionProcessManager> extension_process_manager_; | |
364 | |
365 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; | |
366 | |
367 scoped_refptr<ExtensionSpecialStoragePolicy> | 342 scoped_refptr<ExtensionSpecialStoragePolicy> |
368 extension_special_storage_policy_; | 343 extension_special_storage_policy_; |
369 | 344 |
370 // The proxy prefs tracker. | 345 // The proxy prefs tracker. |
371 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 346 scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
372 | 347 |
373 // We use a temporary directory to store testing profile data. In a multi- | 348 // We use a temporary directory to store testing profile data. In a multi- |
374 // profile environment, this is invalid and the directory is managed by the | 349 // profile environment, this is invalid and the directory is managed by the |
375 // TestingProfileManager. | 350 // TestingProfileManager. |
376 ScopedTempDir temp_dir_; | 351 ScopedTempDir temp_dir_; |
377 // The path to this profile. This will be valid in either of the two above | 352 // The path to this profile. This will be valid in either of the two above |
378 // cases. | 353 // cases. |
379 FilePath profile_path_; | 354 FilePath profile_path_; |
380 | 355 |
381 scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_; | 356 scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_; |
382 | 357 |
383 // We keep a weak pointer to the dependency manager we want to notify on our | 358 // We keep a weak pointer to the dependency manager we want to notify on our |
384 // death. Defaults to the Singleton implementation but overridable for | 359 // death. Defaults to the Singleton implementation but overridable for |
385 // testing. | 360 // testing. |
386 ProfileDependencyManager* profile_dependency_manager_; | 361 ProfileDependencyManager* profile_dependency_manager_; |
387 | 362 |
388 scoped_ptr<content::MockResourceContext> resource_context_; | 363 scoped_ptr<content::MockResourceContext> resource_context_; |
389 | 364 |
390 // Weak pointer to a delegate for indicating that a profile was created. | 365 // Weak pointer to a delegate for indicating that a profile was created. |
391 Delegate* delegate_; | 366 Delegate* delegate_; |
392 }; | 367 }; |
393 | 368 |
394 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 369 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
OLD | NEW |