Chromium Code Reviews| Index: components/browser_context_keyed_service/browser_context_dependency_manager.cc |
| diff --git a/components/browser_context_keyed_service/browser_context_dependency_manager.cc b/components/browser_context_keyed_service/browser_context_dependency_manager.cc |
| index 1031f4e831026d376c47f35bac56e52cd304d636..93e89aa920abeea5b7df5463608e63c327873e89 100644 |
| --- a/components/browser_context_keyed_service/browser_context_dependency_manager.cc |
| +++ b/components/browser_context_keyed_service/browser_context_dependency_manager.cc |
| @@ -40,7 +40,20 @@ void BrowserContextDependencyManager::AddEdge( |
| } |
| void BrowserContextDependencyManager::CreateBrowserContextServices( |
| - content::BrowserContext* context, bool is_testing_context) { |
| + content::BrowserContext* context) { |
| + DoCreateBrowserContextServices(context, false, false); |
| +} |
| + |
| +void BrowserContextDependencyManager::CreateBrowserContextServicesForTest( |
| + content::BrowserContext* context, |
| + bool force_register_prefs) { |
| + DoCreateBrowserContextServices(context, true, force_register_prefs); |
| +} |
| + |
| +void BrowserContextDependencyManager::DoCreateBrowserContextServices( |
| + content::BrowserContext* context, |
| + bool is_testing_context, |
| + bool force_register_prefs) { |
| TRACE_EVENT0("browser", |
| "BrowserContextDependencyManager::CreateBrowserContextServices") |
|
Elliot Glaysher
2013/08/16 18:07:59
Update trace name too?
Andrew T Wilson (Slow)
2013/08/19 12:15:56
Done.
|
| #ifndef NDEBUG |
| @@ -64,9 +77,12 @@ void BrowserContextDependencyManager::CreateBrowserContextServices( |
| BrowserContextKeyedBaseFactory* factory = |
| static_cast<BrowserContextKeyedBaseFactory*>(construction_order[i]); |
| - if (!context->IsOffTheRecord()) { |
| + if (!context->IsOffTheRecord() || force_register_prefs) { |
| // We only register preferences on normal contexts because the incognito |
| - // context shares the pref service with the normal one. |
| + // context shares the pref service with the normal one. Always register |
| + // for standalone testing contexts (testing contexts that don't have an |
| + // "original" profile set) as otherwise the preferences won't be |
| + // registered. |
| factory->RegisterUserPrefsOnBrowserContext(context); |
| } |