| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TESTING_PROFILE_H_ | 5 #ifndef CHROME_TEST_TESTING_PROFILE_H_ |
| 6 #define CHROME_TEST_TESTING_PROFILE_H_ | 6 #define CHROME_TEST_TESTING_PROFILE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
| 12 #include "base/timer.h" | 12 #include "base/timer.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 | 14 |
| 15 namespace history { | 15 namespace history { |
| 16 class TopSites; | 16 class TopSites; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 class CookieMonster; | 20 class CookieMonster; |
| 21 } | 21 } |
| 22 | 22 |
| 23 class AutocompleteClassifier; | 23 class AutocompleteClassifier; |
| 24 class BookmarkModel; | 24 class BookmarkModel; |
| 25 class BrowserThemeProvider; | 25 class BrowserThemeProvider; |
| 26 class CommandLine; | 26 class CommandLine; |
| 27 class DesktopNotificationService; | 27 class DesktopNotificationService; |
| 28 class ExtensionPrefs; |
| 28 class ExtensionPrefStore; | 29 class ExtensionPrefStore; |
| 29 class ExtensionPrefs; | 30 class ExtensionPrefValueMap; |
| 30 class FaviconService; | 31 class FaviconService; |
| 31 class FindBarState; | 32 class FindBarState; |
| 32 class GeolocationContentSettingsMap; | 33 class GeolocationContentSettingsMap; |
| 33 class GeolocationPermissionContext; | 34 class GeolocationPermissionContext; |
| 34 class HistoryService; | 35 class HistoryService; |
| 35 class HostContentSettingsMap; | 36 class HostContentSettingsMap; |
| 36 class PrefService; | 37 class PrefService; |
| 37 class ProfileSyncService; | 38 class ProfileSyncService; |
| 38 class SessionService; | 39 class SessionService; |
| 39 class TemplateURLModel; | 40 class TemplateURLModel; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 void SetTemplateURLModel(TemplateURLModel* model); | 109 void SetTemplateURLModel(TemplateURLModel* model); |
| 109 | 110 |
| 110 // Uses a specific theme provider for this profile. TestingProfile takes | 111 // Uses a specific theme provider for this profile. TestingProfile takes |
| 111 // ownership of |theme_provider|. | 112 // ownership of |theme_provider|. |
| 112 void UseThemeProvider(BrowserThemeProvider* theme_provider); | 113 void UseThemeProvider(BrowserThemeProvider* theme_provider); |
| 113 | 114 |
| 114 // Creates an ExtensionService initialized with the testing profile and | 115 // Creates an ExtensionService initialized with the testing profile and |
| 115 // returns it. The profile keeps its own copy of a scoped_refptr to the | 116 // returns it. The profile keeps its own copy of a scoped_refptr to the |
| 116 // ExtensionService to make sure that is still alive to be notified when the | 117 // ExtensionService to make sure that is still alive to be notified when the |
| 117 // profile is destroyed. | 118 // profile is destroyed. |
| 118 scoped_refptr<ExtensionService> CreateExtensionService( | 119 ExtensionService* CreateExtensionService(const CommandLine* command_line, |
| 119 const CommandLine* command_line, | 120 const FilePath& install_directory); |
| 120 const FilePath& install_directory); | |
| 121 | 121 |
| 122 TestingPrefService* GetTestingPrefService(); | 122 TestingPrefService* GetTestingPrefService(); |
| 123 | 123 |
| 124 virtual ProfileId GetRuntimeId() { | 124 virtual ProfileId GetRuntimeId() { |
| 125 return reinterpret_cast<ProfileId>(this); | 125 return reinterpret_cast<ProfileId>(this); |
| 126 } | 126 } |
| 127 | 127 |
| 128 virtual FilePath GetPath(); | 128 virtual FilePath GetPath(); |
| 129 | 129 |
| 130 // Sets whether we're off the record. Default is false. | 130 // Sets whether we're off the record. Default is false. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 virtual ProfileSyncService* GetProfileSyncService( | 315 virtual ProfileSyncService* GetProfileSyncService( |
| 316 const std::string& cros_notes); | 316 const std::string& cros_notes); |
| 317 virtual CloudPrintProxyService* GetCloudPrintProxyService() { return NULL; } | 317 virtual CloudPrintProxyService* GetCloudPrintProxyService() { return NULL; } |
| 318 virtual ChromeBlobStorageContext* GetBlobStorageContext() { return NULL; } | 318 virtual ChromeBlobStorageContext* GetBlobStorageContext() { return NULL; } |
| 319 virtual ExtensionInfoMap* GetExtensionInfoMap() { return NULL; } | 319 virtual ExtensionInfoMap* GetExtensionInfoMap() { return NULL; } |
| 320 virtual PromoCounter* GetInstantPromoCounter() { return NULL; } | 320 virtual PromoCounter* GetInstantPromoCounter() { return NULL; } |
| 321 virtual policy::ProfilePolicyContext* GetPolicyContext() { return NULL; } | 321 virtual policy::ProfilePolicyContext* GetPolicyContext() { return NULL; } |
| 322 virtual PrerenderManager* GetPrerenderManager() { return NULL; } | 322 virtual PrerenderManager* GetPrerenderManager() { return NULL; } |
| 323 | 323 |
| 324 protected: | 324 protected: |
| 325 virtual ExtensionPrefValueMap* GetExtensionPrefValueMap() { |
| 326 return extension_pref_value_map_.get(); |
| 327 } |
| 328 |
| 325 base::Time start_time_; | 329 base::Time start_time_; |
| 326 scoped_ptr<PrefService> prefs_; | 330 scoped_ptr<PrefService> prefs_; |
| 327 // ref only for right type, lifecycle is managed by prefs_ | 331 // ref only for right type, lifecycle is managed by prefs_ |
| 328 TestingPrefService* testing_prefs_; | 332 TestingPrefService* testing_prefs_; |
| 329 | 333 |
| 330 private: | 334 private: |
| 331 // Destroys favicon service if it has been created. | 335 // Destroys favicon service if it has been created. |
| 332 void DestroyFaviconService(); | 336 void DestroyFaviconService(); |
| 333 | 337 |
| 334 // If the webdata service has been created, it is destroyed. This is invoked | 338 // If the webdata service has been created, it is destroyed. This is invoked |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 geolocation_content_settings_map_; | 408 geolocation_content_settings_map_; |
| 405 scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_; | 409 scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_; |
| 406 scoped_ptr<DesktopNotificationService> desktop_notification_service_; | 410 scoped_ptr<DesktopNotificationService> desktop_notification_service_; |
| 407 | 411 |
| 408 // Find bar state. Created lazily by GetFindBarState(). | 412 // Find bar state. Created lazily by GetFindBarState(). |
| 409 scoped_ptr<FindBarState> find_bar_state_; | 413 scoped_ptr<FindBarState> find_bar_state_; |
| 410 | 414 |
| 411 FilePath last_selected_directory_; | 415 FilePath last_selected_directory_; |
| 412 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. | 416 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. |
| 413 | 417 |
| 414 // Extension pref store, created for use by |extension_prefs_|. | |
| 415 scoped_ptr<ExtensionPrefStore> extension_pref_store_; | |
| 416 | |
| 417 // The Extension Preferences. Only created if CreateExtensionService is | 418 // The Extension Preferences. Only created if CreateExtensionService is |
| 418 // invoked. | 419 // invoked. |
| 419 scoped_ptr<ExtensionPrefs> extension_prefs_; | 420 scoped_ptr<ExtensionPrefs> extension_prefs_; |
| 420 | 421 |
| 421 // For properly notifying the ExtensionService when the profile | 422 // For properly notifying the ExtensionService when the profile |
| 422 // is disposed. | 423 // is disposed. |
| 423 scoped_refptr<ExtensionService> extensions_service_; | 424 scoped_refptr<ExtensionService> extensions_service_; |
| 424 | 425 |
| 426 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
| 427 |
| 425 // The proxy prefs tracker. | 428 // The proxy prefs tracker. |
| 426 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 429 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| 427 | 430 |
| 428 // We use a temporary directory to store testing profile data. | 431 // We use a temporary directory to store testing profile data. |
| 429 ScopedTempDir temp_dir_; | 432 ScopedTempDir temp_dir_; |
| 430 }; | 433 }; |
| 431 | 434 |
| 432 // A profile that derives from another profile. This does not actually | 435 // A profile that derives from another profile. This does not actually |
| 433 // override anything except the GetRuntimeId() in order to test sharing of | 436 // override anything except the GetRuntimeId() in order to test sharing of |
| 434 // site information. | 437 // site information. |
| 435 class DerivedTestingProfile : public TestingProfile { | 438 class DerivedTestingProfile : public TestingProfile { |
| 436 public: | 439 public: |
| 437 explicit DerivedTestingProfile(Profile* profile) | 440 explicit DerivedTestingProfile(Profile* profile) |
| 438 : original_profile_(profile) {} | 441 : original_profile_(profile) {} |
| 439 | 442 |
| 440 virtual ProfileId GetRuntimeId() { | 443 virtual ProfileId GetRuntimeId() { |
| 441 return original_profile_->GetRuntimeId(); | 444 return original_profile_->GetRuntimeId(); |
| 442 } | 445 } |
| 443 | 446 |
| 444 protected: | 447 protected: |
| 445 Profile* original_profile_; | 448 Profile* original_profile_; |
| 446 }; | 449 }; |
| 447 | 450 |
| 448 #endif // CHROME_TEST_TESTING_PROFILE_H_ | 451 #endif // CHROME_TEST_TESTING_PROFILE_H_ |
| OLD | NEW |