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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 virtual LazyBackgroundTaskQueue* GetLazyBackgroundTaskQueue() OVERRIDE; | 187 virtual LazyBackgroundTaskQueue* GetLazyBackgroundTaskQueue() OVERRIDE; |
194 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; | 188 virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; |
195 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; | 189 virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; |
196 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; | 190 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; |
197 // The CookieMonster will only be returned if a Context has been created. Do | 191 // The CookieMonster will only be returned if a Context has been created. Do |
198 // this by calling CreateRequestContext(). See the note at GetRequestContext | 192 // this by calling CreateRequestContext(). See the note at GetRequestContext |
199 // for more information. | 193 // for more information. |
200 net::CookieMonster* GetCookieMonster(); | 194 net::CookieMonster* GetCookieMonster(); |
201 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; | 195 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; |
202 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; | 196 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; |
203 virtual WebDataService* GetWebDataService(ServiceAccessType access) OVERRIDE; | |
204 virtual WebDataService* GetWebDataServiceWithoutCreating() OVERRIDE; | |
205 // Sets the profile's PrefService. If a pref service hasn't been explicitly | 197 // Sets the profile's PrefService. If a pref service hasn't been explicitly |
206 // set GetPrefs creates one, so normally you need not invoke this. If you need | 198 // set GetPrefs creates one, so normally you need not invoke this. If you need |
207 // to set a pref service you must invoke this before GetPrefs. | 199 // to set a pref service you must invoke this before GetPrefs. |
208 // TestingPrefService takes ownership of |prefs|. | 200 // TestingPrefService takes ownership of |prefs|. |
209 void SetPrefService(PrefService* prefs); | 201 void SetPrefService(PrefService* prefs); |
210 virtual PrefService* GetPrefs() OVERRIDE; | 202 virtual PrefService* GetPrefs() OVERRIDE; |
211 virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE; | 203 virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE; |
212 virtual history::TopSites* GetTopSites() OVERRIDE; | 204 virtual history::TopSites* GetTopSites() OVERRIDE; |
213 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; | 205 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; |
214 | 206 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 private: | 277 private: |
286 // Common initialization between the two constructors. | 278 // Common initialization between the two constructors. |
287 void Init(); | 279 void Init(); |
288 | 280 |
289 // Finishes initialization when a profile is created asynchronously. | 281 // Finishes initialization when a profile is created asynchronously. |
290 void FinishInit(); | 282 void FinishInit(); |
291 | 283 |
292 // Destroys favicon service if it has been created. | 284 // Destroys favicon service if it has been created. |
293 void DestroyFaviconService(); | 285 void DestroyFaviconService(); |
294 | 286 |
295 // If the webdata service has been created, it is destroyed. This is invoked | |
296 // from the destructor. | |
297 void DestroyWebDataService(); | |
298 | |
299 // Creates a TestingPrefService and associates it with the TestingProfile. | 287 // Creates a TestingPrefService and associates it with the TestingProfile. |
300 void CreateTestingPrefService(); | 288 void CreateTestingPrefService(); |
301 | 289 |
302 // The favicon service. Only created if CreateFaviconService is invoked. | 290 // The favicon service. Only created if CreateFaviconService is invoked. |
303 scoped_ptr<FaviconService> favicon_service_; | 291 scoped_ptr<FaviconService> favicon_service_; |
304 | 292 |
305 // The history service. Only created if CreateHistoryService is invoked. | 293 // The history service. Only created if CreateHistoryService is invoked. |
306 scoped_refptr<HistoryService> history_service_; | 294 scoped_refptr<HistoryService> history_service_; |
307 | 295 |
308 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. | 296 // The BookmarkModel. Only created if CreateBookmarkModel is invoked. |
309 scoped_ptr<BookmarkModel> bookmark_bar_model_; | 297 scoped_ptr<BookmarkModel> bookmark_bar_model_; |
310 | 298 |
311 // The ProtocolHandlerRegistry. Only created if CreateProtocolHandlerRegistry | 299 // The ProtocolHandlerRegistry. Only created if CreateProtocolHandlerRegistry |
312 // is invoked. | 300 // is invoked. |
313 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; | 301 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; |
314 | 302 |
315 // The ProfileSyncService. Created by CreateProfileSyncService. | 303 // The ProfileSyncService. Created by CreateProfileSyncService. |
316 scoped_ptr<ProfileSyncService> profile_sync_service_; | 304 scoped_ptr<ProfileSyncService> profile_sync_service_; |
317 | 305 |
318 // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier | 306 // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier |
319 // is invoked. | 307 // is invoked. |
320 scoped_ptr<AutocompleteClassifier> autocomplete_classifier_; | 308 scoped_ptr<AutocompleteClassifier> autocomplete_classifier_; |
321 | 309 |
322 // The WebDataService. Only created if CreateWebDataService is invoked. | |
323 scoped_refptr<WebDataService> web_data_service_; | |
324 | |
325 // The TemplateURLFetcher. Only created if CreateTemplateURLFetcher is | 310 // The TemplateURLFetcher. Only created if CreateTemplateURLFetcher is |
326 // invoked. | 311 // invoked. |
327 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; | 312 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; |
328 | 313 |
329 // Internally, this is a TestURLRequestContextGetter that creates a dummy | 314 // Internally, this is a TestURLRequestContextGetter that creates a dummy |
330 // request context. Currently, only the CookieMonster is hooked up. | 315 // request context. Currently, only the CookieMonster is hooked up. |
331 scoped_refptr<net::URLRequestContextGetter> request_context_; | 316 scoped_refptr<net::URLRequestContextGetter> request_context_; |
332 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; | 317 scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; |
333 | 318 |
334 std::wstring id_; | 319 std::wstring id_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // testing. | 365 // testing. |
381 ProfileDependencyManager* profile_dependency_manager_; | 366 ProfileDependencyManager* profile_dependency_manager_; |
382 | 367 |
383 scoped_ptr<content::MockResourceContext> resource_context_; | 368 scoped_ptr<content::MockResourceContext> resource_context_; |
384 | 369 |
385 // Weak pointer to a delegate for indicating that a profile was created. | 370 // Weak pointer to a delegate for indicating that a profile was created. |
386 Delegate* delegate_; | 371 Delegate* delegate_; |
387 }; | 372 }; |
388 | 373 |
389 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 374 #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |
OLD | NEW |