| 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. | 118 // NULL. |
| 125 void CreateTemplateURLService(); | 119 void CreateTemplateURLService(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 GetExtensionSpecialStoragePolicy() OVERRIDE; | 168 GetExtensionSpecialStoragePolicy() OVERRIDE; |
| 175 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; | 169 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; |
| 176 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; | 170 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; |
| 177 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; | 171 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; |
| 178 // The CookieMonster will only be returned if a Context has been created. Do | 172 // The CookieMonster will only be returned if a Context has been created. Do |
| 179 // this by calling CreateRequestContext(). See the note at GetRequestContext | 173 // this by calling CreateRequestContext(). See the note at GetRequestContext |
| 180 // for more information. | 174 // for more information. |
| 181 net::CookieMonster* GetCookieMonster(); | 175 net::CookieMonster* GetCookieMonster(); |
| 182 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; | 176 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; |
| 183 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; | 177 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; |
| 184 virtual WebDataService* GetWebDataService(ServiceAccessType access) OVERRIDE; | |
| 185 virtual WebDataService* GetWebDataServiceWithoutCreating() OVERRIDE; | |
| 186 // Sets the profile's PrefService. If a pref service hasn't been explicitly | 178 // Sets the profile's PrefService. If a pref service hasn't been explicitly |
| 187 // set GetPrefs creates one, so normally you need not invoke this. If you need | 179 // set GetPrefs creates one, so normally you need not invoke this. If you need |
| 188 // to set a pref service you must invoke this before GetPrefs. | 180 // to set a pref service you must invoke this before GetPrefs. |
| 189 // TestingPrefService takes ownership of |prefs|. | 181 // TestingPrefService takes ownership of |prefs|. |
| 190 void SetPrefService(PrefService* prefs); | 182 void SetPrefService(PrefService* prefs); |
| 191 virtual PrefService* GetPrefs() OVERRIDE; | 183 virtual PrefService* GetPrefs() OVERRIDE; |
| 192 virtual history::TopSites* GetTopSites() OVERRIDE; | 184 virtual history::TopSites* GetTopSites() OVERRIDE; |
| 193 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; | 185 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; |
| 194 | 186 |
| 195 void CreateRequestContext(); | 187 void CreateRequestContext(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 private: | 254 private: |
| 263 // Common initialization between the two constructors. | 255 // Common initialization between the two constructors. |
| 264 void Init(); | 256 void Init(); |
| 265 | 257 |
| 266 // Finishes initialization when a profile is created asynchronously. | 258 // Finishes initialization when a profile is created asynchronously. |
| 267 void FinishInit(); | 259 void FinishInit(); |
| 268 | 260 |
| 269 // Destroys favicon service if it has been created. | 261 // Destroys favicon service if it has been created. |
| 270 void DestroyFaviconService(); | 262 void DestroyFaviconService(); |
| 271 | 263 |
| 272 // If the webdata service has been created, it is destroyed. This is invoked | |
| 273 // from the destructor. | |
| 274 void DestroyWebDataService(); | |
| 275 | |
| 276 // Creates a TestingPrefService and associates it with the TestingProfile. | 264 // Creates a TestingPrefService and associates it with the TestingProfile. |
| 277 void CreateTestingPrefService(); | 265 void CreateTestingPrefService(); |
| 278 | 266 |
| 279 // The favicon service. Only created if CreateFaviconService is invoked. | 267 // The favicon service. Only created if CreateFaviconService is invoked. |
| 280 scoped_ptr<FaviconService> favicon_service_; | 268 scoped_ptr<FaviconService> favicon_service_; |
| 281 | 269 |
| 282 // The history service. Only created if CreateHistoryService is invoked. | 270 // The history service. Only created if CreateHistoryService is invoked. |
| 283 scoped_refptr<HistoryService> history_service_; | 271 scoped_refptr<HistoryService> history_service_; |
| 284 | 272 |
| 285 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. | 273 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. |
| 286 scoped_ptr<BookmarkModel> bookmark_bar_model_; | 274 scoped_ptr<BookmarkModel> bookmark_bar_model_; |
| 287 | 275 |
| 288 // The ProtocolHandlerRegistry. Only created if CreateProtocolHandlerRegistry | 276 // The ProtocolHandlerRegistry. Only created if CreateProtocolHandlerRegistry |
| 289 // is invoked. | 277 // is invoked. |
| 290 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; | 278 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; |
| 291 | 279 |
| 292 // The ProfileSyncService. Created by CreateProfileSyncService. | 280 // The ProfileSyncService. Created by CreateProfileSyncService. |
| 293 scoped_ptr<ProfileSyncService> profile_sync_service_; | 281 scoped_ptr<ProfileSyncService> profile_sync_service_; |
| 294 | 282 |
| 295 // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier | 283 // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier |
| 296 // is invoked. | 284 // is invoked. |
| 297 scoped_ptr<AutocompleteClassifier> autocomplete_classifier_; | 285 scoped_ptr<AutocompleteClassifier> autocomplete_classifier_; |
| 298 | 286 |
| 299 // The WebDataService. Only created if CreateWebDataService is invoked. | |
| 300 scoped_refptr<WebDataService> web_data_service_; | |
| 301 | |
| 302 // Internally, this is a TestURLRequestContextGetter that creates a dummy | 287 // Internally, this is a TestURLRequestContextGetter that creates a dummy |
| 303 // request context. Currently, only the CookieMonster is hooked up. | 288 // request context. Currently, only the CookieMonster is hooked up. |
| 304 scoped_refptr<net::URLRequestContextGetter> request_context_; | 289 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 305 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; | 290 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; |
| 306 | 291 |
| 307 std::wstring id_; | 292 std::wstring id_; |
| 308 | 293 |
| 309 bool incognito_; | 294 bool incognito_; |
| 310 scoped_ptr<Profile> incognito_profile_; | 295 scoped_ptr<Profile> incognito_profile_; |
| 311 | 296 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // testing. | 328 // testing. |
| 344 ProfileDependencyManager* profile_dependency_manager_; | 329 ProfileDependencyManager* profile_dependency_manager_; |
| 345 | 330 |
| 346 scoped_ptr<content::MockResourceContext> resource_context_; | 331 scoped_ptr<content::MockResourceContext> resource_context_; |
| 347 | 332 |
| 348 // Weak pointer to a delegate for indicating that a profile was created. | 333 // Weak pointer to a delegate for indicating that a profile was created. |
| 349 Delegate* delegate_; | 334 Delegate* delegate_; |
| 350 }; | 335 }; |
| 351 | 336 |
| 352 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 337 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
| OLD | NEW |