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 | 109 // Creates a WebDataService. If not invoked, the web data service is NULL. |
110 // deleted first, then the WebDataService is created. As TestingProfile | 110 void CreateWebDataService(); |
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 | 111 |
115 // Blocks until the BookmarkModel finishes loaded. This is NOT invoked from | 112 // Blocks until the BookmarkModel finishes loaded. This is NOT invoked from |
116 // CreateBookmarkModel. | 113 // CreateBookmarkModel. |
117 void BlockUntilBookmarkModelLoaded(); | 114 void BlockUntilBookmarkModelLoaded(); |
118 | 115 |
119 // Blocks until TopSites finishes loading. | 116 // Blocks until TopSites finishes loading. |
120 void BlockUntilTopSitesLoaded(); | 117 void BlockUntilTopSitesLoaded(); |
121 | 118 |
122 // Creates a TemplateURLService. If not invoked, the TemplateURLService is | 119 // Creates a TemplateURLService. If not invoked, the TemplateURLService is |
123 // NULL. | 120 // NULL. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 GetExtensionSpecialStoragePolicy() OVERRIDE; | 169 GetExtensionSpecialStoragePolicy() OVERRIDE; |
173 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; | 170 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; |
174 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; | 171 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; |
175 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; | 172 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; |
176 // The CookieMonster will only be returned if a Context has been created. Do | 173 // The CookieMonster will only be returned if a Context has been created. Do |
177 // this by calling CreateRequestContext(). See the note at GetRequestContext | 174 // this by calling CreateRequestContext(). See the note at GetRequestContext |
178 // for more information. | 175 // for more information. |
179 net::CookieMonster* GetCookieMonster(); | 176 net::CookieMonster* GetCookieMonster(); |
180 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; | 177 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; |
181 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; | 178 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 | 179 // 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 | 180 // 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. | 181 // to set a pref service you must invoke this before GetPrefs. |
187 // TestingPrefService takes ownership of |prefs|. | 182 // TestingPrefService takes ownership of |prefs|. |
188 void SetPrefService(PrefService* prefs); | 183 void SetPrefService(PrefService* prefs); |
189 virtual PrefService* GetPrefs() OVERRIDE; | 184 virtual PrefService* GetPrefs() OVERRIDE; |
190 virtual history::TopSites* GetTopSites() OVERRIDE; | 185 virtual history::TopSites* GetTopSites() OVERRIDE; |
191 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; | 186 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; |
192 | 187 |
193 void CreateRequestContext(); | 188 void CreateRequestContext(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 private: | 253 private: |
259 // Common initialization between the two constructors. | 254 // Common initialization between the two constructors. |
260 void Init(); | 255 void Init(); |
261 | 256 |
262 // Finishes initialization when a profile is created asynchronously. | 257 // Finishes initialization when a profile is created asynchronously. |
263 void FinishInit(); | 258 void FinishInit(); |
264 | 259 |
265 // Destroys favicon service if it has been created. | 260 // Destroys favicon service if it has been created. |
266 void DestroyFaviconService(); | 261 void DestroyFaviconService(); |
267 | 262 |
268 // If the webdata service has been created, it is destroyed. This is invoked | |
269 // from the destructor. | |
270 void DestroyWebDataService(); | |
271 | |
272 // Creates a TestingPrefService and associates it with the TestingProfile. | 263 // Creates a TestingPrefService and associates it with the TestingProfile. |
273 void CreateTestingPrefService(); | 264 void CreateTestingPrefService(); |
274 | 265 |
275 virtual base::Callback<ChromeURLDataManagerBackend*(void)> | 266 virtual base::Callback<ChromeURLDataManagerBackend*(void)> |
276 GetChromeURLDataManagerBackendGetter() const OVERRIDE; | 267 GetChromeURLDataManagerBackendGetter() const OVERRIDE; |
277 | 268 |
278 // The favicon service. Only created if CreateFaviconService is invoked. | 269 // The favicon service. Only created if CreateFaviconService is invoked. |
279 scoped_ptr<FaviconService> favicon_service_; | 270 scoped_ptr<FaviconService> favicon_service_; |
280 | 271 |
281 // The history service. Only created if CreateHistoryService is invoked. | 272 // The history service. Only created if CreateHistoryService is invoked. |
282 scoped_refptr<HistoryService> history_service_; | 273 scoped_refptr<HistoryService> history_service_; |
283 | 274 |
284 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. | 275 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. |
285 scoped_ptr<BookmarkModel> bookmark_bar_model_; | 276 scoped_ptr<BookmarkModel> bookmark_bar_model_; |
286 | 277 |
287 // The ProtocolHandlerRegistry. Only created if CreateProtocolHandlerRegistry | 278 // The ProtocolHandlerRegistry. Only created if CreateProtocolHandlerRegistry |
288 // is invoked. | 279 // is invoked. |
289 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; | 280 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; |
290 | 281 |
291 // The ProfileSyncService. Created by CreateProfileSyncService. | |
292 scoped_ptr<ProfileSyncService> profile_sync_service_; | |
293 | |
294 // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier | 282 // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier |
295 // is invoked. | 283 // is invoked. |
296 scoped_ptr<AutocompleteClassifier> autocomplete_classifier_; | 284 scoped_ptr<AutocompleteClassifier> autocomplete_classifier_; |
297 | 285 |
298 // The WebDataService. Only created if CreateWebDataService is invoked. | |
299 scoped_refptr<WebDataService> web_data_service_; | |
300 | |
301 // Internally, this is a TestURLRequestContextGetter that creates a dummy | 286 // Internally, this is a TestURLRequestContextGetter that creates a dummy |
302 // request context. Currently, only the CookieMonster is hooked up. | 287 // request context. Currently, only the CookieMonster is hooked up. |
303 scoped_refptr<net::URLRequestContextGetter> request_context_; | 288 scoped_refptr<net::URLRequestContextGetter> request_context_; |
304 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; | 289 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; |
305 | 290 |
306 std::wstring id_; | 291 std::wstring id_; |
307 | 292 |
308 bool incognito_; | 293 bool incognito_; |
309 scoped_ptr<Profile> incognito_profile_; | 294 scoped_ptr<Profile> incognito_profile_; |
310 | 295 |
(...skipping 29 matching lines...) Expand all 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 |