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