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