Chromium Code Reviews| 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 |