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

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: review Created 7 years, 2 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/test/base/testing_profile.h ('k') | chrome/test/base/testing_profile_manager.cc » ('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 138bb1639bdf5a1d7165677e83528a5434391779..bc655aa35e16422210ecc436412b6d3ddb818eef 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -47,6 +47,7 @@
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/prerender/prerender_manager.h"
#include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/storage_partition_descriptor.h"
#include "chrome/browser/search_engines/template_url_fetcher_factory.h"
#include "chrome/browser/webdata/web_data_service.h"
@@ -230,6 +231,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 +239,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),
@@ -355,6 +358,10 @@ void TestingProfile::FinishInit() {
content::Source<Profile>(static_cast<Profile*>(this)),
content::NotificationService::NoDetails());
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ if (profile_manager)
+ profile_manager->InitProfileUserPrefs(this);
+
if (delegate_)
delegate_->OnProfileCreated(this, true, false);
}
@@ -586,7 +593,7 @@ Profile* TestingProfile::GetOriginalProfile() {
}
bool TestingProfile::IsManaged() {
- return !GetPrefs()->GetString(prefs::kManagedUserId).empty();
+ return !managed_user_id_.empty();
}
ExtensionService* TestingProfile::GetExtensionService() {
@@ -866,6 +873,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) {
@@ -875,11 +887,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_));
}
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | chrome/test/base/testing_profile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698