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

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

Issue 23868042: Mark supervised profiles as such immediately when they're created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 3 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 f928f39da3773ebd85521f3542230383fb445221..c2a40a93fe7788b067d938bcb7adf0662e4b643a 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -230,6 +230,7 @@ TestingProfile::TestingProfile(
scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
scoped_ptr<PrefServiceSyncable> prefs,
bool incognito,
+ const std::string& managed_user_id,
const TestingFactories& factories)
: start_time_(Time::Now()),
prefs_(prefs.release()),
@@ -237,6 +238,7 @@ TestingProfile::TestingProfile(
incognito_(incognito),
force_incognito_(false),
original_profile_(NULL),
+ managed_user_id_(managed_user_id),
last_session_exited_cleanly_(true),
extension_special_storage_policy_(extension_policy),
profile_path_(path),
@@ -353,8 +355,10 @@ void TestingProfile::FinishInit() {
content::Source<Profile>(static_cast<Profile*>(this)),
content::NotificationService::NoDetails());
- if (delegate_)
+ if (delegate_) {
+ delegate_->OnPrefsLoaded(this);
delegate_->OnProfileCreated(this, true, false);
+ }
}
TestingProfile::~TestingProfile() {
@@ -584,7 +588,7 @@ Profile* TestingProfile::GetOriginalProfile() {
}
bool TestingProfile::IsManaged() {
- return !GetPrefs()->GetString(prefs::kManagedUserId).empty();
+ return !managed_user_id_.empty();
}
ExtensionService* TestingProfile::GetExtensionService() {
@@ -857,6 +861,11 @@ void TestingProfile::Builder::SetIncognito() {
incognito_ = true;
}
+void TestingProfile::Builder::SetManagedUserId(
+ const std::string& managed_user_id) {
+ managed_user_id_ = managed_user_id_;
+}
+
void TestingProfile::Builder::AddTestingFactory(
BrowserContextKeyedServiceFactory* service_factory,
BrowserContextKeyedServiceFactory::FactoryFunction callback) {
@@ -866,11 +875,13 @@ void TestingProfile::Builder::AddTestingFactory(
scoped_ptr<TestingProfile> TestingProfile::Builder::Build() {
DCHECK(!build_called_);
build_called_ = true;
+
return scoped_ptr<TestingProfile>(new TestingProfile(
path_,
delegate_,
extension_policy_,
pref_service_.Pass(),
incognito_,
+ managed_user_id_,
testing_factories_));
}

Powered by Google App Engine
This is Rietveld 408576698