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