| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  125   // TemplateURLFetcher is NULL. |  125   // TemplateURLFetcher is NULL. | 
|  126   void CreateTemplateURLFetcher(); |  126   void CreateTemplateURLFetcher(); | 
|  127  |  127  | 
|  128   // Creates a TemplateURLService. If not invoked, the TemplateURLService is |  128   // Creates a TemplateURLService. If not invoked, the TemplateURLService is | 
|  129   // NULL. |  129   // NULL. | 
|  130   void CreateTemplateURLService(); |  130   void CreateTemplateURLService(); | 
|  131  |  131  | 
|  132   // Blocks until TempalteURLService finishes loading. |  132   // Blocks until TempalteURLService finishes loading. | 
|  133   void BlockUntilTemplateURLServiceLoaded(); |  133   void BlockUntilTemplateURLServiceLoaded(); | 
|  134  |  134  | 
|  135   // Creates an ExtensionProcessManager. If not invoked, the |  | 
|  136   // ExtensionProcessManager is NULL. |  | 
|  137   void CreateExtensionProcessManager(); |  | 
|  138  |  | 
|  139   // Creates an ExtensionService initialized with the testing profile and |  | 
|  140   // returns it. The profile keeps its own copy of a scoped_refptr to the |  | 
|  141   // ExtensionService to make sure that is still alive to be notified when the |  | 
|  142   // profile is destroyed. |  | 
|  143   ExtensionService* CreateExtensionService(const CommandLine* command_line, |  | 
|  144                                            const FilePath& install_directory, |  | 
|  145                                            bool autoupdate_enabled); |  | 
|  146  |  | 
|  147   TestingPrefService* GetTestingPrefService(); |  135   TestingPrefService* GetTestingPrefService(); | 
|  148  |  136  | 
|  149   // content::BrowserContext |  137   // content::BrowserContext | 
|  150   virtual FilePath GetPath() OVERRIDE; |  138   virtual FilePath GetPath() OVERRIDE; | 
|  151   virtual bool IsOffTheRecord() const OVERRIDE; |  139   virtual bool IsOffTheRecord() const OVERRIDE; | 
|  152   virtual content::DownloadManager* GetDownloadManager() OVERRIDE; |  140   virtual content::DownloadManager* GetDownloadManager() OVERRIDE; | 
|  153   // Returns a testing ContextGetter (if one has been created via |  141   // Returns a testing ContextGetter (if one has been created via | 
|  154   // CreateRequestContext) or NULL. This is not done on-demand for two reasons: |  142   // CreateRequestContext) or NULL. This is not done on-demand for two reasons: | 
|  155   // (1) Some tests depend on GetRequestContext() returning NULL. (2) Because |  143   // (1) Some tests depend on GetRequestContext() returning NULL. (2) Because | 
|  156   // of the special memory management considerations for the |  144   // of the special memory management considerations for the | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
|  173   virtual std::string GetProfileName() OVERRIDE; |  161   virtual std::string GetProfileName() OVERRIDE; | 
|  174   void set_incognito(bool incognito) { incognito_ = incognito; } |  162   void set_incognito(bool incognito) { incognito_ = incognito; } | 
|  175   // Assumes ownership. |  163   // Assumes ownership. | 
|  176   virtual void SetOffTheRecordProfile(Profile* profile); |  164   virtual void SetOffTheRecordProfile(Profile* profile); | 
|  177   virtual Profile* GetOffTheRecordProfile() OVERRIDE; |  165   virtual Profile* GetOffTheRecordProfile() OVERRIDE; | 
|  178   virtual void DestroyOffTheRecordProfile() OVERRIDE {} |  166   virtual void DestroyOffTheRecordProfile() OVERRIDE {} | 
|  179   virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; |  167   virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; | 
|  180   virtual bool HasOffTheRecordProfile() OVERRIDE; |  168   virtual bool HasOffTheRecordProfile() OVERRIDE; | 
|  181   virtual Profile* GetOriginalProfile() OVERRIDE; |  169   virtual Profile* GetOriginalProfile() OVERRIDE; | 
|  182   virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE; |  170   virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE; | 
 |  171   virtual ExtensionPrefValueMap* GetExtensionPrefValueMap() OVERRIDE; | 
