summaryrefslogtreecommitdiffstats
path: root/chrome/test/testing_profile.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/test/testing_profile.h')
-rw-r--r--chrome/test/testing_profile.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index d75b7c1..b1e466d 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -23,6 +23,7 @@ class CookieMonster;
class AutocompleteClassifier;
class BookmarkModel;
class BrowserThemeProvider;
+class CommandLine;
class DesktopNotificationService;
class FaviconService;
class FindBarState;
@@ -86,6 +87,14 @@ class TestingProfile : public Profile {
// ownership of |theme_provider|.
void UseThemeProvider(BrowserThemeProvider* theme_provider);
+ // Creates an ExtensionsService initialized with the testing profile and
+ // returns it. The profile keeps its own copy of a scoped_refptr to the
+ // ExtensionsService to make sure that is still alive to be notified when the
+ // profile is destroyed.
+ scoped_refptr<ExtensionsService> CreateExtensionsService(
+ const CommandLine* command_line,
+ const FilePath& install_directory);
+
TestingPrefService* GetTestingPrefService();
virtual ProfileId GetRuntimeId() {
@@ -109,7 +118,7 @@ class TestingProfile : public Profile {
virtual ChromeAppCacheService* GetAppCacheService() { return NULL; }
virtual webkit_database::DatabaseTracker* GetDatabaseTracker();
virtual VisitedLinkMaster* GetVisitedLinkMaster() { return NULL; }
- virtual ExtensionsService* GetExtensionsService() { return NULL; }
+ virtual ExtensionsService* GetExtensionsService();
virtual UserScriptMaster* GetUserScriptMaster() { return NULL; }
virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() {
return NULL;
@@ -148,6 +157,10 @@ class TestingProfile : public Profile {
virtual PasswordStore* GetPasswordStore(ServiceAccessType access) {
return NULL;
}
+ // Initialized the profile's PrefService with an explicity specified
+ // PrefService. Must be called before the TestingProfile.
+ // The profile takes ownership of |pref|.
+ void SetPrefService(PrefService* prefs);
virtual PrefService* GetPrefs();
virtual TemplateURLModel* GetTemplateURLModel() {
return template_url_model_.get();
@@ -263,7 +276,9 @@ class TestingProfile : public Profile {
protected:
base::Time start_time_;
- scoped_ptr<TestingPrefService> prefs_;
+ scoped_ptr<PrefService> prefs_;
+ // ref only for right type, lifecycle is managed by prefs_
+ TestingPrefService* testing_prefs_;
private:
// Destroys favicon service if it has been created.
@@ -277,6 +292,9 @@ class TestingProfile : public Profile {
// from the destructor.
void DestroyWebDataService();
+ // Creates a TestingPrefService and associates it with the TestingProfile
+ void CreateTestingPrefService();
+
// The favicon service. Only created if CreateFaviconService is invoked.
scoped_refptr<FaviconService> favicon_service_;
@@ -346,6 +364,10 @@ class TestingProfile : public Profile {
FilePath last_selected_directory_;
scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails.
+ // For properly notifying the ExtensionsService when the profile
+ // is disposed.
+ scoped_refptr<ExtensionsService> extensions_service_;
+
// We use a temporary directory to store testing profile data.
ScopedTempDir temp_dir_;
};