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

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: fix tests, cleanup 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
Index: chrome/test/base/testing_profile.cc
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 976c7a8bcd990e5367faaabd36bdd71203b2e68f..708288e4704ab9a89965f6c9f8383fceaeec5dce 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -102,8 +102,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
@@ -431,18 +434,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));
+ // Note that the GetPrefs() creates a TestingPrefService, therefore
Marc Treib 2015/08/03 15:28:03 This has moved from TestExtensionSystem to here. T
+ // 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 =
- test_extension_system->CreateExtensionPrefs(
- base::CommandLine::ForCurrentProcess(), extensions_path_);
+ make_scoped_ptr(extensions::ExtensionPrefs::Create(
+ 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

Powered by Google App Engine
This is Rietveld 408576698