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

Unified Diff: chrome/browser/services/gcm/gcm_profile_service_factory.cc

Issue 955673004: Move gcm-independent parts of push messaging out of gcm namespace and directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: buildfix push_messaging_application_id_unittest Created 5 years, 10 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
Index: chrome/browser/services/gcm/gcm_profile_service_factory.cc
diff --git a/chrome/browser/services/gcm/gcm_profile_service_factory.cc b/chrome/browser/services/gcm/gcm_profile_service_factory.cc
index d3772b3078b17e5acb844a477a6f706fb69818e2..a4588f38e79a02f4ecd2aeec03547b4d04da815b 100644
--- a/chrome/browser/services/gcm/gcm_profile_service_factory.cc
+++ b/chrome/browser/services/gcm/gcm_profile_service_factory.cc
@@ -18,6 +18,10 @@
#endif
namespace gcm {
+namespace {
+BrowserContextKeyedServiceFactory::TestingFactoryFunction
+ global_testing_factory = NULL;
Peter Beverloo 2015/03/03 15:54:18 nit: g_testing_factory
+}
// static
GCMProfileService* GCMProfileServiceFactory::GetForProfile(
@@ -35,6 +39,12 @@ GCMProfileServiceFactory* GCMProfileServiceFactory::GetInstance() {
return Singleton<GCMProfileServiceFactory>::get();
}
+// static
+void GCMProfileServiceFactory::SetGlobalTestingFactory(
+ GCMProfileServiceFactory::TestingFactoryFunction factory) {
+ global_testing_factory = factory;
+}
+
GCMProfileServiceFactory::GCMProfileServiceFactory()
: BrowserContextKeyedServiceFactory(
"GCMProfileService",
@@ -51,6 +61,9 @@ GCMProfileServiceFactory::~GCMProfileServiceFactory() {
KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
+ if (global_testing_factory) {
+ return (*global_testing_factory)(context);
+ }
Peter Beverloo 2015/03/03 15:54:18 nit: no need for {}
#if defined(OS_ANDROID)
return new GCMProfileService(Profile::FromBrowserContext(context));
#else

Powered by Google App Engine
This is Rietveld 408576698