Commit 9127fade authored by Bin Du's avatar Bin Du Committed by Chromium LUCI CQ

Skip lock screen profiles when reading sync settings.

Lock screen and lock screen app profiles are not regular user profiles.

They disable sync and should be skipped when reading sync settings.

Bug: b:175067939
Change-Id: I6634ce77efbb39a493df0161a16796650cac73c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628052Reviewed-by: default avatarGabriel Marin <gmx@chromium.org>
Commit-Queue: Bin Du <dubin@google.com>
Cr-Commit-Position: refs/heads/master@{#844143}
parent f061fddd
......@@ -230,10 +230,10 @@ MetricProvider::RecordAttemptStatus MetricProvider::GetAppSyncState() {
int user_profile_count = 0;
for (Profile* profile : profiles) {
// The Default profile on Chrome OS is used when the user has not logged in
// and this profile always disables sync. We skip this profile and look at
// sync settings of user profiles.
if (chromeos::ProfileHelper::IsSigninProfile(profile))
// The Default profile, lock screen app profile and lock screen profile are
// all not regular user profiles on Chrome OS. They always disable sync and
// we would skip them.
if (!chromeos::ProfileHelper::IsRegularProfile(profile))
continue;
auto app_sync_state = AppSyncStateForUserProfile(profile);
if (app_sync_state != RecordAttemptStatus::kAppSyncEnabled)
......
......@@ -312,6 +312,11 @@ class MetricProviderSyncSettingsTest : public testing::Test {
// this. The Default profile is skipped when getting the sync settings from
// user profile(s).
testing_profile_manager_->CreateTestingProfile(chrome::kInitialProfile);
// Also add two non-regular profiles that might appear on ChromeOS. They
// always disable sync and are skipped when getting sync settings.
testing_profile_manager_->CreateTestingProfile(
chrome::kLockScreenAppProfile);
testing_profile_manager_->CreateTestingProfile(chrome::kLockScreenProfile);
metric_provider_ = std::make_unique<TestMetricProvider>(
std::make_unique<TestMetricCollector>(test_params),
testing_profile_manager_->profile_manager());
......
......@@ -88,6 +88,7 @@ TestingProfile* TestingProfileManager::CreateTestingProfile(
base::FilePath profile_path(profiles_path_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (profile_name != chrome::kInitialProfile &&
profile_name != chrome::kLockScreenProfile &&
profile_name != chromeos::ProfileHelper::GetLockScreenAppProfileName()) {
profile_path =
profile_path.Append(chromeos::ProfileHelper::Get()->GetUserProfileDir(
......
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