| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void CreateBookmarkModel(bool delete_file); | 100 void CreateBookmarkModel(bool delete_file); |
| 101 | 101 |
| 102 // Creates an AutocompleteClassifier. If not invoked the | 102 // Creates an AutocompleteClassifier. If not invoked the |
| 103 // AutocompleteClassifier is NULL. | 103 // AutocompleteClassifier is NULL. |
| 104 void CreateAutocompleteClassifier(); | 104 void CreateAutocompleteClassifier(); |
| 105 | 105 |
| 106 // Creates a ProtocolHandlerRegistry. If not invoked the protocol handler | 106 // Creates a ProtocolHandlerRegistry. If not invoked the protocol handler |
| 107 // registry is NULL. | 107 // registry is NULL. |
| 108 void CreateProtocolHandlerRegistry(); | 108 void CreateProtocolHandlerRegistry(); |
| 109 | 109 |
| 110 // Creates the webdata service. If |delete_file| is true, the webdata file is | |
| 111 // deleted first, then the WebDataService is created. As TestingProfile | |
| 112 // deletes the directory containing the files used by WebDataService, this | |
| 113 // only matters if you're recreating the WebDataService. | |
| 114 void CreateWebDataService(bool delete_file); | |
| 115 | |
| 116 // Blocks until the BookmarkModel finishes loaded. This is NOT invoked from | 110 // Blocks until the BookmarkModel finishes loaded. This is NOT invoked from |
| 117 // CreateBookmarkModel. | 111 // CreateBookmarkModel. |
| 118 void BlockUntilBookmarkModelLoaded(); | 112 void BlockUntilBookmarkModelLoaded(); |
| 119 | 113 |
| 120 // Blocks until TopSites finishes loading. | 114 // Blocks until TopSites finishes loading. |
| 121 void BlockUntilTopSitesLoaded(); | 115 void BlockUntilTopSitesLoaded(); |
| 122 | 116 |
| 123 // Creates a TemplateURLService. If not invoked the TemplateURLService is | 117 // Creates a TemplateURLService. If not invoked the TemplateURLService is |
| 124 // NULL. Creates a TemplateURLFetcher. If not invoked, the | 118 // NULL. Creates a TemplateURLFetcher. If not invoked, the |
| 125 // TemplateURLFetcher is NULL. | 119 // TemplateURLFetcher is NULL. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 GetExtensionSpecialStoragePolicy() OVERRIDE; | 173 GetExtensionSpecialStoragePolicy() OVERRIDE; |
| 180 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; | 174 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; |
| 181 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; | 175 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; |
| 182 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; | 176 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; |
| 183 // The CookieMonster will only be returned if a Context has been created. Do | 177 // The CookieMonster will only be returned if a Context has been created. Do |
| 184 // this by calling CreateRequestContext(). See the note at GetRequestContext | 178 // this by calling CreateRequestContext(). See the note at GetRequestContext |
| 185 // for more information. | 179 // for more information. |
| 186 net::CookieMonster* GetCookieMonster(); | 180 net::CookieMonster* GetCookieMonster(); |
| 187 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; | 181 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; |
| 188 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; | 182 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; |
| 189 virtual WebDataService* GetWebDataService(ServiceAccessType access) OVERRIDE; | |
| 190 virtual WebDataService* GetWebDataServiceWithoutCreating() OVERRIDE; | |
| 191 // Sets the profile's PrefService. If a pref service hasn't been explicitly | 183 // Sets the profile's PrefService. If a pref service hasn't been explicitly |
| 192 // set GetPrefs creates one, so normally you need not invoke this. If you need | 184 // set GetPrefs creates one, so normally you need not invoke this. If you need |
| 193 // to set a pref service you must invoke this before GetPrefs. | 185 // to set a pref service you must invoke this before GetPrefs. |
| 194 // TestingPrefService takes ownership of |prefs|. | 186 // TestingPrefService takes ownership of |prefs|. |
| 195 void SetPrefService(PrefService* prefs); | 187 void SetPrefService(PrefService* prefs); |
| 196 virtual PrefService* GetPrefs() OVERRIDE; | 188 virtual PrefService* GetPrefs() OVERRIDE; |
| 197 virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE; | 189 virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE; |
| 198 virtual history::TopSites* GetTopSites() OVERRIDE; | 190 virtual history::TopSites* GetTopSites() OVERRIDE; |
| 199 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; | 191 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; |
| 200 | 192 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 private: | 261 private: |
| 270 // Common initialization between the two constructors. | 262 // Common initialization between the two constructors. |
| 271 void Init(); | 263 void Init(); |
| 272 | 264 |
| 273 // Finishes initialization when a profile is created asynchronously. | 265 // Finishes initialization when a profile is created asynchronously. |
| 274 void FinishInit(); | 266 void FinishInit(); |
| 275 | 267 |
| 276 // Destroys favicon service if it has been created. | 268 // Destroys favicon service if it has been created. |
| 277 void DestroyFaviconService(); | 269 void DestroyFaviconService(); |
| 278 | 270 |
| 279 // If the webdata service has been created, it is destroyed. This is invoked | |
| 280 // from the destructor. | |
| 281 void DestroyWebDataService(); | |
| 282 | |
| 283 // Creates a TestingPrefService and associates it with the TestingProfile. | 271 // Creates a TestingPrefService and associates it with the TestingProfile. |
| 284 void CreateTestingPrefService(); | 272 void CreateTestingPrefService(); |
| 285 | 273 |
| 286 // The favicon service. Only created if CreateFaviconService is invoked. | 274 // The favicon service. Only created if CreateFaviconService is invoked. |
| 287 scoped_ptr<FaviconService> favicon_service_; | 275 scoped_ptr<FaviconService> favicon_service_; |
| 288 | 276 |
| 289 // The history service. Only created if CreateHistoryService is invoked. | 277 // The history service. Only created if CreateHistoryService is invoked. |
| 290 scoped_refptr<HistoryService> history_service_; | 278 scoped_refptr<HistoryService> history_service_; |
| 291 | 279 |
| 292 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. | 280 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. |
| 293 scoped_ptr<BookmarkModel> bookmark_bar_model_; | 281 scoped_ptr<BookmarkModel> bookmark_bar_model_; |
| 294 | 282 |
| 295 // The ProtocolHandlerRegistry. Only created if CreateProtocolHandlerRegistry | 283 // The ProtocolHandlerRegistry. Only created if CreateProtocolHandlerRegistry |
| 296 // is invoked. | 284 // is invoked. |
| 297 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; | 285 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; |
| 298 | 286 |
| 299 // The ProfileSyncService. Created by CreateProfileSyncService. | 287 // The ProfileSyncService. Created by CreateProfileSyncService. |
| 300 scoped_ptr<ProfileSyncService> profile_sync_service_; | 288 scoped_ptr<ProfileSyncService> profile_sync_service_; |
| 301 | 289 |
| 302 // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier | 290 // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier |
| 303 // is invoked. | 291 // is invoked. |
| 304 scoped_ptr<AutocompleteClassifier> autocomplete_classifier_; | 292 scoped_ptr<AutocompleteClassifier> autocomplete_classifier_; |
| 305 | 293 |
| 306 // The WebDataService. Only created if CreateWebDataService is invoked. | |
| 307 scoped_refptr<WebDataService> web_data_service_; | |
| 308 | |
| 309 // The TemplateURLFetcher. Only created if CreateTemplateURLFetcher is | 294 // The TemplateURLFetcher. Only created if CreateTemplateURLFetcher is |
| 310 // invoked. | 295 // invoked. |
| 311 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; | 296 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; |
| 312 | 297 |
| 313 // Internally, this is a TestURLRequestContextGetter that creates a dummy | 298 // Internally, this is a TestURLRequestContextGetter that creates a dummy |
| 314 // request context. Currently, only the CookieMonster is hooked up. | 299 // request context. Currently, only the CookieMonster is hooked up. |
| 315 scoped_refptr<net::URLRequestContextGetter> request_context_; | 300 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 316 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; | 301 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; |
| 317 | 302 |
| 318 std::wstring id_; | 303 std::wstring id_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 // testing. | 339 // testing. |
| 355 ProfileDependencyManager* profile_dependency_manager_; | 340 ProfileDependencyManager* profile_dependency_manager_; |
| 356 | 341 |
| 357 scoped_ptr<content::MockResourceContext> resource_context_; | 342 scoped_ptr<content::MockResourceContext> resource_context_; |
| 358 | 343 |
| 359 // Weak pointer to a delegate for indicating that a profile was created. | 344 // Weak pointer to a delegate for indicating that a profile was created. |
| 360 Delegate* delegate_; | 345 Delegate* delegate_; |
| 361 }; | 346 }; |
| 362 | 347 |
| 363 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 348 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
| OLD | NEW |