Commit b230aecc authored by Ramin Halavati's avatar Ramin Halavati Committed by Chromium LUCI CQ

Enable Dice for ephemeral Guest profiles.

Account Consistency Mode Manager is enabled for ephemeral Guest
profiles.

Please see go/ephemeral-guest-profiles for more context.

Bug: 1125474
Change-Id: Id7ae0a844e6d582ad70ad12430af107048f40290
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2574747Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834280}
parent 31c4942c
...@@ -1898,7 +1898,8 @@ void ProfileManager::AddProfileToStorage(Profile* profile) { ...@@ -1898,7 +1898,8 @@ void ProfileManager::AddProfileToStorage(Profile* profile) {
void ProfileManager::SetNonPersonalProfilePrefs(Profile* profile) { void ProfileManager::SetNonPersonalProfilePrefs(Profile* profile) {
PrefService* prefs = profile->GetPrefs(); PrefService* prefs = profile->GetPrefs();
prefs->SetBoolean(prefs::kSigninAllowed, false); if (!profile->IsEphemeralGuestProfile())
prefs->SetBoolean(prefs::kSigninAllowed, false);
prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false); prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false);
prefs->SetBoolean(bookmarks::prefs::kShowBookmarkBar, false); prefs->SetBoolean(bookmarks::prefs::kShowBookmarkBar, false);
prefs->ClearPref(DefaultSearchManager::kDefaultSearchProviderDataPrefName); prefs->ClearPref(DefaultSearchManager::kDefaultSearchProviderDataPrefName);
......
...@@ -168,7 +168,7 @@ bool AccountConsistencyModeManager::ShouldBuildServiceForProfile( ...@@ -168,7 +168,7 @@ bool AccountConsistencyModeManager::ShouldBuildServiceForProfile(
// causes crashes if the AccountConsistencyModeManager is instantiated. See // causes crashes if the AccountConsistencyModeManager is instantiated. See
// https://crbug.com/940026 // https://crbug.com/940026
return profile->IsRegularProfile() && !profile->IsGuestSession() && return profile->IsRegularProfile() && !profile->IsGuestSession() &&
!profile->IsEphemeralGuestProfile() && !profile->IsSystemProfile(); !profile->IsSystemProfile();
} }
AccountConsistencyMethod AccountConsistencyMethod
......
...@@ -172,7 +172,8 @@ TEST(AccountConsistencyModeManagerTest, NewProfile) { ...@@ -172,7 +172,8 @@ TEST(AccountConsistencyModeManagerTest, NewProfile) {
AccountConsistencyModeManager::IsDiceMigrationCompleted(profile.get())); AccountConsistencyModeManager::IsDiceMigrationCompleted(profile.get()));
} }
TEST(AccountConsistencyModeManagerTest, DiceOnlyForRegularProfile) { TEST(AccountConsistencyModeManagerTest,
DiceOnlyForRegularAndEphemeralGuestProfile) {
content::BrowserTaskEnvironment task_environment; content::BrowserTaskEnvironment task_environment;
{ {
...@@ -209,8 +210,12 @@ TEST(AccountConsistencyModeManagerTest, DiceOnlyForRegularProfile) { ...@@ -209,8 +210,12 @@ TEST(AccountConsistencyModeManagerTest, DiceOnlyForRegularProfile) {
otr_profile)); otr_profile));
} }
// OTR Guest profile.
{ {
// Guest profile. base::test::ScopedFeatureList scoped_feature_list;
TestingProfile::SetScopedFeatureListForEphemeralGuestProfiles(
scoped_feature_list, false);
TestingProfile::Builder profile_builder; TestingProfile::Builder profile_builder;
profile_builder.SetGuestSession(); profile_builder.SetGuestSession();
std::unique_ptr<Profile> profile = profile_builder.Build(); std::unique_ptr<Profile> profile = profile_builder.Build();
...@@ -224,6 +229,25 @@ TEST(AccountConsistencyModeManagerTest, DiceOnlyForRegularProfile) { ...@@ -224,6 +229,25 @@ TEST(AccountConsistencyModeManagerTest, DiceOnlyForRegularProfile) {
profile.get())); profile.get()));
} }
// Ephemeral Guest profile.
{
base::test::ScopedFeatureList scoped_feature_list;
if (TestingProfile::SetScopedFeatureListForEphemeralGuestProfiles(
scoped_feature_list, true)) {
TestingProfile::Builder profile_builder;
profile_builder.SetGuestSession();
std::unique_ptr<Profile> profile = profile_builder.Build();
ASSERT_TRUE(profile->IsEphemeralGuestProfile());
EXPECT_TRUE(AccountConsistencyModeManager::IsDiceEnabledForProfile(
profile.get()));
EXPECT_EQ(
signin::AccountConsistencyMethod::kDice,
AccountConsistencyModeManager::GetMethodForProfile(profile.get()));
EXPECT_TRUE(AccountConsistencyModeManager::ShouldBuildServiceForProfile(
profile.get()));
}
}
{ {
// Legacy supervised profile. // Legacy supervised profile.
TestingProfile::Builder profile_builder; TestingProfile::Builder profile_builder;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment