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

Unified Diff: chrome/test/testing_profile.cc

Issue 6803012: Profile shouldn't own DesktopNotificationService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 8 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/test/testing_profile.h ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/testing_profile.cc
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index 468c051b71104730c861ed6668de158f1c83e131..cab23da9f53d779854510a576988a1c9bc4c7bc8 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/net/gaia/token_service.h"
#include "chrome/browser/net/pref_proxy_config_service.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
+#include "chrome/browser/notifications/desktop_notification_service_factory.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/testing_pref_store.h"
#include "chrome/browser/prerender/prerender_manager.h"
@@ -141,6 +142,10 @@ class TestExtensionURLRequestContextGetter
scoped_refptr<net::URLRequestContext> context_;
};
+ProfileKeyedService* CreateTestDesktopNotificationService(Profile* profile) {
+ return new DesktopNotificationService(profile, NULL);
+}
+
} // namespace
TestingProfile::TestingProfile()
@@ -172,6 +177,12 @@ TestingProfile::TestingProfile()
CHECK(temp_dir_.Set(system_tmp_dir));
}
}
+
+ // Install profile keyed service factory hooks for dummy/test services
+ DesktopNotificationServiceFactory::GetInstance()->set_test_factory(
+ &CreateTestDesktopNotificationService);
+ DesktopNotificationServiceFactory::GetInstance()->ForceAssociationBetween(
+ this, NULL);
}
TestingProfile::~TestingProfile() {
@@ -362,11 +373,6 @@ TestingPrefService* TestingProfile::GetTestingPrefService() {
return testing_prefs_;
}
-void TestingProfile::SetProfileDependencyManager(
- ProfileDependencyManager* manager) {
- profile_dependency_manager_ = manager;
-}
-
ProfileId TestingProfile::GetRuntimeId() {
return reinterpret_cast<ProfileId>(this);
}
@@ -693,15 +699,6 @@ NTPResourceCache* TestingProfile::GetNTPResourceCache() {
return ntp_resource_cache_.get();
}
-DesktopNotificationService* TestingProfile::GetDesktopNotificationService() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!desktop_notification_service_.get()) {
- desktop_notification_service_.reset(new DesktopNotificationService(
- this, NULL));
- }
- return desktop_notification_service_.get();
-}
-
BackgroundContentsService*
TestingProfile::GetBackgroundContentsService() const {
return NULL;
« no previous file with comments | « chrome/test/testing_profile.h ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698