| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Creates a TemplateURLModel. If not invoked, the TemplateURLModel is NULL. | 104 // Creates a TemplateURLModel. If not invoked, the TemplateURLModel is NULL. |
| 105 void CreateTemplateURLModel(); | 105 void CreateTemplateURLModel(); |
| 106 | 106 |
| 107 // Sets the TemplateURLModel. Takes ownership of it. | 107 // Sets the TemplateURLModel. Takes ownership of it. |
| 108 void SetTemplateURLModel(TemplateURLModel* model); | 108 void SetTemplateURLModel(TemplateURLModel* model); |
| 109 | 109 |
| 110 // Uses a specific theme provider for this profile. TestingProfile takes | 110 // Uses a specific theme provider for this profile. TestingProfile takes |
| 111 // ownership of |theme_provider|. | 111 // ownership of |theme_provider|. |
| 112 void UseThemeProvider(BrowserThemeProvider* theme_provider); | 112 void UseThemeProvider(BrowserThemeProvider* theme_provider); |
| 113 | 113 |
| 114 // Creates an ExtensionsService initialized with the testing profile and | 114 // Creates an ExtensionService initialized with the testing profile and |
| 115 // returns it. The profile keeps its own copy of a scoped_refptr to the | 115 // returns it. The profile keeps its own copy of a scoped_refptr to the |
| 116 // ExtensionsService to make sure that is still alive to be notified when the | 116 // ExtensionService to make sure that is still alive to be notified when the |
| 117 // profile is destroyed. | 117 // profile is destroyed. |
| 118 scoped_refptr<ExtensionsService> CreateExtensionsService( | 118 scoped_refptr<ExtensionService> CreateExtensionService( |
| 119 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. |
| 131 void set_off_the_record(bool off_the_record) { | 131 void set_off_the_record(bool off_the_record) { |
| 132 off_the_record_ = off_the_record; | 132 off_the_record_ = off_the_record; |
| 133 } | 133 } |
| 134 virtual bool IsOffTheRecord() { return off_the_record_; } | 134 virtual bool IsOffTheRecord() { return off_the_record_; } |
| 135 virtual Profile* GetOffTheRecordProfile() { return NULL; } | 135 virtual Profile* GetOffTheRecordProfile() { return NULL; } |
| 136 | 136 |
| 137 virtual void DestroyOffTheRecordProfile() {} | 137 virtual void DestroyOffTheRecordProfile() {} |
| 138 | 138 |
| 139 virtual bool HasOffTheRecordProfile() { return false; } | 139 virtual bool HasOffTheRecordProfile() { return false; } |
| 140 | 140 |
| 141 virtual Profile* GetOriginalProfile() { return this; } | 141 virtual Profile* GetOriginalProfile() { return this; } |
| 142 virtual ChromeAppCacheService* GetAppCacheService() { return NULL; } | 142 virtual ChromeAppCacheService* GetAppCacheService() { return NULL; } |
| 143 virtual webkit_database::DatabaseTracker* GetDatabaseTracker(); | 143 virtual webkit_database::DatabaseTracker* GetDatabaseTracker(); |
| 144 virtual VisitedLinkMaster* GetVisitedLinkMaster() { return NULL; } | 144 virtual VisitedLinkMaster* GetVisitedLinkMaster() { return NULL; } |
| 145 virtual ExtensionsService* GetExtensionsService(); | 145 virtual ExtensionService* GetExtensionService(); |
| 146 virtual UserScriptMaster* GetUserScriptMaster() { return NULL; } | 146 virtual UserScriptMaster* GetUserScriptMaster() { return NULL; } |
| 147 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() { | 147 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() { |
| 148 return NULL; | 148 return NULL; |
| 149 } | 149 } |
| 150 virtual ExtensionProcessManager* GetExtensionProcessManager() { return NULL; } | 150 virtual ExtensionProcessManager* GetExtensionProcessManager() { return NULL; } |
| 151 virtual ExtensionMessageService* GetExtensionMessageService() { return NULL; } | 151 virtual ExtensionMessageService* GetExtensionMessageService() { return NULL; } |
| 152 virtual ExtensionEventRouter* GetExtensionEventRouter() { return NULL; } | 152 virtual ExtensionEventRouter* GetExtensionEventRouter() { return NULL; } |
| 153 virtual SSLHostState* GetSSLHostState() { return NULL; } | 153 virtual SSLHostState* GetSSLHostState() { return NULL; } |
| 154 virtual net::TransportSecurityState* GetTransportSecurityState() { | 154 virtual net::TransportSecurityState* GetTransportSecurityState() { |
| 155 return NULL; | 155 return NULL; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_|. | 412 // Extension pref store, created for use by |extension_prefs_|. |
| 413 scoped_ptr<ExtensionPrefStore> extension_pref_store_; | 413 scoped_ptr<ExtensionPrefStore> extension_pref_store_; |
| 414 | 414 |
| 415 // The Extension Preferences. Only created if CreateExtensionsService is | 415 // The Extension Preferences. Only created if CreateExtensionService is |
| 416 // invoked. | 416 // invoked. |
| 417 scoped_ptr<ExtensionPrefs> extension_prefs_; | 417 scoped_ptr<ExtensionPrefs> extension_prefs_; |
| 418 | 418 |
| 419 // For properly notifying the ExtensionsService when the profile | 419 // For properly notifying the ExtensionService when the profile |
| 420 // is disposed. | 420 // is disposed. |
| 421 scoped_refptr<ExtensionsService> extensions_service_; | 421 scoped_refptr<ExtensionService> extensions_service_; |
| 422 | 422 |
| 423 // The proxy prefs tracker. | 423 // The proxy prefs tracker. |
| 424 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 424 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| 425 | 425 |
| 426 // We use a temporary directory to store testing profile data. | 426 // We use a temporary directory to store testing profile data. |
| 427 ScopedTempDir temp_dir_; | 427 ScopedTempDir temp_dir_; |
| 428 }; | 428 }; |
| 429 | 429 |
| 430 // A profile that derives from another profile. This does not actually | 430 // A profile that derives from another profile. This does not actually |
| 431 // override anything except the GetRuntimeId() in order to test sharing of | 431 // override anything except the GetRuntimeId() in order to test sharing of |
| 432 // site information. | 432 // site information. |
| 433 class DerivedTestingProfile : public TestingProfile { | 433 class DerivedTestingProfile : public TestingProfile { |
| 434 public: | 434 public: |
| 435 explicit DerivedTestingProfile(Profile* profile) | 435 explicit DerivedTestingProfile(Profile* profile) |
| 436 : original_profile_(profile) {} | 436 : original_profile_(profile) {} |
| 437 | 437 |
| 438 virtual ProfileId GetRuntimeId() { | 438 virtual ProfileId GetRuntimeId() { |
| 439 return original_profile_->GetRuntimeId(); | 439 return original_profile_->GetRuntimeId(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 protected: | 442 protected: |
| 443 Profile* original_profile_; | 443 Profile* original_profile_; |
| 444 }; | 444 }; |
| 445 | 445 |
| 446 #endif // CHROME_TEST_TESTING_PROFILE_H_ | 446 #endif // CHROME_TEST_TESTING_PROFILE_H_ |
| OLD | NEW |