Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: chrome/test/testing_profile.h

Issue 3304015: Use PrefChangeRegistrar everywhere (Closed)
Patch Set: final version for commit Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/options/general_page_view.cc ('k') | chrome/test/testing_profile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/testing_profile.h
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index d75b7c14d2a0dd455c0c679896090be3e5d1801a..b1e466df7d9df6afaa68801665870ec82971de6e 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_;
};
« no previous file with comments | « chrome/browser/views/options/general_page_view.cc ('k') | chrome/test/testing_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698