Chromium Code Reviews| Index: chrome/browser/chromeos/drive/drive_integration_service.h |
| diff --git a/chrome/browser/chromeos/drive/drive_integration_service.h b/chrome/browser/chromeos/drive/drive_integration_service.h |
| index 2f6dd45c30978893135fd32ad38f00d939e039d9..3c4394e0bb894810a2897c0c568d60e6dfbcf475 100644 |
| --- a/chrome/browser/chromeos/drive/drive_integration_service.h |
| +++ b/chrome/browser/chromeos/drive/drive_integration_service.h |
| @@ -208,7 +208,9 @@ class DriveIntegrationServiceFactory |
| static DriveIntegrationServiceFactory* GetInstance(); |
| // Sets a factory function for tests. |
| - static void SetFactoryForTest(const FactoryCallback& factory_for_test); |
| + // NOTE: Call SetFactoryForTest(NULL) during your test TearDown so you don't |
| + // pollute the next test. |
| + static void SetFactoryForTest(FactoryCallback* factory_for_test); |
|
xiyuan
2014/01/09 17:53:22
nit: How about making this private and use a Scope
|
| private: |
| friend struct DefaultSingletonTraits<DriveIntegrationServiceFactory>; |
| @@ -220,7 +222,12 @@ class DriveIntegrationServiceFactory |
| virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
| content::BrowserContext* context) const OVERRIDE; |
| - FactoryCallback factory_for_test_; |
| + // This is static so it can be set without instantiating the factory. This |
| + // allows factory creation to be delayed until it normally happens (on profile |
| + // creation) rather than when tests are set up. DriveIntegrationServiceFactory |
| + // transitively depends on ExtensionSystemFactory which crashes if created too |
| + // soon (i.e. before the BrowserProcess exists). |
| + static FactoryCallback* factory_for_test_; |
| }; |
| } // namespace drive |