[email protected] | 9a8c402 | 2011-01-25 14:25:33 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | a4ff9eae | 2011-08-01 19:58:16 | [diff] [blame] | 5 | #ifndef CHROME_TEST_BASE_TESTING_PROFILE_H_ |
| 6 | #define CHROME_TEST_BASE_TESTING_PROFILE_H_ |
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 8 | |
[email protected] | 87fa8441 | 2011-08-15 19:27:29 | [diff] [blame] | 9 | #include <string> |
| 10 | |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 11 | #include "base/memory/ref_counted.h" |
| 12 | #include "base/memory/scoped_ptr.h" |
[email protected] | e078590 | 2011-05-19 23:34:17 | [diff] [blame] | 13 | #include "base/scoped_temp_dir.h" |
[email protected] | ca5e740 | 2010-08-19 17:22:47 | [diff] [blame] | 14 | #include "base/timer.h" |
[email protected] | 8ecad5e | 2010-12-02 21:18:33 | [diff] [blame] | 15 | #include "chrome/browser/profiles/profile.h" |
[email protected] | 2261e7b7 | 2011-07-12 13:43:55 | [diff] [blame] | 16 | #include "content/browser/appcache/chrome_appcache_service.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 17 | |
[email protected] | e89b77d | 2011-04-15 18:58:10 | [diff] [blame] | 18 | namespace content { |
| 19 | class ResourceContextGetter; |
| 20 | } |
| 21 | |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 22 | namespace history { |
| 23 | class TopSites; |
| 24 | } |
| 25 | |
| 26 | namespace net { |
| 27 | class CookieMonster; |
| 28 | } |
| 29 | |
[email protected] | 36fb2c7c | 2011-04-04 15:49:08 | [diff] [blame] | 30 | namespace quota { |
| 31 | class SpecialStoragePolicy; |
| 32 | } |
| 33 | |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 34 | class AutocompleteClassifier; |
| 35 | class BookmarkModel; |
[email protected] | 2fb7dc98 | 2010-09-29 12:24:28 | [diff] [blame] | 36 | class CommandLine; |
[email protected] | 73c4793 | 2010-12-06 18:13:43 | [diff] [blame] | 37 | class ExtensionPrefs; |
[email protected] | 9a8c402 | 2011-01-25 14:25:33 | [diff] [blame] | 38 | class ExtensionPrefStore; |
| 39 | class ExtensionPrefValueMap; |
[email protected] | 19eb8015 | 2011-02-26 00:28:43 | [diff] [blame] | 40 | class ExtensionSpecialStoragePolicy; |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 41 | class FaviconService; |
| 42 | class FindBarState; |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 43 | class GeolocationPermissionContext; |
| 44 | class HistoryService; |
| 45 | class HostContentSettingsMap; |
| 46 | class PrefService; |
[email protected] | 5cdcd15 | 2011-03-31 22:48:52 | [diff] [blame] | 47 | class ProfileDependencyManager; |
[email protected] | e3e43d9 | 2010-02-26 22:02:38 | [diff] [blame] | 48 | class ProfileSyncService; |
[email protected] | 8238dd6 | 2011-09-29 15:13:01 | [diff] [blame] | 49 | class SpeechInputPreferences; |
[email protected] | 8e5c89a | 2011-06-07 18:13:33 | [diff] [blame] | 50 | class TemplateURLService; |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 51 | class TestingPrefService; |
[email protected] | a0ea76c | 2011-03-23 17:36:42 | [diff] [blame] | 52 | class ThemeService; |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 53 | class WebKitContext; |
[email protected] | 8cb5d5b | 2010-02-09 11:36:16 | [diff] [blame] | 54 | |
[email protected] | abe2c03 | 2011-03-31 18:49:34 | [diff] [blame] | 55 | namespace net { |
| 56 | class URLRequestContextGetter; |
| 57 | } |
| 58 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 59 | class TestingProfile : public Profile { |
| 60 | public: |
[email protected] | 49a2563 | 2011-08-31 17:03:48 | [diff] [blame] | 61 | // Default constructor that cannot be used with multi-profiles. |
[email protected] | f25387b | 2008-08-21 15:20:33 | [diff] [blame] | 62 | TestingProfile(); |
[email protected] | 965524b | 2009-04-04 21:32:40 | [diff] [blame] | 63 | |
[email protected] | 49a2563 | 2011-08-31 17:03:48 | [diff] [blame] | 64 | // Multi-profile aware constructor that takes the path to a directory managed |
| 65 | // for this profile. This constructor is meant to be used by |
| 66 | // TestingProfileManager::CreateTestingProfile. If you need to create multi- |
| 67 | // profile profiles, use that factory method instead of this directly. |
| 68 | explicit TestingProfile(const FilePath& path); |
| 69 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 70 | virtual ~TestingProfile(); |
| 71 | |
[email protected] | d2879af | 2010-02-08 16:02:56 | [diff] [blame] | 72 | // Creates the favicon service. Consequent calls would recreate the service. |
| 73 | void CreateFaviconService(); |
| 74 | |
[email protected] | f25387b | 2008-08-21 15:20:33 | [diff] [blame] | 75 | // Creates the history service. If |delete_file| is true, the history file is |
| 76 | // deleted first, then the HistoryService is created. As TestingProfile |
[email protected] | d486a085 | 2009-11-02 21:40:00 | [diff] [blame] | 77 | // deletes the directory containing the files used by HistoryService, this |
| 78 | // only matters if you're recreating the HistoryService. If |no_db| is true, |
| 79 | // the history backend will fail to initialize its database; this is useful |
| 80 | // for testing error conditions. |
| 81 | void CreateHistoryService(bool delete_file, bool no_db); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 82 | |
[email protected] | 809cc4d | 2010-10-27 15:22:54 | [diff] [blame] | 83 | // Shuts down and nulls out the reference to HistoryService. |
| 84 | void DestroyHistoryService(); |
| 85 | |
| 86 | // Creates TopSites. This returns immediately, and top sites may not be |
| 87 | // loaded. Use BlockUntilTopSitesLoaded to ensure TopSites has finished |
| 88 | // loading. |
| 89 | void CreateTopSites(); |
| 90 | |
| 91 | // Shuts down and nulls out the reference to TopSites. |
| 92 | void DestroyTopSites(); |
| 93 | |
[email protected] | 4d0cd7ce | 2008-08-11 16:40:57 | [diff] [blame] | 94 | // Creates the BookmkarBarModel. If not invoked the bookmark bar model is |
[email protected] | 90ef1313 | 2008-08-27 03:27:46 | [diff] [blame] | 95 | // NULL. If |delete_file| is true, the bookmarks file is deleted first, then |
| 96 | // the model is created. As TestingProfile deletes the directory containing |
| 97 | // the files used by HistoryService, the boolean only matters if you're |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 98 | // recreating the BookmarkModel. |
[email protected] | d364c65 | 2008-08-29 19:46:56 | [diff] [blame] | 99 | // |
| 100 | // NOTE: this does not block until the bookmarks are loaded. For that use |
| 101 | // BlockUntilBookmarkModelLoaded. |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 102 | void CreateBookmarkModel(bool delete_file); |
[email protected] | 4d0cd7ce | 2008-08-11 16:40:57 | [diff] [blame] | 103 | |
[email protected] | 69c579e | 2010-04-23 20:01:00 | [diff] [blame] | 104 | // Creates an AutocompleteClassifier. If not invoked the |
| 105 | // AutocompleteClassifier is NULL. |
| 106 | void CreateAutocompleteClassifier(); |
| 107 | |
[email protected] | a6d36cc | 2011-02-23 00:39:48 | [diff] [blame] | 108 | // Creates a ProtocolHandlerRegistry. If not invoked the protocol handler |
| 109 | // registry is NULL. |
| 110 | void CreateProtocolHandlerRegistry(); |
| 111 | |
[email protected] | 2609bc1 | 2010-01-24 08:32:55 | [diff] [blame] | 112 | // Creates the webdata service. If |delete_file| is true, the webdata file is |
| 113 | // deleted first, then the WebDataService is created. As TestingProfile |
| 114 | // deletes the directory containing the files used by WebDataService, this |
| 115 | // only matters if you're recreating the WebDataService. |
| 116 | void CreateWebDataService(bool delete_file); |
| 117 | |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 118 | // Blocks until the BookmarkModel finishes loaded. This is NOT invoked from |
| 119 | // CreateBookmarkModel. |
[email protected] | d364c65 | 2008-08-29 19:46:56 | [diff] [blame] | 120 | void BlockUntilBookmarkModelLoaded(); |
| 121 | |
[email protected] | 809cc4d | 2010-10-27 15:22:54 | [diff] [blame] | 122 | // Blocks until TopSites finishes loading. |
| 123 | void BlockUntilTopSitesLoaded(); |
| 124 | |
[email protected] | 8e5c89a | 2011-06-07 18:13:33 | [diff] [blame] | 125 | // Creates a TemplateURLService. If not invoked the TemplateURLService is |
| 126 | // NULL. Creates a TemplateURLFetcher. If not invoked, the |
| 127 | // TemplateURLFetcher is NULL. |
[email protected] | fb9d1f4 | 2010-10-06 23:17:59 | [diff] [blame] | 128 | void CreateTemplateURLFetcher(); |
| 129 | |
[email protected] | 8e5c89a | 2011-06-07 18:13:33 | [diff] [blame] | 130 | // Creates a TemplateURLService. If not invoked, the TemplateURLService is |
| 131 | // NULL. |
| 132 | void CreateTemplateURLService(); |
[email protected] | fb9d1f4 | 2010-10-06 23:17:59 | [diff] [blame] | 133 | |
[email protected] | eaa7dd18 | 2010-12-14 11:09:00 | [diff] [blame] | 134 | // Creates an ExtensionService initialized with the testing profile and |
[email protected] | 2fb7dc98 | 2010-09-29 12:24:28 | [diff] [blame] | 135 | // returns it. The profile keeps its own copy of a scoped_refptr to the |
[email protected] | eaa7dd18 | 2010-12-14 11:09:00 | [diff] [blame] | 136 | // ExtensionService to make sure that is still alive to be notified when the |
[email protected] | 2fb7dc98 | 2010-09-29 12:24:28 | [diff] [blame] | 137 | // profile is destroyed. |
[email protected] | 9a8c402 | 2011-01-25 14:25:33 | [diff] [blame] | 138 | ExtensionService* CreateExtensionService(const CommandLine* command_line, |
[email protected] | 90310d9 | 2011-04-17 07:35:04 | [diff] [blame] | 139 | const FilePath& install_directory, |
| 140 | bool autoupdate_enabled); |
[email protected] | 2fb7dc98 | 2010-09-29 12:24:28 | [diff] [blame] | 141 | |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 142 | TestingPrefService* GetTestingPrefService(); |
| 143 | |
[email protected] | 8e5c89a | 2011-06-07 18:13:33 | [diff] [blame] | 144 | virtual TestingProfile* AsTestingProfile(); |
[email protected] | 29d7025 | 2011-04-28 02:16:58 | [diff] [blame] | 145 | virtual std::string GetProfileName(); |
[email protected] | f9dec948 | 2010-08-20 20:42:19 | [diff] [blame] | 146 | virtual FilePath GetPath(); |
[email protected] | 67351452 | 2011-07-13 18:17:18 | [diff] [blame] | 147 | void set_incognito(bool incognito) { incognito_ = incognito; } |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 148 | virtual bool IsOffTheRecord(); |
[email protected] | 93dba94 | 2011-02-23 22:45:01 | [diff] [blame] | 149 | // Assumes ownership. |
| 150 | virtual void SetOffTheRecordProfile(Profile* profile); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 151 | virtual Profile* GetOffTheRecordProfile(); |
[email protected] | 860f5549 | 2009-03-27 19:50:59 | [diff] [blame] | 152 | virtual void DestroyOffTheRecordProfile() {} |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 153 | virtual bool HasOffTheRecordProfile(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 154 | virtual Profile* GetOriginalProfile(); |
[email protected] | 2261e7b7 | 2011-07-12 13:43:55 | [diff] [blame] | 155 | void SetAppCacheService(ChromeAppCacheService* appcache_service); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 156 | virtual ChromeAppCacheService* GetAppCacheService(); |
[email protected] | 2f351cb | 2009-11-09 23:43:34 | [diff] [blame] | 157 | virtual webkit_database::DatabaseTracker* GetDatabaseTracker(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 158 | virtual VisitedLinkMaster* GetVisitedLinkMaster(); |
[email protected] | eaa7dd18 | 2010-12-14 11:09:00 | [diff] [blame] | 159 | virtual ExtensionService* GetExtensionService(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 160 | virtual UserScriptMaster* GetUserScriptMaster(); |
| 161 | virtual ExtensionDevToolsManager* GetExtensionDevToolsManager(); |
| 162 | virtual ExtensionProcessManager* GetExtensionProcessManager(); |
| 163 | virtual ExtensionMessageService* GetExtensionMessageService(); |
| 164 | virtual ExtensionEventRouter* GetExtensionEventRouter(); |
[email protected] | 2261e7b7 | 2011-07-12 13:43:55 | [diff] [blame] | 165 | void SetExtensionSpecialStoragePolicy( |
| 166 | ExtensionSpecialStoragePolicy* extension_special_storage_policy); |
[email protected] | 19eb8015 | 2011-02-26 00:28:43 | [diff] [blame] | 167 | virtual ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 168 | virtual SSLHostState* GetSSLHostState(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 169 | virtual FaviconService* GetFaviconService(ServiceAccessType access); |
| 170 | virtual HistoryService* GetHistoryService(ServiceAccessType access); |
| 171 | virtual HistoryService* GetHistoryServiceWithoutCreating(); |
[email protected] | 812b3a3 | 2010-01-08 05:36:04 | [diff] [blame] | 172 | // The CookieMonster will only be returned if a Context has been created. Do |
| 173 | // this by calling CreateRequestContext(). See the note at GetRequestContext |
| 174 | // for more information. |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 175 | net::CookieMonster* GetCookieMonster(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 176 | virtual AutocompleteClassifier* GetAutocompleteClassifier(); |
[email protected] | c620fd5 | 2011-07-22 18:33:29 | [diff] [blame] | 177 | virtual history::ShortcutsBackend* GetShortcutsBackend(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 178 | virtual WebDataService* GetWebDataService(ServiceAccessType access); |
| 179 | virtual WebDataService* GetWebDataServiceWithoutCreating(); |
| 180 | virtual PasswordStore* GetPasswordStore(ServiceAccessType access); |
[email protected] | 7e03e81 | 2010-11-15 23:01:01 | [diff] [blame] | 181 | // Sets the profile's PrefService. If a pref service hasn't been explicitly |
| 182 | // set GetPrefs creates one, so normally you need not invoke this. If you need |
| 183 | // to set a pref service you must invoke this before GetPrefs. |
| 184 | // TestingPrefService takes ownership of |prefs|. |
[email protected] | 2fb7dc98 | 2010-09-29 12:24:28 | [diff] [blame] | 185 | void SetPrefService(PrefService* prefs); |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 186 | virtual PrefService* GetPrefs(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 187 | virtual TemplateURLFetcher* GetTemplateURLFetcher(); |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 188 | virtual history::TopSites* GetTopSites(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 189 | virtual history::TopSites* GetTopSitesWithoutCreating(); |
| 190 | virtual DownloadManager* GetDownloadManager(); |
[email protected] | 397281f | 2011-02-14 05:15:53 | [diff] [blame] | 191 | virtual fileapi::FileSystemContext* GetFileSystemContext(); |
[email protected] | 9470417 | 2011-08-01 16:23:40 | [diff] [blame] | 192 | virtual void SetQuotaManager(quota::QuotaManager* manager); |
[email protected] | 595765c | 2011-04-27 13:20:14 | [diff] [blame] | 193 | virtual quota::QuotaManager* GetQuotaManager(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 194 | virtual bool HasCreatedDownloadManager() const; |
[email protected] | 812b3a3 | 2010-01-08 05:36:04 | [diff] [blame] | 195 | |
| 196 | // Returns a testing ContextGetter (if one has been created via |
| 197 | // CreateRequestContext) or NULL. This is not done on-demand for two reasons: |
| 198 | // (1) Some tests depend on GetRequestContext() returning NULL. (2) Because |
| 199 | // of the special memory management considerations for the |
| 200 | // TestURLRequestContextGetter class, many tests would find themseleves |
| 201 | // leaking if they called this method without the necessary IO thread. This |
| 202 | // getter is currently only capable of returning a Context that helps test |
| 203 | // the CookieMonster. See implementation comments for more details. |
[email protected] | abe2c03 | 2011-03-31 18:49:34 | [diff] [blame] | 204 | virtual net::URLRequestContextGetter* GetRequestContext(); |
[email protected] | da5683db | 2011-04-23 17:12:21 | [diff] [blame] | 205 | virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
| 206 | int renderer_child_id); |
[email protected] | 812b3a3 | 2010-01-08 05:36:04 | [diff] [blame] | 207 | void CreateRequestContext(); |
[email protected] | 7c89320 | 2010-10-07 20:18:02 | [diff] [blame] | 208 | // Clears out the created request context (which must be done before shutting |
| 209 | // down the IO thread to avoid leaks). |
| 210 | void ResetRequestContext(); |
[email protected] | 812b3a3 | 2010-01-08 05:36:04 | [diff] [blame] | 211 | |
[email protected] | abe2c03 | 2011-03-31 18:49:34 | [diff] [blame] | 212 | virtual net::URLRequestContextGetter* GetRequestContextForMedia(); |
| 213 | virtual net::URLRequestContextGetter* GetRequestContextForExtensions(); |
| 214 | virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( |
[email protected] | d969667 | 2011-03-15 22:45:09 | [diff] [blame] | 215 | const std::string& app_id); |
[email protected] | 812b3a3 | 2010-01-08 05:36:04 | [diff] [blame] | 216 | |
[email protected] | e89b77d | 2011-04-15 18:58:10 | [diff] [blame] | 217 | virtual const content::ResourceContext& GetResourceContext(); |
| 218 | |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 219 | virtual net::SSLConfigService* GetSSLConfigService(); |
| 220 | virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher(); |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 221 | virtual FindBarState* GetFindBarState(); |
| 222 | virtual HostContentSettingsMap* GetHostContentSettingsMap(); |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 223 | virtual GeolocationPermissionContext* GetGeolocationPermissionContext(); |
[email protected] | 8238dd6 | 2011-09-29 15:13:01 | [diff] [blame] | 224 | virtual SpeechInputPreferences* GetSpeechInputPreferences(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 225 | virtual HostZoomMap* GetHostZoomMap(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 226 | virtual bool HasProfileSyncService() const; |
| 227 | virtual std::wstring GetName(); |
[email protected] | 26743305 | 2009-10-02 00:20:06 | [diff] [blame] | 228 | virtual void SetName(const std::wstring& name) {} |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 229 | virtual std::wstring GetID(); |
| 230 | virtual void SetID(const std::wstring& id); |
[email protected] | ea6f7657 | 2008-12-18 00:09:55 | [diff] [blame] | 231 | void set_last_session_exited_cleanly(bool value) { |
| 232 | last_session_exited_cleanly_ = value; |
| 233 | } |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 234 | virtual bool DidLastSessionExitCleanly(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 235 | virtual void MergeResourceString(int message_id, |
[email protected] | 26743305 | 2009-10-02 00:20:06 | [diff] [blame] | 236 | std::wstring* output_string) {} |
| 237 | virtual void MergeResourceInteger(int message_id, int* output_value) {} |
| 238 | virtual void MergeResourceBoolean(int message_id, bool* output_value) {} |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 239 | virtual BookmarkModel* GetBookmarkModel(); |
| 240 | virtual bool IsSameProfile(Profile *p); |
| 241 | virtual base::Time GetStartTime() const; |
[email protected] | a6d36cc | 2011-02-23 00:39:48 | [diff] [blame] | 242 | virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 243 | virtual SpellCheckHost* GetSpellCheckHost(); |
[email protected] | 85c55dc | 2009-11-06 03:05:46 | [diff] [blame] | 244 | virtual void ReinitializeSpellCheckHost(bool force) { } |
[email protected] | dbbad7a | 2010-08-13 18:18:36 | [diff] [blame] | 245 | virtual WebKitContext* GetWebKitContext(); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 246 | virtual WebKitContext* GetOffTheRecordWebKitContext(); |
[email protected] | 26743305 | 2009-10-02 00:20:06 | [diff] [blame] | 247 | virtual void MarkAsCleanShutdown() {} |
[email protected] | 0436b10 | 2011-04-15 18:30:03 | [diff] [blame] | 248 | virtual void InitExtensions(bool extensions_enabled) {} |
[email protected] | 92c699d | 2011-02-18 17:54:48 | [diff] [blame] | 249 | virtual void InitPromoResources() {} |
[email protected] | a6d36cc | 2011-02-23 00:39:48 | [diff] [blame] | 250 | virtual void InitRegisteredProtocolHandlers() {} |
[email protected] | e8234d3 | 2010-09-09 20:36:39 | [diff] [blame] | 251 | |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 252 | virtual FilePath last_selected_directory(); |
| 253 | virtual void set_last_selected_directory(const FilePath& path); |
[email protected] | f50278cd | 2010-08-24 17:34:08 | [diff] [blame] | 254 | #if defined(OS_CHROMEOS) |
[email protected] | 62cb994 | 2010-12-01 13:09:32 | [diff] [blame] | 255 | virtual void SetupChromeOSEnterpriseExtensionObserver() { |
| 256 | } |
[email protected] | 45b6ccca | 2011-02-16 04:27:46 | [diff] [blame] | 257 | virtual void InitChromeOSPreferences() { |
| 258 | } |
[email protected] | 088a296 | 2011-01-26 12:58:42 | [diff] [blame] | 259 | virtual void ChangeAppLocale(const std::string&, AppLocaleChangedVia) { |
[email protected] | 61d68ef1 | 2011-01-13 14:02:56 | [diff] [blame] | 260 | } |
[email protected] | dc43d7f | 2011-03-04 16:37:26 | [diff] [blame] | 261 | virtual void OnLogin() { |
| 262 | } |
[email protected] | f50278cd | 2010-08-24 17:34:08 | [diff] [blame] | 263 | #endif // defined(OS_CHROMEOS) |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 264 | |
[email protected] | cc5bfd4 | 2010-11-24 14:44:02 | [diff] [blame] | 265 | virtual PrefProxyConfigTracker* GetProxyConfigTracker(); |
| 266 | |
[email protected] | 0bfc29a | 2009-04-27 16:15:44 | [diff] [blame] | 267 | // Schedules a task on the history backend and runs a nested loop until the |
| 268 | // task is processed. This has the effect of blocking the caller until the |
| 269 | // history service processes all pending requests. |
| 270 | void BlockUntilHistoryProcessesPendingRequests(); |
| 271 | |
[email protected] | 345a8b7 | 2009-09-29 09:11:44 | [diff] [blame] | 272 | // Creates and initializes a profile sync service if the tests require one. |
[email protected] | 8e4c2961 | 2010-07-14 01:24:45 | [diff] [blame] | 273 | virtual TokenService* GetTokenService(); |
[email protected] | 345a8b7 | 2009-09-29 09:11:44 | [diff] [blame] | 274 | virtual ProfileSyncService* GetProfileSyncService(); |
[email protected] | e8234d3 | 2010-09-09 20:36:39 | [diff] [blame] | 275 | virtual ProfileSyncService* GetProfileSyncService( |
| 276 | const std::string& cros_notes); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 277 | virtual ChromeBlobStorageContext* GetBlobStorageContext(); |
| 278 | virtual ExtensionInfoMap* GetExtensionInfoMap(); |
| 279 | virtual PromoCounter* GetInstantPromoCounter(); |
[email protected] | 248ce19 | 2011-02-10 15:26:34 | [diff] [blame] | 280 | virtual ChromeURLDataManager* GetChromeURLDataManager(); |
[email protected] | 8382d8c | 2011-09-15 03:43:17 | [diff] [blame] | 281 | virtual chrome_browser_net::Predictor* GetNetworkPredictor(); |
[email protected] | 02896a8 | 2011-09-21 18:54:32 | [diff] [blame] | 282 | virtual void DeleteTransportSecurityStateSince(base::Time time); |
[email protected] | fadc607b6 | 2011-02-07 17:55:50 | [diff] [blame] | 283 | virtual PrefService* GetOffTheRecordPrefs(); |
[email protected] | 22339b1 | 2010-08-27 18:29:24 | [diff] [blame] | 284 | |
[email protected] | 36fb2c7c | 2011-04-04 15:49:08 | [diff] [blame] | 285 | // TODO(jam): remove me once webkit_context_unittest.cc doesn't use Profile |
| 286 | // and gets the quota::SpecialStoragePolicy* from whatever ends up replacing |
| 287 | // it in the content module. |
| 288 | quota::SpecialStoragePolicy* GetSpecialStoragePolicy(); |
| 289 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 290 | protected: |
[email protected] | e1acf6f | 2008-10-27 20:43:33 | [diff] [blame] | 291 | base::Time start_time_; |
[email protected] | 2fb7dc98 | 2010-09-29 12:24:28 | [diff] [blame] | 292 | scoped_ptr<PrefService> prefs_; |
| 293 | // ref only for right type, lifecycle is managed by prefs_ |
| 294 | TestingPrefService* testing_prefs_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 295 | |
| 296 | private: |
[email protected] | d7e601b | 2011-09-14 19:13:53 | [diff] [blame] | 297 | virtual void SetDownloadManagerDelegate( |
| 298 | ChromeDownloadManagerDelegate* delegate); |
| 299 | |
[email protected] | 49a2563 | 2011-08-31 17:03:48 | [diff] [blame] | 300 | // Common initialization between the two constructors. |
| 301 | void Init(); |
| 302 | |
[email protected] | d2879af | 2010-02-08 16:02:56 | [diff] [blame] | 303 | // Destroys favicon service if it has been created. |
| 304 | void DestroyFaviconService(); |
| 305 | |
[email protected] | 2609bc1 | 2010-01-24 08:32:55 | [diff] [blame] | 306 | // If the webdata service has been created, it is destroyed. This is invoked |
| 307 | // from the destructor. |
| 308 | void DestroyWebDataService(); |
| 309 | |
[email protected] | 73c4793 | 2010-12-06 18:13:43 | [diff] [blame] | 310 | // Creates a TestingPrefService and associates it with the TestingProfile. |
[email protected] | 2fb7dc98 | 2010-09-29 12:24:28 | [diff] [blame] | 311 | void CreateTestingPrefService(); |
| 312 | |
[email protected] | d2879af | 2010-02-08 16:02:56 | [diff] [blame] | 313 | // The favicon service. Only created if CreateFaviconService is invoked. |
[email protected] | 04732c0e | 2011-09-16 13:21:53 | [diff] [blame] | 314 | scoped_ptr<FaviconService> favicon_service_; |
[email protected] | d2879af | 2010-02-08 16:02:56 | [diff] [blame] | 315 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 316 | // The history service. Only created if CreateHistoryService is invoked. |
| 317 | scoped_refptr<HistoryService> history_service_; |
[email protected] | 4d0cd7ce | 2008-08-11 16:40:57 | [diff] [blame] | 318 | |
[email protected] | d8e41ed | 2008-09-11 15:22:32 | [diff] [blame] | 319 | // The BookmarkModel. Only created if CreateBookmarkModel is invoked. |
| 320 | scoped_ptr<BookmarkModel> bookmark_bar_model_; |
[email protected] | 4d0cd7ce | 2008-08-11 16:40:57 | [diff] [blame] | 321 | |
[email protected] | a6d36cc | 2011-02-23 00:39:48 | [diff] [blame] | 322 | // The ProtocolHandlerRegistry. Only created if CreateProtocolHandlerRegistry |
| 323 | // is invoked. |
| 324 | scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; |
| 325 | |
[email protected] | 8e4c2961 | 2010-07-14 01:24:45 | [diff] [blame] | 326 | // The TokenService. Created by CreateTokenService. Filled with dummy data. |
| 327 | scoped_ptr<TokenService> token_service_; |
| 328 | |
[email protected] | 345a8b7 | 2009-09-29 09:11:44 | [diff] [blame] | 329 | // The ProfileSyncService. Created by CreateProfileSyncService. |
[email protected] | 345a8b7 | 2009-09-29 09:11:44 | [diff] [blame] | 330 | scoped_ptr<ProfileSyncService> profile_sync_service_; |
[email protected] | 345a8b7 | 2009-09-29 09:11:44 | [diff] [blame] | 331 | |
[email protected] | 69c579e | 2010-04-23 20:01:00 | [diff] [blame] | 332 | // The AutocompleteClassifier. Only created if CreateAutocompleteClassifier |
| 333 | // is invoked. |
| 334 | scoped_ptr<AutocompleteClassifier> autocomplete_classifier_; |
| 335 | |
[email protected] | 2609bc1 | 2010-01-24 08:32:55 | [diff] [blame] | 336 | // The WebDataService. Only created if CreateWebDataService is invoked. |
| 337 | scoped_refptr<WebDataService> web_data_service_; |
| 338 | |
[email protected] | fb9d1f4 | 2010-10-06 23:17:59 | [diff] [blame] | 339 | // The TemplateURLFetcher. Only created if CreateTemplateURLFetcher is |
| 340 | // invoked. |
| 341 | scoped_ptr<TemplateURLFetcher> template_url_fetcher_; |
| 342 | |
[email protected] | 812b3a3 | 2010-01-08 05:36:04 | [diff] [blame] | 343 | // Internally, this is a TestURLRequestContextGetter that creates a dummy |
| 344 | // request context. Currently, only the CookieMonster is hooked up. |
[email protected] | abe2c03 | 2011-03-31 18:49:34 | [diff] [blame] | 345 | scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 346 | scoped_refptr<net::URLRequestContextGetter> extensions_request_context_; |
[email protected] | 812b3a3 | 2010-01-08 05:36:04 | [diff] [blame] | 347 | |
[email protected] | 848cd05e | 2008-09-19 18:33:48 | [diff] [blame] | 348 | std::wstring id_; |
[email protected] | 151e7e7 | 2008-10-16 15:43:12 | [diff] [blame] | 349 | |
[email protected] | 5bb2f52 | 2011-03-25 19:04:44 | [diff] [blame] | 350 | bool incognito_; |
| 351 | scoped_ptr<Profile> incognito_profile_; |
[email protected] | ea6f7657 | 2008-12-18 00:09:55 | [diff] [blame] | 352 | |
| 353 | // Did the last session exit cleanly? Default is true. |
| 354 | bool last_session_exited_cleanly_; |
[email protected] | 2f351cb | 2009-11-09 23:43:34 | [diff] [blame] | 355 | |
[email protected] | cdba4699 | 2011-06-07 11:51:39 | [diff] [blame] | 356 | // FileSystemContext. Created lazily by GetFileSystemContext(). |
| 357 | scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
[email protected] | 4e6419c | 2010-01-15 04:50:34 | [diff] [blame] | 358 | |
| 359 | // WebKitContext, lazily initialized by GetWebKitContext(). |
| 360 | scoped_refptr<WebKitContext> webkit_context_; |
[email protected] | e284e6d8 | 2010-01-29 19:49:45 | [diff] [blame] | 361 | |
[email protected] | cdba4699 | 2011-06-07 11:51:39 | [diff] [blame] | 362 | // The main database tracker for this profile. |
| 363 | // Should be used only on the file thread. |
| 364 | scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; |
| 365 | |
[email protected] | 08bc630 | 2010-01-30 02:53:39 | [diff] [blame] | 366 | scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |
[email protected] | 8b4b84ee | 2010-05-11 13:08:52 | [diff] [blame] | 367 | scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_; |
[email protected] | e5d2f713 | 2010-04-09 18:13:53 | [diff] [blame] | 368 | |
[email protected] | 8238dd6 | 2011-09-29 15:13:01 | [diff] [blame] | 369 | scoped_refptr<SpeechInputPreferences> speech_input_preferences_; |
| 370 | |
[email protected] | e5d2f713 | 2010-04-09 18:13:53 | [diff] [blame] | 371 | // Find bar state. Created lazily by GetFindBarState(). |
| 372 | scoped_ptr<FindBarState> find_bar_state_; |
[email protected] | 35896a3 | 2010-06-09 08:42:51 | [diff] [blame] | 373 | |
| 374 | FilePath last_selected_directory_; |
[email protected] | 9ba20809 | 2010-08-10 20:02:08 | [diff] [blame] | 375 | scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. |
[email protected] | f9dec948 | 2010-08-20 20:42:19 | [diff] [blame] | 376 | |
[email protected] | eaa7dd18 | 2010-12-14 11:09:00 | [diff] [blame] | 377 | // The Extension Preferences. Only created if CreateExtensionService is |
[email protected] | 73c4793 | 2010-12-06 18:13:43 | [diff] [blame] | 378 | // invoked. |
| 379 | scoped_ptr<ExtensionPrefs> extension_prefs_; |
| 380 | |
[email protected] | 14908b7 | 2011-04-20 06:54:36 | [diff] [blame] | 381 | scoped_ptr<ExtensionService> extension_service_; |
[email protected] | 2fb7dc98 | 2010-09-29 12:24:28 | [diff] [blame] | 382 | |
[email protected] | 9a8c402 | 2011-01-25 14:25:33 | [diff] [blame] | 383 | scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
| 384 | |
[email protected] | 19eb8015 | 2011-02-26 00:28:43 | [diff] [blame] | 385 | scoped_refptr<ExtensionSpecialStoragePolicy> |
| 386 | extension_special_storage_policy_; |
| 387 | |
[email protected] | cc5bfd4 | 2010-11-24 14:44:02 | [diff] [blame] | 388 | // The proxy prefs tracker. |
| 389 | scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| 390 | |
[email protected] | 49a2563 | 2011-08-31 17:03:48 | [diff] [blame] | 391 | // We use a temporary directory to store testing profile data. In a multi- |
| 392 | // profile environment, this is invalid and the directory is managed by the |
| 393 | // TestingProfileManager. |
[email protected] | 9ba20809 | 2010-08-10 20:02:08 | [diff] [blame] | 394 | ScopedTempDir temp_dir_; |
[email protected] | 49a2563 | 2011-08-31 17:03:48 | [diff] [blame] | 395 | // The path to this profile. This will be valid in either of the two above |
| 396 | // cases. |
| 397 | FilePath profile_path_; |
[email protected] | 248ce19 | 2011-02-10 15:26:34 | [diff] [blame] | 398 | |
| 399 | scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_; |
[email protected] | 4850a7f | 2011-03-08 23:36:59 | [diff] [blame] | 400 | |
[email protected] | 5cdcd15 | 2011-03-31 22:48:52 | [diff] [blame] | 401 | // We keep a weak pointer to the dependency manager we want to notify on our |
| 402 | // death. Defaults to the Singleton implementation but overridable for |
| 403 | // testing. |
| 404 | ProfileDependencyManager* profile_dependency_manager_; |
[email protected] | 2261e7b7 | 2011-07-12 13:43:55 | [diff] [blame] | 405 | |
| 406 | scoped_refptr<ChromeAppCacheService> appcache_service_; |
[email protected] | 9470417 | 2011-08-01 16:23:40 | [diff] [blame] | 407 | |
| 408 | // The QuotaManager, only available if set explicitly via SetQuotaManager. |
| 409 | scoped_refptr<quota::QuotaManager> quota_manager_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 410 | }; |
| 411 | |
[email protected] | a4ff9eae | 2011-08-01 19:58:16 | [diff] [blame] | 412 | #endif // CHROME_TEST_BASE_TESTING_PROFILE_H_ |