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

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

Issue 9620010: Added Protector backup for Preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reupload Created 8 years, 9 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/chrome_tests.gypi ('k') | no next file » | 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 be6f054516fe57103a2be8d746746b381e834916..162ccc7d52f546ee239f199566997273bf1dbac1 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/prefs/testing_pref_store.h"
#include "chrome/browser/prerender/prerender_manager.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "chrome/browser/protector/protector_service_factory.h"
#include "chrome/browser/search_engines/template_url_fetcher.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
@@ -537,6 +538,12 @@ WebDataService* TestingProfile::GetWebDataServiceWithoutCreating() {
}
void TestingProfile::SetPrefService(PrefService* prefs) {
+ // ProtectorService binds itself very closely to the PrefService at the moment
+ // of Profile creation and watches pref changes to update their backup.
+ // For tests that replace the PrefService after TestingProfile creation,
+ // ProtectorService is disabled to prevent further invalid memory accesses.
+ protector::ProtectorServiceFactory::GetInstance()->
+ SetTestingFactory(this, NULL);
prefs_.reset(prefs);
}
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698