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

Unified Diff: chrome/test/base/testing_profile.cc

Issue 1254363004: Move ownership of AppSorting from ExtensionPrefs to ExtensionSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing include Created 5 years, 4 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/browser/extensions/test_extension_system.cc ('k') | extensions/browser/app_sorting.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/testing_profile.cc
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 162fe58baf844d30eb6ece844d92ca02f36879f1..0e5f61c239b9288e20671d39b9d90a90028e529b 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -100,8 +100,11 @@
#include "chrome/browser/extensions/test_extension_system.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "extensions/browser/event_router_factory.h"
+#include "extensions/browser/extension_pref_value_map.h"
+#include "extensions/browser/extension_pref_value_map_factory.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_prefs_factory.h"
+#include "extensions/browser/extension_prefs_observer.h"
#include "extensions/browser/extension_system.h"
#endif
@@ -421,18 +424,24 @@ void TestingProfile::Init() {
extensions_path_ = profile_path_.AppendASCII("Extensions");
#if defined(ENABLE_EXTENSIONS)
- extensions::ExtensionSystemFactory::GetInstance()->SetTestingFactory(
- this, extensions::TestExtensionSystem::Build);
-
- extensions::TestExtensionSystem* test_extension_system =
- static_cast<extensions::TestExtensionSystem*>(
- extensions::ExtensionSystem::Get(this));
- scoped_ptr<extensions::ExtensionPrefs> extension_prefs =
- test_extension_system->CreateExtensionPrefs(
- base::CommandLine::ForCurrentProcess(), extensions_path_);
+ // Note that the GetPrefs() creates a TestingPrefService, therefore
+ // the extension controlled pref values set in ExtensionPrefs
+ // are not reflected in the pref service. One would need to
+ // inject a new ExtensionPrefStore(extension_pref_value_map, false).
+ bool extensions_disabled = base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableExtensions);
+ scoped_ptr<extensions::ExtensionPrefs> extension_prefs(
+ extensions::ExtensionPrefs::Create(
+ this, GetPrefs(), extensions_path_,
+ ExtensionPrefValueMapFactory::GetForBrowserContext(this),
+ extensions_disabled,
+ std::vector<extensions::ExtensionPrefsObserver*>()));
extensions::ExtensionPrefsFactory::GetInstance()->SetInstanceForTesting(
this, extension_prefs.Pass());
+ extensions::ExtensionSystemFactory::GetInstance()->SetTestingFactory(
+ this, extensions::TestExtensionSystem::Build);
+
extensions::EventRouterFactory::GetInstance()->SetTestingFactory(this,
nullptr);
#endif
« no previous file with comments | « chrome/browser/extensions/test_extension_system.cc ('k') | extensions/browser/app_sorting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698