| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 geolocation_content_settings_map_; | 402 geolocation_content_settings_map_; |
| 403 scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_; | 403 scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_; |
| 404 scoped_ptr<DesktopNotificationService> desktop_notification_service_; | 404 scoped_ptr<DesktopNotificationService> desktop_notification_service_; |
| 405 | 405 |
| 406 // Find bar state. Created lazily by GetFindBarState(). | 406 // Find bar state. Created lazily by GetFindBarState(). |
| 407 scoped_ptr<FindBarState> find_bar_state_; | 407 scoped_ptr<FindBarState> find_bar_state_; |
| 408 | 408 |
| 409 FilePath last_selected_directory_; | 409 FilePath last_selected_directory_; |
| 410 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. | 410 scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails. |
| 411 | 411 |
| 412 // Extension pref store, created for use by |extension_prefs_|. | |
| 413 scoped_ptr<ExtensionPrefStore> extension_pref_store_; | |
| 414 | |
| 415 // The Extension Preferences. Only created if CreateExtensionService is | 412 // The Extension Preferences. Only created if CreateExtensionService is |
| 416 // invoked. | 413 // invoked. |
| 417 scoped_ptr<ExtensionPrefs> extension_prefs_; | 414 scoped_ptr<ExtensionPrefs> extension_prefs_; |
| 418 | 415 |
| 419 // For properly notifying the ExtensionService when the profile | 416 // For properly notifying the ExtensionService when the profile |
| 420 // is disposed. | 417 // is disposed. |
| 421 scoped_refptr<ExtensionService> extensions_service_; | 418 scoped_refptr<ExtensionService> extensions_service_; |
| 422 | 419 |
| 420 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
| 421 |
| 423 // The proxy prefs tracker. | 422 // The proxy prefs tracker. |
| 424 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 423 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| 425 | 424 |
| 426 // We use a temporary directory to store testing profile data. | 425 // We use a temporary directory to store testing profile data. |
| 427 ScopedTempDir temp_dir_; | 426 ScopedTempDir temp_dir_; |
| 428 }; | 427 }; |
| 429 | 428 |
| 430 // A profile that derives from another profile. This does not actually | 429 // A profile that derives from another profile. This does not actually |
| 431 // override anything except the GetRuntimeId() in order to test sharing of | 430 // override anything except the GetRuntimeId() in order to test sharing of |
| 432 // site information. | 431 // site information. |
| 433 class DerivedTestingProfile : public TestingProfile { | 432 class DerivedTestingProfile : public TestingProfile { |
| 434 public: | 433 public: |
| 435 explicit DerivedTestingProfile(Profile* profile) | 434 explicit DerivedTestingProfile(Profile* profile) |
| 436 : original_profile_(profile) {} | 435 : original_profile_(profile) {} |
| 437 | 436 |
| 438 virtual ProfileId GetRuntimeId() { | 437 virtual ProfileId GetRuntimeId() { |
| 439 return original_profile_->GetRuntimeId(); | 438 return original_profile_->GetRuntimeId(); |
| 440 } | 439 } |
| 441 | 440 |
| 442 protected: | 441 protected: |
| 443 Profile* original_profile_; | 442 Profile* original_profile_; |
| 444 }; | 443 }; |
| 445 | 444 |
| 446 #endif // CHROME_TEST_TESTING_PROFILE_H_ | 445 #endif // CHROME_TEST_TESTING_PROFILE_H_ |
| OLD | NEW |