|  183   virtual ExtensionService* GetExtensionService() OVERRIDE; |  172   virtual ExtensionService* GetExtensionService() OVERRIDE; | 
|  184   virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE; |  173   virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE; | 
|  185   virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() OVERRIDE; |  | 
|  186   virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE; |  174   virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE; | 
|  187   virtual ExtensionMessageService* GetExtensionMessageService() OVERRIDE; |  | 
|  188   virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; |  175   virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; | 
|  189   void SetExtensionSpecialStoragePolicy( |  176   void SetExtensionSpecialStoragePolicy( | 
|  190       ExtensionSpecialStoragePolicy* extension_special_storage_policy); |  177       ExtensionSpecialStoragePolicy* extension_special_storage_policy); | 
|  191   virtual ExtensionSpecialStoragePolicy* |  178   virtual ExtensionSpecialStoragePolicy* | 
|  192       GetExtensionSpecialStoragePolicy() OVERRIDE; |  179       GetExtensionSpecialStoragePolicy() OVERRIDE; | 
|  193   virtual LazyBackgroundTaskQueue* GetLazyBackgroundTaskQueue() OVERRIDE; |  | 
|  194   virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; |  180   virtual FaviconService* GetFaviconService(ServiceAccessType access) OVERRIDE; | 
|  195   virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; |  181   virtual HistoryService* GetHistoryService(ServiceAccessType access) OVERRIDE; | 
|  196   virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; |  182   virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; | 
|  197   // The CookieMonster will only be returned if a Context has been created. Do |  183   // The CookieMonster will only be returned if a Context has been created. Do | 
|  198   // this by calling CreateRequestContext(). See the note at GetRequestContext |  184   // this by calling CreateRequestContext(). See the note at GetRequestContext | 
|  199   // for more information. |  185   // for more information. | 
|  200   net::CookieMonster* GetCookieMonster(); |  186   net::CookieMonster* GetCookieMonster(); | 
|  201   virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; |  187   virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; | 
|  202   virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; |  188   virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; | 
|  203   virtual WebDataService* GetWebDataService(ServiceAccessType access) OVERRIDE; |  189   virtual WebDataService* GetWebDataService(ServiceAccessType access) OVERRIDE; | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|  234   } |  220   } | 
|  235   virtual void MergeResourceString(int message_id, |  221   virtual void MergeResourceString(int message_id, | 
|  236                                    std::wstring* output_string) {} |  222                                    std::wstring* output_string) {} | 
|  237   virtual void MergeResourceInteger(int message_id, int* output_value) {} |  223   virtual void MergeResourceInteger(int message_id, int* output_value) {} | 
|  238   virtual void MergeResourceBoolean(int message_id, bool* output_value) {} |  224   virtual void MergeResourceBoolean(int message_id, bool* output_value) {} | 
|  239   virtual BookmarkModel* GetBookmarkModel() OVERRIDE; |  225   virtual BookmarkModel* GetBookmarkModel() OVERRIDE; | 
|  240   virtual bool IsSameProfile(Profile *p) OVERRIDE; |  226   virtual bool IsSameProfile(Profile *p) OVERRIDE; | 
|  241   virtual base::Time GetStartTime() const OVERRIDE; |  227   virtual base::Time GetStartTime() const OVERRIDE; | 
|  242   virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; |  228   virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; | 
|  243   virtual void MarkAsCleanShutdown() OVERRIDE {} |  229   virtual void MarkAsCleanShutdown() OVERRIDE {} | 
|  244   virtual void InitExtensions(bool extensions_enabled) OVERRIDE {} |  | 
|  245   virtual void InitPromoResources() OVERRIDE {} |  230   virtual void InitPromoResources() OVERRIDE {} | 
|  246   virtual void InitRegisteredProtocolHandlers() OVERRIDE {} |  231   virtual void InitRegisteredProtocolHandlers() OVERRIDE {} | 
|  247  |  232  | 
|  248   virtual FilePath last_selected_directory() OVERRIDE; |  233   virtual FilePath last_selected_directory() OVERRIDE; | 
|  249   virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; |  234   virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; | 
|  250   virtual bool WasCreatedByVersionOrLater(const std::string& version) OVERRIDE; |  235   virtual bool WasCreatedByVersionOrLater(const std::string& version) OVERRIDE; | 
|  251 #if defined(OS_CHROMEOS) |  236 #if defined(OS_CHROMEOS) | 
|  252   virtual void SetupChromeOSEnterpriseExtensionObserver() OVERRIDE { |  237   virtual void SetupChromeOSEnterpriseExtensionObserver() OVERRIDE { | 
|  253   } |  238   } | 
|  254   virtual void InitChromeOSPreferences() OVERRIDE { |  239   virtual void InitChromeOSPreferences() OVERRIDE { | 
|  255   } |  240   } | 
|  256   virtual void ChangeAppLocale(const std::string&, |  241   virtual void ChangeAppLocale(const std::string&, | 
|  257                                AppLocaleChangedVia) OVERRIDE { |  242                                AppLocaleChangedVia) OVERRIDE { | 
|  258   } |  243   } | 
|  259   virtual void OnLogin() OVERRIDE { |  244   virtual void OnLogin() OVERRIDE { | 
|  260   } |  245   } | 
|  261 #endif  // defined(OS_CHROMEOS) |  246 #endif  // defined(OS_CHROMEOS) | 
|  262  |  247  | 
|  263   virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; |  248   virtual PrefProxyConfigTracker* GetProxyConfigTracker() OVERRIDE; | 
|  264  |  249  | 
|  265   // Schedules a task on the history backend and runs a nested loop until the |  250   // Schedules a task on the history backend and runs a nested loop until the | 
|  266   // task is processed.  This has the effect of blocking the caller until the |  251   // task is processed.  This has the effect of blocking the caller until the | 
|  267   // history service processes all pending requests. |  252   // history service processes all pending requests. | 
|  268   void BlockUntilHistoryProcessesPendingRequests(); |  253   void BlockUntilHistoryProcessesPendingRequests(); | 
|  269  |  254  | 
|  270   virtual ExtensionInfoMap* GetExtensionInfoMap() OVERRIDE; |  | 
|  271   virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; |  255   virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; | 
|  272   virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; |  256   virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; | 
|  273   virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; |  257   virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; | 
|  274   virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; |  258   virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; | 
|  275   virtual GURL GetHomePage() OVERRIDE; |  259   virtual GURL GetHomePage() OVERRIDE; | 
|  276  |  260  | 
|  277   virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; |  261   virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; | 
|  278  |  262  | 
|  279  protected: |  263  protected: | 
|  280   base::Time start_time_; |  264   base::Time start_time_; | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  342   scoped_refptr<HostContentSettingsMap> host_content_settings_map_; |  326   scoped_refptr<HostContentSettingsMap> host_content_settings_map_; | 
|  343   scoped_refptr<content::GeolocationPermissionContext> |  327   scoped_refptr<content::GeolocationPermissionContext> | 
|  344       geolocation_permission_context_; |  328       geolocation_permission_context_; | 
|  345  |  329  | 
|  346   scoped_refptr<content::SpeechRecognitionPreferences> |  330   scoped_refptr<content::SpeechRecognitionPreferences> | 
|  347       speech_recognition_preferences_; |  331       speech_recognition_preferences_; | 
|  348  |  332  | 
|  349   FilePath last_selected_directory_; |  333   FilePath last_selected_directory_; | 
|  350   scoped_refptr<history::TopSites> top_sites_;  // For history and thumbnails. |  334   scoped_refptr<history::TopSites> top_sites_;  // For history and thumbnails. | 
|  351  |  335  | 
|  352   // The Extension Preferences. Only created if CreateExtensionService is |  | 
|  353   // invoked. |  | 
|  354   scoped_ptr<ExtensionPrefs> extension_prefs_; |  | 
|  355  |  | 
|  356   scoped_ptr<ExtensionService> extension_service_; |  | 
|  357  |  | 
|  358   scoped_ptr<ExtensionProcessManager> extension_process_manager_; |  | 
|  359  |  | 
|  360   scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |  | 
|  361  |  | 
|  362   scoped_refptr<ExtensionSpecialStoragePolicy> |  336   scoped_refptr<ExtensionSpecialStoragePolicy> | 
|  363       extension_special_storage_policy_; |  337       extension_special_storage_policy_; | 
|  364  |  338  | 
|  365   // The proxy prefs tracker. |  339   // The proxy prefs tracker. | 
|  366   scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |  340   scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 
|  367  |  341  | 
|  368   // We use a temporary directory to store testing profile data. In a multi- |  342   // We use a temporary directory to store testing profile data. In a multi- | 
|  369   // profile environment, this is invalid and the directory is managed by the |  343   // profile environment, this is invalid and the directory is managed by the | 
|  370   // TestingProfileManager. |  344   // TestingProfileManager. | 
|  371   ScopedTempDir temp_dir_; |  345   ScopedTempDir temp_dir_; | 
|  372   // The path to this profile. This will be valid in either of the two above |  346   // The path to this profile. This will be valid in either of the two above | 
|  373   // cases. |  347   // cases. | 
|  374   FilePath profile_path_; |  348   FilePath profile_path_; | 
|  375  |  349  | 
|  376   scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_; |  350   scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_; | 
|  377  |  351  | 
|  378   // We keep a weak pointer to the dependency manager we want to notify on our |  352   // We keep a weak pointer to the dependency manager we want to notify on our | 
|  379   // death. Defaults to the Singleton implementation but overridable for |  353   // death. Defaults to the Singleton implementation but overridable for | 
|  380   // testing. |  354   // testing. | 
|  381   ProfileDependencyManager* profile_dependency_manager_; |  355   ProfileDependencyManager* profile_dependency_manager_; | 
|  382  |  356  | 
|  383   scoped_ptr<content::MockResourceContext> resource_context_; |  357   scoped_ptr<content::MockResourceContext> resource_context_; | 
|  384  |  358  | 
|  385   // Weak pointer to a delegate for indicating that a profile was created. |  359   // Weak pointer to a delegate for indicating that a profile was created. | 
|  386   Delegate* delegate_; |  360   Delegate* delegate_; | 
|  387 }; |  361 }; | 
|  388  |  362  | 
|  389 #endif  // CHROME_TEST_BASE_TESTING_PROFILE_H_ |  363 #endif  // CHROME_TEST_BASE_TESTING_PROFILE_H_ | 
| OLD | NEW |