0

components: Remove IS_CHROMEOS_ASH uses

IS_CHROMEOS_ASH is deprecated. Use the equivalent IS_CHROMEOS instead.

Bug: b:354842935
Change-Id: I3e6762c14aaac20571d5e2b20f0276f7619ce3e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6108986
Owners-Override: Georg Neis <neis@chromium.org>
Reviewed-by: Jun Ishiguro <junis@google.com>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1400010}
This commit is contained in:
Georg Neis
2024-12-24 01:13:59 -08:00
committed by Chromium LUCI CQ
parent 47f064801e
commit 0ea7859156
97 changed files with 358 additions and 381 deletions
components
account_manager_core
crash
permissions
policy
prefs
signin
sync
sync_device_info
ukm
variations

@@ -602,7 +602,7 @@ void AccountManager::UpsertAccountInternal(
// This is a new account. Insert it.
// Note: AccountManager may be used on Lacros in tests. Don't check pref
// service in this case.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// New account insertions can only happen through a user action, which
// implies that |Profile| must have been fully initialized at this point.
// |ProfileImpl|'s constructor guarantees that
@@ -615,7 +615,7 @@ void AccountManager::UpsertAccountInternal(
// adding a Secondary Account are already blocked.
CHECK(accounts_.empty());
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
accounts_.emplace(account_key, account);
PersistAccountsAsync();
NotifyTokenObservers(

@@ -117,7 +117,7 @@ void DestroyCrashpadClient();
// ChromeOS has its own, OS-level consent system; Chrome does not maintain a
// separate Upload Consent on ChromeOS.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Enables or disables crash report upload, taking the given consent to upload
// into account. Consent may be ignored, uploads may not be enabled even with
@@ -129,7 +129,7 @@ void DestroyCrashpadClient();
// running.
void SetUploadConsent(bool consent);
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
enum class ReportUploadState {
NotUploaded,

@@ -143,7 +143,7 @@ bool PlatformCrashpadInitialization(
DCHECK(exe_path.empty());
crashpad::CrashpadClient client;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
std::string crash_loop_before =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kCrashLoopBefore);

@@ -810,7 +810,7 @@ TEST_F(PermissionContextBaseTests, TestGlobalKillSwitch) {
TestGlobalPermissionsKillSwitch(ContentSettingsType::NOTIFICATIONS);
TestGlobalPermissionsKillSwitch(ContentSettingsType::MIDI_SYSEX);
TestGlobalPermissionsKillSwitch(ContentSettingsType::DURABLE_STORAGE);
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
TestGlobalPermissionsKillSwitch(
ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER);
#endif

@@ -48,9 +48,9 @@ const char kPrecedencePoliciesId[] = "precedence";
const char kPrecedencePoliciesName[] = "Policy Precedence";
#endif // !BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const char kDeviceLocalAccountPoliciesId[] = "deviceLocalAccountPolicies";
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
PolicyConversions::Delegate::Delegate(PolicyConversionsClient* client)
: client_(client) {}
@@ -139,17 +139,17 @@ Value::Dict DefaultPolicyConversions::ToValueDict() {
all_policies.Merge(GetExtensionPolicies());
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
all_policies.Set(kDeviceLocalAccountPoliciesId,
GetDeviceLocalAccountPolicies());
Value::Dict identity_fields = client()->GetIdentityFields();
if (!identity_fields.empty())
all_policies.Merge(std::move(identity_fields));
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
return all_policies;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
Value::Dict DefaultPolicyConversions::GetDeviceLocalAccountPolicies() {
Value::List policies = client()->GetDeviceLocalAccountPolicies();
Value::Dict device_values;
@@ -171,10 +171,10 @@ base::Value::Dict DefaultPolicyConversions::GetExtensionPolicies() {
extension_policies.Set("extensionPolicies",
GetExtensionPolicies(POLICY_DOMAIN_EXTENSIONS));
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
extension_policies.Set("loginScreenExtensionPolicies",
GetExtensionPolicies(POLICY_DOMAIN_SIGNIN_EXTENSIONS));
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
return extension_policies;
}

@@ -139,7 +139,7 @@ class POLICY_EXPORT DefaultPolicyConversions
base::Value::Dict GetExtensionPolicies(PolicyDomain policy_domain);
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
base::Value::Dict GetDeviceLocalAccountPolicies();
#endif
};

@@ -97,7 +97,7 @@ class POLICY_EXPORT PolicyConversionsClient {
virtual base::Value::List GetExtensionPolicies(
PolicyDomain policy_domain) = 0;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Returns policies for ChromeOS device.
virtual base::Value::List GetDeviceLocalAccountPolicies() = 0;
// Returns device specific information if this device is enterprise managed.

@@ -29,7 +29,7 @@ class StubPolicyConversionsClient : public PolicyConversionsClient {
base::Value::List GetExtensionPolicies(PolicyDomain policy_domain) override {
return base::Value::List();
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
base::Value::List GetDeviceLocalAccountPolicies() override {
return base::Value::List();
}

@@ -405,7 +405,7 @@ class PolicyTestCase {
bool IsOsSupported() const {
#if BUILDFLAG(IS_ANDROID)
const std::string os("android");
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
const std::string os("chromeos_ash");
#elif BUILDFLAG(IS_IOS)
const std::string os("ios");

@@ -12,7 +12,7 @@
#include "services/network/test/test_network_connection_tracker.h"
#include "testing/gtest/include/gtest/gtest.h"
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
#include "components/policy/core/common/cloud/mock_user_cloud_policy_store.h"
#endif
@@ -26,7 +26,7 @@ namespace {
constexpr char kAffiliationId1[] = "abc";
constexpr char kAffiliationId2[] = "def";
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
constexpr char kNonEmptyDmToken[] = "test-dm-token";
policy::MockCloudPolicyClient* ConnectNewMockClient(
@@ -106,7 +106,7 @@ TEST(CloudManagementAffiliationTest, UserAffiliated) {
EXPECT_FALSE(IsUserAffiliated(user_ids, device_ids, "user"));
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Tests getting affiliation IDs from core for user.
TEST(CloudManagementAffiliationTest, GetUserAffiliationIdsFromCore_User) {
base::test::TaskEnvironment task_environment;

@@ -51,7 +51,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/system/fake_statistics_provider.h"
#endif
@@ -459,7 +459,7 @@ class CloudPolicyClientTest : public testing::Test {
job_type_(DeviceManagementService::JobConfiguration::TYPE_INVALID),
client_id_(kClientID),
policy_type_(dm_protocol::kChromeUserPolicyType) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
fake_statistics_provider_.SetMachineStatistic(ash::system::kSerialNumberKey,
"fake_serial_number");
#endif
@@ -606,7 +606,7 @@ class CloudPolicyClientTest : public testing::Test {
std::unique_ptr<CloudPolicyClient> client_;
network::TestURLLoaderFactory url_loader_factory_;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ash::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
#endif

@@ -84,7 +84,7 @@ const char kValueRequestFmRegistrationTokenUpload[] =
"fm_registration_token_upload";
const char kChromeDevicePolicyType[] = "google/chromeos/device";
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const char kChromeUserPolicyType[] = "google/chromeos/user";
#elif BUILDFLAG(IS_ANDROID)
const char kChromeUserPolicyType[] = "google/android/user";

@@ -53,7 +53,7 @@
#endif
#include "components/version_info/version_info.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/system/statistics_provider.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
@@ -181,7 +181,7 @@ std::string GetOSUsername() {
}
return base::WideToUTF8(username);
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
if (!user_manager::UserManager::IsInitialized())
return std::string();
auto* user = user_manager::UserManager::Get()->GetPrimaryUser();
@@ -213,7 +213,7 @@ em::Channel ConvertToProtoChannel(version_info::Channel channel) {
}
std::string GetDeviceName() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return std::string(
ash::system::StatisticsProvider::GetInstance()->GetMachineID().value_or(
""));

@@ -34,9 +34,9 @@
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_id.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "base/system/sys_info.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace em = enterprise_management;
@@ -309,7 +309,7 @@ CloudPolicyValidatorBase::CloudPolicyValidatorBase(
std::optional<std::string>
CloudPolicyValidatorBase::GetCurrentPolicyVerificationKey() {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Empty `verification_key_` is only allowed on Chrome OS test image when
// policy key verification is disabled via command line flag.
if (command_line->HasSwitch(switches::kDisablePolicyKeyVerification)) {
@@ -317,7 +317,7 @@ CloudPolicyValidatorBase::GetCurrentPolicyVerificationKey() {
// GetPolicyVerificationKey() returns a non-empty string.
return std::nullopt;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
if (command_line->HasSwitch(switches::kPolicyVerificationKey)) {
CHECK_IS_TEST();
std::string decoded_key;
@@ -434,12 +434,12 @@ void CloudPolicyValidatorBase::RunChecks() {
// Verifies the |new_public_key_verification_signature_deprecated| for the
// |new_public_key| in the policy blob.
bool CloudPolicyValidatorBase::CheckNewPublicKeyVerificationSignature() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Skip verification if the key is empty (disabled via command line).
if (!verification_key_) {
return true;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
if (policy_->has_new_public_key_verification_data() &&
policy_->has_new_public_key_verification_data_signature() &&
@@ -593,12 +593,12 @@ CloudPolicyValidatorBase::Status CloudPolicyValidatorBase::CheckInitialKey() {
}
CloudPolicyValidatorBase::Status CloudPolicyValidatorBase::CheckCachedKey() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Skip verification if the key is empty (disabled via command line).
if (!verification_key_) {
return VALIDATION_OK;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
if (VerifySignature(new_cached_key_, verification_key_.value(),
new_cached_key_signature_,

@@ -28,12 +28,12 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "base/system/sys_info.h"
#include "base/test/scoped_chromeos_version_info.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest-death-test.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace em = enterprise_management;
@@ -203,7 +203,7 @@ class CloudPolicyValidatorTest : public testing::Test {
MOCK_METHOD1(ValidationCompletion, void(UserCloudPolicyValidator* validator));
};
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(CloudPolicyValidatorTest,
SuccessfulValidationWithDisableKeyVerificationOnTestImage) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
@@ -240,7 +240,7 @@ TEST_F(CloudPolicyValidatorTest,
},
"");
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
TEST_F(CloudPolicyValidatorTest, SuccessfulValidation) {
Validate(Invoke(this, &CloudPolicyValidatorTest::CheckSuccessfulValidation));

@@ -30,7 +30,7 @@
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/system/fake_statistics_provider.h"
#endif
@@ -176,7 +176,7 @@ class ResponseValueBuilder {
class EncryptedReportingJobConfigurationTest : public testing::Test {
public:
EncryptedReportingJobConfigurationTest()
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
: fake_serial_number_(&fake_statistics_provider_)
#endif
{
@@ -310,7 +310,7 @@ class EncryptedReportingJobConfigurationTest : public testing::Test {
policy::MockCloudPolicyClient client_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ash::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
class ScopedFakeSerialNumber {
public:

@@ -25,7 +25,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/system/fake_statistics_provider.h"
#endif
@@ -59,7 +59,7 @@ class MockCallbackObserver {
class RealtimeReportingJobConfigurationTest : public testing::Test {
public:
RealtimeReportingJobConfigurationTest()
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
: client_(&service_),
fake_serial_number_(&fake_statistics_provider_)
#else
@@ -159,7 +159,7 @@ class RealtimeReportingJobConfigurationTest : public testing::Test {
MockCloudPolicyClient client_;
StrictMock<MockCallbackObserver> callback_observer_;
DeviceManagementService::Job job_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ash::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
class ScopedFakeSerialNumber {
public:

@@ -675,7 +675,7 @@ TypedPolicyBuilder<em::ExternalPolicyData>::TypedPolicyBuilder() {
template class TypedPolicyBuilder<em::ExternalPolicyData>;
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
StringPolicyBuilder::StringPolicyBuilder() = default;
void StringPolicyBuilder::Build() {

@@ -226,7 +226,7 @@ using ComponentCloudPolicyBuilder =
TypedPolicyBuilder<enterprise_management::ExternalPolicyData>;
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
using ComponentActiveDirectoryPolicyBuilder = StringPolicyBuilder;
#endif

@@ -27,7 +27,7 @@ namespace policy {
namespace {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Checks if two schemas are the same or not. Note that this function doesn't
// consider restrictions on integers and strings nor pattern properties.
bool IsSameSchema(Schema a, Schema b) {
@@ -170,7 +170,7 @@ TEST(GeneratePolicySource, ChromeSchemaData) {
ASSERT_EQ(base::Value::Type::STRING, subschema.type());
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
subschema = schema.GetKnownProperty(key::kPowerManagementIdleSettings);
ASSERT_TRUE(subschema.valid());
@@ -201,7 +201,7 @@ TEST(GeneratePolicySource, PolicyScope) {
ASSERT_TRUE(details);
EXPECT_EQ(kBrowser, details->scope);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
details = GetChromePolicyDetails(key::kDeviceGuestModeEnabled);
ASSERT_TRUE(details);
EXPECT_EQ(kDevice, details->scope);
@@ -232,7 +232,7 @@ TEST(GeneratePolicySource, PolicyDetails) {
EXPECT_EQ(0u, details->max_external_data_size);
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
details = GetChromePolicyDetails(key::kDevicePolicyRefreshRate);
ASSERT_TRUE(details);
EXPECT_FALSE(details->is_deprecated);

@@ -53,7 +53,7 @@ void PlatformManagementService::AddLocalBrowserManagementStatusProvider(
has_local_browser_managment_status_provider_ = true;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
void PlatformManagementService::AddChromeOsStatusProvider(
std::unique_ptr<ManagementStatusProvider> provider) {
AddManagementStatusProvider(std::move(provider));

@@ -29,7 +29,7 @@ class POLICY_EXPORT PlatformManagementService : public ManagementService {
return has_local_browser_managment_status_provider_;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
void AddChromeOsStatusProvider(
std::unique_ptr<ManagementStatusProvider> provider);
bool has_cros_status_provider() const { return has_cros_status_provider_; }
@@ -57,7 +57,7 @@ class POLICY_EXPORT PlatformManagementService : public ManagementService {
~PlatformManagementService() override;
bool has_local_browser_managment_status_provider_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
bool has_cros_status_provider_;
#endif
};

@@ -26,13 +26,13 @@ namespace {
#if !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_ANDROID)
constexpr const char* kDictionaryPoliciesToMerge[] = {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
key::kExtensionSettings, key::kDeviceLoginScreenPowerManagement,
key::kKeyPermissions, key::kPowerManagementIdleSettings,
key::kScreenBrightnessPercent, key::kScreenLockDelays,
#else
key::kExtensionSettings,
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
};
#endif // !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_ANDROID)

@@ -28,13 +28,13 @@ const char kFileStorageServerUploadUrl[] = "file-storage-server-upload-url";
// line flag. Can be used only for unit tests or browser tests.
const char kPolicyVerificationKey[] = "policy-verification-key";
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Disables the verification of policy signing keys. It just works on Chrome OS
// test images and crashes otherwise.
// TODO(crbug.com/1225054): This flag might introduce security risks. Find a
// better solution to enable policy tast test for Family Link account.
const char kDisablePolicyKeyVerification[] = "disable-policy-key-verification";
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Specifies the base URL to contact the secure connect Api.
const char kSecureConnectApiUrl[] = "secure-connect-api-url";

@@ -20,9 +20,9 @@ extern const char kChromePolicy[];
extern const char kSecureConnectApiUrl[];
extern const char kFileStorageServerUploadUrl[];
extern const char kPolicyVerificationKey[];
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
extern const char kDisablePolicyKeyVerification[];
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} // namespace switches
} // namespace policy

@@ -187,7 +187,7 @@ std::string RemoteCommandsService::GetRequestType(
case PolicyInvalidationScope::kCBCM:
return dm_protocol::kChromeBrowserRemoteCommandType;
case PolicyInvalidationScope::kUser:
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return dm_protocol::kChromeAshUserRemoteCommandType;
#else
return dm_protocol::kChromeUserRemoteCommandType;

@@ -37,7 +37,7 @@
#include "components/prefs/android/pref_service_android.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
namespace pref_service_util {
void GetAllDottedPaths(std::string_view prefix,
const base::Value::Dict& dict,
@@ -63,7 +63,7 @@ void GetAllDottedPaths(const base::Value::Dict& dict,
GetAllDottedPaths("", dict, paths);
}
} // namespace pref_service_util
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
PrefService::PersistentPrefStoreLoadingObserver::
PersistentPrefStoreLoadingObserver(PrefService* pref_service)

@@ -62,7 +62,7 @@ class PrefMemberBase;
class ScopedUserPrefUpdateBase;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
namespace pref_service_util {
// Gets all the dotted paths from `dict`. For example if values stored are
// `{"a" : { "b" : true, "c": false }}`, then `paths` gets ["a.b", "a.c"].

@@ -31,7 +31,7 @@ const char kPrefName[] = "pref.name";
} // namespace
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST(PrefServiceUtilTest, GetAllDottedPaths) {
using pref_service_util::GetAllDottedPaths;

@@ -146,7 +146,7 @@ std::string TokenServiceLoadCredentialsStateToLabel(
NOTREACHED();
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
std::string SigninStatusFieldToLabel(
signin_internals_util::TimedSigninStatusField field) {
switch (field) {
@@ -163,7 +163,7 @@ std::string SigninStatusFieldToLabel(
}
NOTREACHED();
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
// It's quite unfortunate that |time| is saved in prefs as a string instead of
// base::Time because any change of the format would create inconsistency.
@@ -718,7 +718,7 @@ base::Value::Dict AboutSigninInternals::SigninStatus::ToValue(
AddSectionEntry(basic_info, "Network calls delayed",
signin_client->AreNetworkCallsDelayed() ? "True" : "False");
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
const auto& last_signout_value =
timed_signin_fields[signin_internals_util::LAST_SIGNOUT_SOURCE -
signin_internals_util::TIMED_FIELDS_BEGIN];
@@ -726,12 +726,12 @@ base::Value::Dict AboutSigninInternals::SigninStatus::ToValue(
basic_info,
SigninStatusFieldToLabel(signin_internals_util::LAST_SIGNOUT_SOURCE),
last_signout_value.first, last_signout_value.second);
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
AddSection(signin_info, std::move(basic_info), "Basic Information");
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Time and status information of the possible sign in types.
{
base::Value::List detailed_info;
@@ -776,7 +776,7 @@ base::Value::Dict AboutSigninInternals::SigninStatus::ToValue(
AddSection(signin_info, std::move(detailed_info), "Last Signin Details");
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
base::Value::Dict signin_status;
signin_status.Set("signin_info", std::move(signin_info));

@@ -61,11 +61,8 @@
#endif
#if BUILDFLAG(IS_CHROMEOS)
#include "components/account_manager_core/mock_account_manager_facade.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chromeos/ash/components/install_attributes/stub_install_attributes.h"
#include "components/account_manager_core/mock_account_manager_facade.h"
#endif
using signin_metrics::AccountReconcilorState;
@@ -340,7 +337,7 @@ class AccountReconcilorTest : public ::testing::Test {
network::TestURLLoaderFactory test_url_loader_factory_;
signin::ConsentLevel consent_level_for_reconcile_ =
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// TODO(crbug.com/40067189): Migrate away from
// `ConsentLevel::kSync` on Ash.
signin::ConsentLevel::kSync;
@@ -827,7 +824,7 @@ class AccountReconcilorTestTable
}
};
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(AccountReconcilorMirrorTest, IdentityManagerRegistration) {
AccountReconcilor* reconcilor = GetMockReconcilor();
ASSERT_TRUE(reconcilor);
@@ -860,7 +857,7 @@ TEST_F(AccountReconcilorMirrorTest, Reauth) {
ASSERT_TRUE(reconcilor->IsRegisteredWithIdentityManager());
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(AccountReconcilorMirrorTest, ProfileAlreadyConnected) {
ConnectProfileToAccount(kFakeEmail);
@@ -2364,7 +2361,7 @@ TEST_F(AccountReconcilorMirrorTest,
ASSERT_TRUE(reconcilor->is_reconcile_started_);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// This test is needed until chrome changes to use gaia obfuscated id.
// The primary account manager and token service use the gaia "email" property,
// which preserves dots in usernames and preserves case.
@@ -2507,7 +2504,7 @@ TEST_F(AccountReconcilorTest, AuthErrorTriggersListAccount) {
identity_test_env()->identity_manager()->RemoveObserver(&observer);
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// This test does not run on ChromeOS because it clears the primary account,
// which is not a flow that exists on ChromeOS.
@@ -2546,7 +2543,7 @@ TEST_F(AccountReconcilorMirrorTest, SignoutAfterErrorDoesNotRecordUma) {
expected_counts["Signin.Reconciler.Duration.UpTo3mins.Failure"] = 1;
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(AccountReconcilorMirrorTest, StartReconcileRemoveFromCookie) {
AccountInfo account_info = ConnectProfileToAccount(kFakeEmail);

@@ -40,7 +40,7 @@ bool MirrorAccountReconcilorDelegate::ShouldAbortReconcileIfPrimaryHasError()
ConsentLevel MirrorAccountReconcilorDelegate::GetConsentLevelForPrimaryAccount()
const {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// TODO(crbug.com/40067189): Migrate away from `ConsentLevel::kSync` on
// Ash.
return ConsentLevel::kSync;

@@ -34,7 +34,7 @@
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "ash/constants/ash_features.h"
#endif

@@ -199,7 +199,7 @@ AccountTrackerService::~AccountTrackerService() {
// static
void AccountTrackerService::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterListPref(prefs::kAccountInfo);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
registry->RegisterIntegerPref(prefs::kAccountIdMigrationState,
AccountTrackerService::MIGRATION_NOT_STARTED);
#endif
@@ -265,7 +265,7 @@ AccountInfo AccountTrackerService::FindAccountInfoByEmail(
return AccountInfo();
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
AccountTrackerService::AccountIdMigrationState
AccountTrackerService::GetMigrationState() const {
return GetMigrationState(pref_service_);
@@ -456,7 +456,7 @@ void AccountTrackerService::ResetForTesting() {
Initialize(prefs, base::FilePath());
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
void AccountTrackerService::MigrateToGaiaId() {
DCHECK_EQ(GetMigrationState(), MIGRATION_IN_PROGRESS);
@@ -501,7 +501,7 @@ void AccountTrackerService::MigrateToGaiaId() {
accounts_.erase(account_id);
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
bool AccountTrackerService::AreAllAccountsMigrated() const {
for (const auto& pair : accounts_) {
@@ -513,7 +513,7 @@ bool AccountTrackerService::AreAllAccountsMigrated() const {
return true;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
AccountTrackerService::AccountIdMigrationState
AccountTrackerService::ComputeNewMigrationState() const {
if (accounts_.empty()) {
@@ -550,7 +550,7 @@ AccountTrackerService::GetMigrationState(const PrefService* pref_service) {
return static_cast<AccountTrackerService::AccountIdMigrationState>(
pref_service->GetInteger(prefs::kAccountIdMigrationState));
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
base::FilePath AccountTrackerService::GetImagePathFor(
const CoreAccountId& account_id) {
@@ -738,7 +738,7 @@ void AccountTrackerService::LoadFromPrefs() {
RemoveAccountImageFromDisk(account_id);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (GetMigrationState() != MIGRATION_DONE) {
const AccountIdMigrationState new_state = ComputeNewMigrationState();
SetMigrationState(new_state);
@@ -756,7 +756,7 @@ void AccountTrackerService::LoadFromPrefs() {
#else
DCHECK(AreAllAccountsMigrated())
<< "accounts = " << AccountsToString(accounts_);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
UMA_HISTOGRAM_COUNTS_100("Signin.AccountTracker.CountOfLoadedAccounts",
accounts_.size());
@@ -825,7 +825,7 @@ void AccountTrackerService::RemoveFromPrefs(const AccountInfo& account_info) {
CoreAccountId AccountTrackerService::PickAccountIdForAccount(
const GaiaId& gaia,
const std::string& email) const {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
DCHECK(!email.empty());
switch (GetMigrationState(pref_service_)) {
case MIGRATION_NOT_STARTED:

@@ -60,7 +60,7 @@ class AccountTrackerService {
typedef base::RepeatingCallback<void(const AccountInfo& info)>
AccountInfoCallback;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Possible values for the kAccountIdMigrationState preference.
// Keep in sync with OAuth2LoginAccountRevokedMigrationState histogram enum.
// These values are persisted to logs. Entries should not be renumbered and
@@ -133,7 +133,7 @@ class AccountTrackerService {
void RemoveAccount(const CoreAccountId& account_id);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
AccountIdMigrationState GetMigrationState() const;
void SetMigrationDone();
#endif
@@ -217,7 +217,7 @@ class AccountTrackerService {
// be the case when the migration state is set to MIGRATION_DONE.
bool AreAllAccountsMigrated() const;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Migrate accounts to be keyed by gaia id instead of normalized email.
// Requires that the migration state is set to MIGRATION_IN_PROGRESS.
void MigrateToGaiaId();
@@ -233,7 +233,7 @@ class AccountTrackerService {
// Returns the saved migration state in the preferences.
static AccountIdMigrationState GetMigrationState(
const PrefService* pref_service);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Update the child status on the provided account.
// This does not notify observers, or persist updates to disk - the caller

@@ -50,7 +50,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "ash/constants/ash_features.h"
#endif
@@ -85,7 +85,7 @@ const AccountKey kAccountKeyIncomplete = {"incomplete"};
const AccountKey kAccountKeyFooBar = {"foobar"};
const AccountKey kAccountKeyFooDotBar = {"foo.bar"};
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_IOS)
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_IOS)
const AccountKey kAccountKeyAdvancedProtection = {"advanced_protection"};
#endif
@@ -387,7 +387,7 @@ class AccountTrackerServiceTest : public testing::Test {
DCHECK(!account_tracker_);
DCHECK(!account_fetcher_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
pref_service_.SetInteger(prefs::kAccountIdMigrationState,
AccountTrackerService::MIGRATION_NOT_STARTED);
#endif
@@ -983,7 +983,7 @@ TEST_F(AccountTrackerServiceTest, Persistence) {
true);
#endif
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
account_tracker()->SetIsAdvancedProtectionAccount(
AccountKeyToAccountId(kAccountKeyBeta), true);
#endif
@@ -997,7 +997,7 @@ TEST_F(AccountTrackerServiceTest, Persistence) {
CheckAccountDetails(kAccountKeyBeta, infos[0]);
CheckAccountCapabilities(kAccountKeyBeta, infos[0]);
EXPECT_EQ(signin::Tribool::kTrue, infos[0].is_child_account);
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
EXPECT_TRUE(infos[0].is_under_advanced_protection);
#else
EXPECT_FALSE(infos[0].is_under_advanced_protection);
@@ -1215,7 +1215,7 @@ TEST_F(AccountTrackerServiceTest, TimerRefresh) {
EXPECT_FALSE(account_fetcher()->AreAllAccountCapabilitiesFetched());
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(AccountTrackerServiceTest, MigrateAccountIdToGaiaId) {
const std::string email_alpha = AccountKeyToEmail(kAccountKeyAlpha);
const std::string gaia_alpha = AccountKeyToGaiaId(kAccountKeyAlpha);
@@ -1368,7 +1368,7 @@ TEST_F(AccountTrackerServiceTest, GaiaIdMigrationCrashInTheMiddle) {
accounts = account_tracker()->GetAccounts();
EXPECT_EQ(2u, accounts.size());
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
TEST_F(AccountTrackerServiceTest, ChildAccountBasic) {
SimulateTokenAvailable(kAccountKeyChild);
@@ -1618,7 +1618,7 @@ TEST_F(AccountTrackerServiceTest, RemoveAccountBeforeCapabilitiesFetched) {
EXPECT_TRUE(account_fetcher()->AreAllAccountCapabilitiesFetched());
}
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_IOS)
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_IOS)
TEST_F(AccountTrackerServiceTest, AdvancedProtectionAccountBasic) {
SimulateTokenAvailable(kAccountKeyAdvancedProtection);
IssueAccessToken(kAccountKeyAdvancedProtection);
@@ -1647,7 +1647,7 @@ TEST_F(AccountTrackerServiceTest, CountOfLoadedAccounts_NoAccount) {
}
TEST_F(AccountTrackerServiceTest, CountOfLoadedAccounts_TwoAccounts) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
prefs()->SetInteger(prefs::kAccountIdMigrationState,
AccountTrackerService::MIGRATION_DONE);
#endif
@@ -1677,7 +1677,7 @@ TEST_F(AccountTrackerServiceTest, CountOfLoadedAccounts_TwoAccounts) {
testing::ElementsAre(base::Bucket(2, 1)));
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(AccountTrackerServiceTest, Migrate_CountOfLoadedAccounts_TwoAccounts) {
const std::string email_alpha = AccountKeyToEmail(kAccountKeyAlpha);
const std::string gaia_alpha = AccountKeyToGaiaId(kAccountKeyAlpha);

@@ -50,7 +50,7 @@ CoreAccountId AccountsMutatorImpl::AddOrUpdateAccount(
const std::vector<uint8_t>& wrapped_binding_key
#endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
NOTREACHED();
#else
CoreAccountId account_id =
@@ -93,7 +93,7 @@ void AccountsMutatorImpl::UpdateAccountInfo(
void AccountsMutatorImpl::RemoveAccount(
const CoreAccountId& account_id,
signin_metrics::SourceForRefreshTokenOperation source) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
NOTREACHED();
#else
token_service_->RevokeCredentials(account_id, source);
@@ -102,7 +102,7 @@ void AccountsMutatorImpl::RemoveAccount(
void AccountsMutatorImpl::RemoveAllAccounts(
signin_metrics::SourceForRefreshTokenOperation source) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
NOTREACHED();
#else
token_service_->RevokeAllCredentials(source);
@@ -111,7 +111,7 @@ void AccountsMutatorImpl::RemoveAllAccounts(
void AccountsMutatorImpl::InvalidateRefreshTokenForPrimaryAccount(
signin_metrics::SourceForRefreshTokenOperation source) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
NOTREACHED();
#else
DCHECK(primary_account_manager_->HasPrimaryAccount(ConsentLevel::kSignin));
@@ -153,7 +153,7 @@ void AccountsMutatorImpl::MoveAccount(AccountsMutator* target,
}
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
CoreAccountId AccountsMutatorImpl::SeedAccountInfo(const GaiaId& gaia_id,
const std::string& email) {
return account_tracker_service_->SeedAccountInfo(gaia_id, email);

@@ -67,7 +67,7 @@ class AccountsMutatorImpl : public AccountsMutator {
const CoreAccountId& account_id) override;
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
CoreAccountId SeedAccountInfo(const GaiaId& gaia,
const std::string& email) override;
#endif

@@ -343,7 +343,7 @@ void PrimaryAccountManager::PrepareToLoadPrefs() {
prefs->SetBoolean(prefs::kGoogleServicesConsentedToSync, false);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Migrate primary account ID from email to Gaia ID if needed.
std::string pref_account_id =
prefs->GetString(prefs::kGoogleServicesAccountId);
@@ -612,7 +612,7 @@ void PrimaryAccountManager::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
void PrimaryAccountManager::ClearPrimaryAccount(
signin_metrics::ProfileSignout signout_source_metric) {
StartSignOut(signout_source_metric, RemoveAccountsOption::kRemoveAllAccounts);
@@ -624,7 +624,7 @@ void PrimaryAccountManager::RemovePrimaryAccountButKeepTokens(
RemoveAccountsOption::kKeepAllAccountsAndClearPrimary);
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
void PrimaryAccountManager::RevokeSyncConsent(
signin_metrics::ProfileSignout signout_source_metric) {
@@ -795,7 +795,7 @@ void PrimaryAccountManager::FirePrimaryAccountChanged(
void PrimaryAccountManager::OnRefreshTokensLoaded() {
token_service_observation_.Reset();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (account_tracker_service_->GetMigrationState() ==
AccountTrackerService::MIGRATION_IN_PROGRESS) {
account_tracker_service_->SetMigrationDone();

@@ -128,7 +128,7 @@ class PrimaryAccountManager : public ProfileOAuth2TokenServiceObserver {
// Signout API surfaces (not supported on ChromeOS, where signout is not
// permitted).
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Clears the primary account, erasing all keys associated with the primary
// account (also cancels all auth in progress).
// It removes all accounts from the identity manager by revoking all refresh
@@ -141,7 +141,7 @@ class PrimaryAccountManager : public ProfileOAuth2TokenServiceObserver {
void RemovePrimaryAccountButKeepTokens(
signin_metrics::ProfileSignout signout_source_metric);
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
// Rovokes the sync consent but leaves the primary account and the rest of
// the accounts untouched.

@@ -204,7 +204,7 @@ class PrimaryAccountManagerTest : public testing::Test,
int num_unconsented_account_changed_{0};
};
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(PrimaryAccountManagerTest, SignOut) {
CreatePrimaryAccountManager();
CoreAccountId main_account_id =
@@ -385,7 +385,7 @@ TEST_F(PrimaryAccountManagerTest, RevokeSyncConsentAllowedSignoutProhibited) {
EXPECT_FALSE(manager_->HasPrimaryAccount(ConsentLevel::kSync));
EXPECT_TRUE(manager_->HasPrimaryAccount(ConsentLevel::kSignin));
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
manager_->ClearPrimaryAccount(signin_metrics::ProfileSignout::kTest);
EXPECT_TRUE(manager_->HasPrimaryAccount(ConsentLevel::kSignin));
CheckSigninMetrics({.sign_in = AccessPoint::ACCESS_POINT_UNKNOWN,
@@ -518,7 +518,7 @@ TEST_F(PrimaryAccountManagerTest,
kLastSignedInUsername);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(PrimaryAccountManagerTest, GaiaIdMigration) {
ASSERT_EQ(AccountTrackerService::MIGRATION_DONE,
account_tracker()->GetMigrationState());
@@ -757,7 +757,7 @@ TEST_F(PrimaryAccountManagerTest, RevokeSyncConsent) {
manager_->GetPrimaryAccountInfo(ConsentLevel::kSignin).account_id);
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(PrimaryAccountManagerTest, ClearPrimaryAccount) {
CreatePrimaryAccountManager();
CoreAccountId account_id = AddToAccountTracker("gaia_id", "user@gmail.com");
@@ -771,7 +771,7 @@ TEST_F(PrimaryAccountManagerTest, ClearPrimaryAccount) {
EXPECT_FALSE(manager_->HasPrimaryAccount(ConsentLevel::kSync));
EXPECT_FALSE(manager_->HasPrimaryAccount(ConsentLevel::kSignin));
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(PrimaryAccountManagerTest,
RecordExistingPreviousSyncAccountIfCurrentlySignedOut) {
@@ -1005,7 +1005,7 @@ TEST_F(PrimaryAccountManagerTest, ExplicitSigninPref) {
EXPECT_TRUE(prefs()->GetBoolean(
kExplicitBrowserSigninWithoutFeatureEnabledForTesting));
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Clearing signin.
manager_->ClearPrimaryAccount(signin_metrics::ProfileSignout::kTest);

@@ -55,7 +55,7 @@ PrimaryAccountMutatorImpl::SetPrimaryAccount(
DCHECK(!account_info.email.empty());
DCHECK(!account_info.gaia.empty());
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
bool is_signin_allowed = pref_service_->GetBoolean(prefs::kSigninAllowed);
if (!is_signin_allowed)
return PrimaryAccountError::kSigninNotAllowed;
@@ -63,7 +63,7 @@ PrimaryAccountMutatorImpl::SetPrimaryAccount(
switch (consent_level) {
case ConsentLevel::kSync:
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// TODO(crbug.com/40067025): Replace with NOTREACHED on iOS after all
// flows have been migrated away from kSync. See ConsentLevel::kSync
// documentation for details.
@@ -72,7 +72,7 @@ PrimaryAccountMutatorImpl::SetPrimaryAccount(
#endif
break;
case ConsentLevel::kSignin:
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// On Chrome OS the UPA can only be set once and never removed or changed.
DCHECK(
!primary_account_manager_->HasPrimaryAccount(ConsentLevel::kSignin));
@@ -98,7 +98,7 @@ PrimaryAccountMutatorImpl::SetPrimaryAccount(
return PrimaryAccountError::kNoError;
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Users cannot revoke the Sync consent on Ash. They can only turn off all Sync
// data types if they want. Revoking sync consent can lead to breakages in
// IdentityManager dependencies like `chrome.identity` extension API - that
@@ -130,6 +130,6 @@ bool PrimaryAccountMutatorImpl::RemovePrimaryAccountButKeepTokens(
primary_account_manager_->RemovePrimaryAccountButKeepTokens(source_metric);
return true;
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
} // namespace signin

@@ -35,16 +35,16 @@ class PrimaryAccountMutatorImpl : public PrimaryAccountMutator {
ConsentLevel consent_level,
signin_metrics::AccessPoint access_point,
base::OnceClosure prefs_committed_callback) override;
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
void RevokeSyncConsent(signin_metrics::ProfileSignout source_metric) override;
bool ClearPrimaryAccount(
signin_metrics::ProfileSignout source_metric) override;
bool RemovePrimaryAccountButKeepTokens(
signin_metrics::ProfileSignout source_metric) override;
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
private:
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Returns true if transitioning from Sync to Signin consent level is allowed
// for this platform / configuration.
bool CanTransitionFromSyncToSigninConsentLevel() const;

@@ -436,7 +436,7 @@ bool ProfileOAuth2TokenService::HasLoadCredentialsFinishedWithNoErrors() {
void ProfileOAuth2TokenService::RecreateDeviceIdIfNeeded() {
// On ChromeOS the device ID is not managed by the token service.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
if (AreAllCredentialsLoaded() && HasLoadCredentialsFinishedWithNoErrors() &&
GetAccounts().empty()) {
signin::RecreateSigninScopedDeviceId(user_prefs_);

@@ -185,8 +185,6 @@ std::unique_ptr<ProfileOAuth2TokenService> BuildProfileOAuth2TokenService(
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
bool delete_signin_cookies_on_exit,
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
scoped_refptr<TokenWebData> token_web_data,
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
unexportable_keys::UnexportableKeyService* unexportable_key_service,
@@ -201,7 +199,7 @@ std::unique_ptr<ProfileOAuth2TokenService> BuildProfileOAuth2TokenService(
#endif
SigninClient* signin_client) {
// On ChromeOS the device ID is not managed by the token service.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Ensure the device ID is not empty. This is important for Dice, because the
// device ID is needed on the network thread, but can only be generated on the
// main thread.

@@ -14,7 +14,7 @@
namespace signin {
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
std::string GetSigninScopedDeviceId(PrefService* prefs) {
std::string signin_scoped_device_id =

@@ -14,7 +14,7 @@ class PrefService;
namespace signin {
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Returns device id that is scoped to single signin. This device id will be
// regenerated if user signs out and signs back in.

@@ -15,7 +15,7 @@
namespace signin {
namespace {
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST(DeviceIdHelper, GenerateSigninScopedDeviceId) {
EXPECT_FALSE(GenerateSigninScopedDeviceId().empty());

@@ -8,7 +8,7 @@
namespace prefs {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// A boolean pref - should unauthenticated user should be logged out
// automatically. Default value is false.
const char kForceLogoutUnauthenticatedUserEnabled[] =
@@ -18,7 +18,7 @@ const char kForceLogoutUnauthenticatedUserEnabled[] =
// email to gaia id for the the profile. See account_tracker_service.h
// for possible values.
const char kAccountIdMigrationState[] = "account_id_migration_state";
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Name of the preference property that persists the account information
// tracked by this signin.

@@ -12,7 +12,7 @@
namespace prefs {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
COMPONENT_EXPORT(SIGNIN_SWITCHES)
extern const char kForceLogoutUnauthenticatedUserEnabled[];
COMPONENT_EXPORT(SIGNIN_SWITCHES)

@@ -180,14 +180,14 @@ bool IsBatchUploadDesktopEnabled() {
} // namespace switches
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Enables the generation of pseudo-stable per-user per-device device
// identifiers. This identifier can be reset by the user by powerwashing the
// device.
BASE_FEATURE(kStableDeviceId,
"StableDeviceId",
base::FEATURE_DISABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Disables signout for enteprise managed profiles
BASE_FEATURE(kDisallowManagedProfileSignout,

@@ -151,10 +151,10 @@ bool IsBatchUploadDesktopEnabled();
// TODO(crbug.com/337879458): Move switches below into the switches namespace.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
COMPONENT_EXPORT(SIGNIN_SWITCHES)
BASE_DECLARE_FEATURE(kStableDeviceId);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
COMPONENT_EXPORT(SIGNIN_SWITCHES)
BASE_DECLARE_FEATURE(kDisallowManagedProfileSignout);

@@ -125,7 +125,7 @@ bool IsUnconsentedSignedInOAuth2Scopes(const std::string& scope) {
GaiaConstants::kAidaOAuth2Scope,
// Required by ChromeOS only.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
GaiaConstants::kAssistantOAuth2Scope,
GaiaConstants::kAuditRecordingOAuth2Scope,
GaiaConstants::kCastBackdropOAuth2Scope,
@@ -141,7 +141,7 @@ bool IsUnconsentedSignedInOAuth2Scopes(const std::string& scope) {
GaiaConstants::kContactsOAuth2Scope,
GaiaConstants::kPhotosOAuth2Scope,
GaiaConstants::kTachyonOAuthScope,
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// clang-format on
});

@@ -46,7 +46,7 @@ const AccessTokenRestrictionTestParam kTestParams[] = {
{GaiaConstants::kCloudSearchQueryOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
{GaiaConstants::kOAuth1LoginScope, OAuth2ScopeRestriction::kSignedIn},
{GaiaConstants::kCalendarReadOnlyOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
{GaiaConstants::kAssistantOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
{GaiaConstants::kAuditRecordingOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
{GaiaConstants::kCastBackdropOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
@@ -62,7 +62,7 @@ const AccessTokenRestrictionTestParam kTestParams[] = {
{GaiaConstants::kContactsOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
{GaiaConstants::kPhotosOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
{GaiaConstants::kTachyonOAuthScope, OAuth2ScopeRestriction::kSignedIn},
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
{GaiaConstants::kAnyApiOAuth2Scope, OAuth2ScopeRestriction::kPrivilegedOAuth2Consumer},
{GaiaConstants::kChromeSyncSupervisedOAuth2Scope, OAuth2ScopeRestriction::kExplicitConsent},
{GaiaConstants::kKidManagementPrivilegedOAuth2Scope, OAuth2ScopeRestriction::kExplicitConsent},

@@ -84,7 +84,7 @@ class AccountsMutator {
const CoreAccountId& account_id) = 0;
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Seeds account into AccountTrackerService. Used by UserSessionManager to
// manually seed the primary account before credentials are loaded.
// TODO(crbug.com/40176006): Remove after adding an account cache to

@@ -26,7 +26,7 @@
namespace {
const char kTestEmail[] = "test_user@test.com";
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
const char kTestGaiaId[] = "gaia-id-test_user-test.com";
const char kTestGaiaId2[] = "gaia-id-test_user-2-test.com";
const char kTestEmail2[] = "test_user@test-2.com";
@@ -208,7 +208,7 @@ TEST_F(AccountsMutatorTest, UpdateAccountInfo) {
EXPECT_EQ(Tribool::kFalse, reset_account_info.is_child_account);
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Test that a new account gets added to the AccountTrackerService when calling
// AddOrUpdateAccount() and that a new refresh token becomes available for the
// passed account_id when adding an account for the first time.
@@ -617,7 +617,7 @@ TEST_F(AccountsMutatorTest, RemoveRefreshTokenFromSource) {
EXPECT_EQ("Settings::Signout",
identity_manager_diagnostics_observer()->token_remover_source());
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
TEST_F(AccountsMutatorTest, MoveAccount) {

@@ -559,7 +559,7 @@ class IdentityManager : public KeyedService,
#if BUILDFLAG(IS_CHROMEOS)
friend account_manager::AccountManagerFacade* GetAccountManagerFacade(
IdentityManager* identity_manager);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Temporary access to getters (e.g. GetTokenService()).
// TODO(crbug.com/40619310): Remove this friendship by

@@ -119,8 +119,6 @@ IdentityManager::InitParameters BuildIdentityManagerInitParameters(
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
params->delete_signin_cookies_on_exit,
#endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
params->token_web_data,
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
params->unexportable_key_service,

@@ -63,7 +63,7 @@
#include "components/signin/internal/identity_manager/child_account_info_fetcher_android.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/account_manager/account_manager_factory.h"
#include "components/account_manager_core/account.h"
#include "components/account_manager_core/account_manager_facade_impl.h"
@@ -271,7 +271,7 @@ class IdentityManagerTest : public testing::Test {
const std::string kTestLocale = "locale";
const std::string kTestPictureUrl = "http://picture.example.com/picture.jpg";
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const std::string kTestEmailWithPeriod = "m.e@gmail.com";
#endif
@@ -361,7 +361,7 @@ class IdentityManagerTest : public testing::Test {
account_tracker_service->Initialize(&pref_service_,
temp_profile_dir_.GetPath());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
account_manager::AccountManager::RegisterPrefs(pref_service_.registry());
auto* ash_account_manager = GetAccountManagerFactory()->GetAccountManager(
temp_profile_dir_.GetPath().value());
@@ -452,7 +452,7 @@ class IdentityManagerTest : public testing::Test {
token_service.get(), account_tracker_service.get(),
primary_account_manager.get(), &pref_service_);
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
init_params.account_manager_facade = account_manager_facade_.get();
#endif
init_params.signin_client = &signin_client_;
@@ -502,7 +502,7 @@ class IdentityManagerTest : public testing::Test {
return &test_url_loader_factory_;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ash::AccountManagerFactory* GetAccountManagerFactory() {
return &account_manager_factory_;
}
@@ -511,7 +511,7 @@ class IdentityManagerTest : public testing::Test {
private:
base::ScopedTempDir temp_profile_dir_;
base::test::TaskEnvironment task_environment_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ash::AccountManagerFactory account_manager_factory_;
std::unique_ptr<account_manager::AccountManagerFacadeImpl>
account_manager_facade_;
@@ -543,7 +543,7 @@ TEST_F(IdentityManagerTest, Construct) {
EXPECT_NE(identity_manager()->GetAccountsMutator(), nullptr);
EXPECT_EQ(identity_manager()->GetDeviceAccountsSynchronizer(), nullptr);
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
EXPECT_NE(identity_manager()->GetAccountManagerFacade(), nullptr);
#endif
}
@@ -564,7 +564,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAtStartup) {
// Signin/signout tests aren't relevant and cannot build on ChromeOS, which
// doesn't support signin/signout.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Test that the user signing in results in firing of the IdentityManager
// observer callback and the IdentityManager's state being updated.
TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSignin) {
@@ -674,7 +674,7 @@ TEST_F(IdentityManagerTest,
EXPECT_EQ(primary_account_id,
identity_manager()->GetPrimaryAccountId(ConsentLevel::kSignin));
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(IdentityManagerTest, HasPrimaryAccount) {
EXPECT_TRUE(
@@ -689,7 +689,7 @@ TEST_F(IdentityManagerTest, HasPrimaryAccount) {
identity_manager()->HasPrimaryAccount(signin::ConsentLevel::kSync));
EXPECT_TRUE(identity_manager()->HasPrimaryAccount(ConsentLevel::kSignin));
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Signing out should cause IdentityManager to recognize that there is no
// longer a primary account.
ClearPrimaryAccount(identity_manager());
@@ -1534,7 +1534,7 @@ TEST_F(IdentityManagerTest, GetAccountsCookieMutator) {
EXPECT_TRUE(mutator);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// On ChromeOS, AccountTrackerService first receives the normalized email
// address from GAIA and then later has it updated with the user's
// originally-specified version of their email address (at the time of that
@@ -1637,7 +1637,7 @@ TEST_F(IdentityManagerTest, CallbackSentOnSecondaryAccountRefreshTokenRemoval) {
identity_manager_observer()->AccountIdFromRefreshTokenRemovedCallback());
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(
IdentityManagerTest,
CallbackSentOnSecondaryAccountRefreshTokenUpdateWithValidTokenWhenNoPrimaryAccount) {
@@ -2308,7 +2308,7 @@ TEST_F(IdentityManagerTest, FindExtendedPrimaryAccountInfo) {
EXPECT_EQ(core_info.email, extended_info.email);
EXPECT_EQ(core_info.gaia, extended_info.gaia);
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// It's not possible to sign out on Ash.
ClearPrimaryAccount(identity_manager());
SetRefreshTokenForAccount(identity_manager(), core_info.account_id, "token");

@@ -44,7 +44,7 @@
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/account_manager/account_manager_factory.h"
#include "components/account_manager_core/account_manager_facade_impl.h"
#include "components/account_manager_core/chromeos/account_manager.h"
@@ -79,14 +79,14 @@ class IdentityManagerDependenciesOwner {
~IdentityManagerDependenciesOwner();
sync_preferences::TestingPrefServiceSyncable* pref_service();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ash::AccountManagerFactory* account_manager_factory();
account_manager::AccountManagerFacade* GetAccountManagerFacadeForEmptyPath();
#endif
TestSigninClient* signin_client();
private:
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<ash::AccountManagerFactory> account_manager_factory_;
std::unique_ptr<account_manager::AccountManagerFacadeImpl>
account_manager_facade_for_empty_path_;
@@ -105,7 +105,7 @@ IdentityManagerDependenciesOwner::IdentityManagerDependenciesOwner(
sync_preferences::TestingPrefServiceSyncable* pref_service_param,
TestSigninClient* signin_client_param)
:
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
account_manager_factory_(std::make_unique<ash::AccountManagerFactory>()),
#endif
owned_pref_service_(
@@ -119,7 +119,7 @@ IdentityManagerDependenciesOwner::IdentityManagerDependenciesOwner(
? nullptr
: std::make_unique<TestSigninClient>(pref_service())),
raw_signin_client_(signin_client_param) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
mojo::Remote<crosapi::mojom::AccountManager> remote;
crosapi::AccountManagerMojoService* account_manager_mojo_service =
account_manager_factory_->GetAccountManagerMojoService(std::string());
@@ -149,7 +149,7 @@ IdentityManagerDependenciesOwner::pref_service() {
: owned_pref_service_.get();
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ash::AccountManagerFactory*
IdentityManagerDependenciesOwner::account_manager_factory() {
DCHECK(account_manager_factory_);
@@ -224,7 +224,7 @@ IdentityTestEnvironment::IdentityTestEnvironment(
IdentityManager::RegisterProfilePrefs(test_pref_service->registry());
SigninPrefs::RegisterProfilePrefs(test_pref_service->registry());
IdentityManager::RegisterLocalStatePrefs(test_pref_service->registry());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
account_manager::AccountManager::RegisterPrefs(test_pref_service->registry());
owned_identity_manager_ = BuildIdentityManagerForTests(
@@ -234,12 +234,12 @@ IdentityTestEnvironment::IdentityTestEnvironment(
#else
owned_identity_manager_ = BuildIdentityManagerForTests(
test_signin_client, test_pref_service, base::FilePath());
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
Initialize();
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// static
std::unique_ptr<IdentityManager>
IdentityTestEnvironment::BuildIdentityManagerForTests(
@@ -303,7 +303,7 @@ IdentityTestEnvironment::BuildIdentityManagerForTests(
std::move(account_tracker_service), std::move(token_service),
signin_client, pref_service, user_data_dir);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
IdentityTestEnvironment::PendingRequest::PendingRequest(
CoreAccountId account_id,
@@ -328,7 +328,7 @@ IdentityTestEnvironment::FinishBuildIdentityManagerForTests(
SigninClient* signin_client,
PrefService* pref_service,
base::FilePath user_data_dir
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
,
account_manager::AccountManagerFacade* account_manager_facade
#endif
@@ -380,7 +380,7 @@ IdentityTestEnvironment::FinishBuildIdentityManagerForTests(
init_params.token_service = std::move(token_service);
// TODO: Set the account_manager_facade on Lacros once Mirror is enabled by
// default.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
init_params.account_manager_facade = account_manager_facade;
#endif
init_params.signin_client = signin_client;
@@ -448,11 +448,11 @@ AccountInfo IdentityTestEnvironment::MakePrimaryAccountAvailable(
consent_level);
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
void IdentityTestEnvironment::RevokeSyncConsent() {
signin::RevokeSyncConsent(identity_manager());
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
void IdentityTestEnvironment::ClearPrimaryAccount() {
signin::ClearPrimaryAccount(identity_manager());

@@ -30,7 +30,7 @@ class IdentityTestEnvironmentProfileAdaptor;
class PrefService;
class TestSigninClient;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
namespace account_manager {
class AccountManagerFacade;
}
@@ -38,7 +38,7 @@ class AccountManagerFacade;
namespace ash {
class AccountManagerFactory;
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace sync_preferences {
class TestingPrefServiceSyncable;
@@ -179,11 +179,11 @@ class IdentityTestEnvironment : public IdentityManager::DiagnosticsObserver,
AccountInfo MakePrimaryAccountAvailable(const std::string& email,
ConsentLevel consent_level);
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Revokes sync consent from the primary account: the primary account is left
// at ConsentLevel::kSignin.
void RevokeSyncConsent();
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
// Clears the primary account, removes all accounts and revokes the sync
// consent. Blocks until the primary account is cleared.
@@ -419,7 +419,7 @@ class IdentityTestEnvironment : public IdentityManager::DiagnosticsObserver,
SigninClient* signin_client,
PrefService* pref_service,
base::FilePath user_data_dir
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
,
ash::AccountManagerFactory* account_manager_factory,
account_manager::AccountManagerFacade* account_manager_facade
@@ -432,7 +432,7 @@ class IdentityTestEnvironment : public IdentityManager::DiagnosticsObserver,
SigninClient* signin_client,
PrefService* pref_service,
base::FilePath user_data_dir
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
,
account_manager::AccountManagerFacade* account_manager_facade
#endif

@@ -328,7 +328,7 @@ AccountInfo MakePrimaryAccountAvailable(IdentityManager* identity_manager,
return primary_account_info;
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// TODO(crbug.com/40067058): remove this function once `ConsentLevel::kSync` is
// removed.
void RevokeSyncConsent(IdentityManager* identity_manager) {
@@ -350,10 +350,10 @@ void RevokeSyncConsent(IdentityManager* identity_manager) {
signin_metrics::ProfileSignout::kTest);
run_loop.Run();
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
void ClearPrimaryAccount(IdentityManager* identity_manager) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// TODO(blundell): If we ever need this functionality on ChromeOS (which seems
// unlikely), plumb this through to just clear the primary account info
// synchronously with IdentityManager.

@@ -115,7 +115,7 @@ AccountInfo MakePrimaryAccountAvailable(IdentityManager* identity_manager,
const std::string& email,
ConsentLevel consent_level);
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Revokes sync consent from the primary account: the primary account is left
// at ConsentLevel::kSignin.
// NOTE: See disclaimer at top of file re: direct usage.
@@ -124,7 +124,7 @@ AccountInfo MakePrimaryAccountAvailable(IdentityManager* identity_manager,
// TODO(crbug.com/40067058): remove this function once `ConsentLevel::kSync` is
// removed.
void RevokeSyncConsent(IdentityManager* identity_manager);
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
// Clears the primary account, removes all accounts and revokes the sync
// consent (if applicable). Blocks until the primary account is cleared.

@@ -454,7 +454,7 @@ TEST_P(PrimaryAccountAccessTokenFetcherTest, IdentityManagerShutdownNoAccount) {
ShutdownIdentityManager();
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_P(PrimaryAccountAccessTokenFetcherTest,
ShouldNotRetryCanceledAccessTokenRequestIfSignedOut) {
@@ -531,7 +531,7 @@ INSTANTIATE_TEST_SUITE_P(All,
testing::Values(ConsentLevel::kSignin,
ConsentLevel::kSync));
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Chrome OS can directly set the unconsented primary account during login,
// so it has additional tests.
TEST_F(PrimaryAccountAccessTokenFetcherTest,
@@ -595,6 +595,6 @@ TEST_F(PrimaryAccountAccessTokenFetcherTest,
access_token_info().token, access_token_info().expiration_time,
access_token_info().id_token);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} // namespace signin

@@ -92,7 +92,7 @@ class PrimaryAccountMutator {
signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN,
base::OnceClosure prefs_committed_callback = base::NullCallback()) = 0;
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Revokes sync consent from the primary account: the primary account is left
// at ConsentLevel::kSignin.
//
@@ -111,7 +111,7 @@ class PrimaryAccountMutator {
// was successful and false if there was no primary account set.
virtual bool RemovePrimaryAccountButKeepTokens(
signin_metrics::ProfileSignout source_metric) = 0;
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
};
} // namespace signin

@@ -31,7 +31,7 @@ namespace {
// Constants used by the different tests.
const char kPrimaryAccountEmail[] = "primary.account@example.com";
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
const char kAnotherAccountEmail[] = "another.account@example.com";
const char kUnknownAccountId[] = "{unknown account id}";
#endif
@@ -100,7 +100,7 @@ class ClearPrimaryAccountTestObserver
scoped_observation_{this};
};
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Helper for testing of RevokeSyncConsent/ClearPrimaryAccount(). This function
// requires lots of tests due to having different behaviors based on its
// arguments. But the setup and execution of these test is all the boiler plate
@@ -308,7 +308,7 @@ void RunClearPrimaryAccountTestForSigninOnly() {
secondary_account_info.account_id));
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
} // namespace
@@ -387,7 +387,7 @@ TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_Sync) {
// ChromeOS, where those preconditions do not exist.
// TODO(crbug.com/41470280): Run these tests on ChromeOS if/once we
// enable those preconditions on that platform
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Checks that setting the primary account fails if the account is not known by
// the identity system.
TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_NoAccount) {
@@ -657,4 +657,4 @@ TEST_F(PrimaryAccountMutatorTest, RevokeSyncConsent) {
TEST_F(PrimaryAccountMutatorTest, ClearPrimaryAccount_SigninOnly) {
RunClearPrimaryAccountTestForSigninOnly();
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)

@@ -23,7 +23,7 @@ namespace signin {
const char kPlatform[] = "win";
#elif BUILDFLAG(IS_MAC)
const char kPlatform[] = "mac";
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
const char kPlatform[] = "chromeos";
#elif BUILDFLAG(IS_LINUX)
const char kPlatform[] = "linux";

@@ -95,15 +95,15 @@ TEST_F(SyncAuthManagerTest, IgnoresEventsIfNotRegistered) {
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
// ChromeOS doesn't support sign-out.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
identity_env()->ClearPrimaryAccount();
EXPECT_TRUE(
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
}
// ChromeOS doesn't support sign-out.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncAuthManagerTest, ForwardsPrimaryAccountEvents) {
// Start out already signed in before the SyncAuthManager is created.
CoreAccountId account_id =
@@ -181,10 +181,10 @@ TEST_F(SyncAuthManagerTest, NotifiesOfSignoutBeforeAccessTokenIsGone) {
ASSERT_TRUE(
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
// Unconsented primary accounts are only supported on Win/Mac/Linux.
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
TEST_F(SyncAuthManagerTest, ForwardsUnconsentedAccountEvents) {
base::MockCallback<AccountStateChangedCallback> account_state_changed;
base::MockCallback<CredentialsChangedCallback> credentials_changed;
@@ -215,11 +215,11 @@ TEST_F(SyncAuthManagerTest, ForwardsUnconsentedAccountEvents) {
EXPECT_TRUE(auth_manager->GetActiveAccountInfo().is_sync_consented);
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) &&
#endif // !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) &&
// !BUILDFLAG(IS_IOS)
// ChromeOS doesn't support sign-out.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncAuthManagerTest, ClearsAuthErrorOnSignoutWithRefreshTokenRemoval) {
// Start out already signed in before the SyncAuthManager is created.
CoreAccountId account_id =
@@ -284,7 +284,7 @@ TEST_F(SyncAuthManagerTest,
EXPECT_EQ(auth_manager->GetLastAuthError().state(),
GoogleServiceAuthError::NONE);
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncAuthManagerTest, DoesNotClearAuthErrorOnSyncDisable) {
// Start out already signed in before the SyncAuthManager is created.
@@ -897,7 +897,7 @@ TEST_F(SyncAuthManagerTest, PrimaryAccountWithNoSyncConsent) {
}
#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
// Primary account with no sync consent is not supported on Android and iOS.
// On CrOS the unconsented primary account can't be changed or removed, but can
// be granted sync consent.
@@ -939,7 +939,7 @@ TEST_F(SyncAuthManagerTest,
EXPECT_TRUE(
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) &&
#endif // !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) &&
// !BUILDFLAG(IS_IOS)
TEST_F(SyncAuthManagerTest, DetectsInvalidRefreshTokenAtStartup) {

@@ -34,7 +34,7 @@ void DisableSyncType(const std::string& type_name, PrefValueMap* prefs) {
}
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Check for OS types. This includes types that used to be browser types,
// like "apps" and "preferences".
std::optional<UserSelectableOsType> os_type =
@@ -42,7 +42,7 @@ void DisableSyncType(const std::string& type_name, PrefValueMap* prefs) {
if (os_type.has_value()) {
syncer::SyncPrefs::SetOsTypeDisabledByPolicy(prefs, *os_type);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
} // namespace

@@ -230,7 +230,7 @@ TEST(SyncPolicyHandlerTest, SyncTypesListDisabledUnknownEntry) {
EXPECT_TRUE(enabled);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST(SyncPolicyHandlerOsTest, SyncTypesListDisabled_OsTypes) {
// Start with prefs enabled so we can sense that they have changed.
@@ -293,7 +293,7 @@ TEST(SyncPolicyHandlerOsTest, SyncTypesListDisabled_MigratedTypes) {
ASSERT_TRUE(prefs.GetBoolean(prefs::internal::kSyncOsPreferences, &enabled));
EXPECT_FALSE(enabled);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} // namespace
} // namespace syncer

@@ -36,9 +36,9 @@ bool SyncService::IsSyncFeatureEnabled() const {
bool SyncService::CanSyncFeatureStart() const {
return GetDisableReasons().empty() &&
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
!GetUserSettings()->IsSyncFeatureDisabledViaDashboard() &&
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
HasSyncConsent();
}

@@ -373,14 +373,14 @@ void SyncServiceImpl::Initialize(DataTypeController::TypeVector controllers) {
// crash during signout).
if (HasDisableReason(DISABLE_REASON_ENTERPRISE_POLICY)) {
StopAndClear(ResetEngineReason::kEnterprisePolicy);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// On ChromeOS Ash, sync-the-feature stays disabled even after the policy is
// removed, for historic reasons. It is unclear if this behavior is
// optional, because it is indistinguishable from the
// sync-reset-via-dashboard case. It can be resolved by invoking
// SetSyncFeatureRequested().
sync_prefs_.SetSyncFeatureDisabledViaDashboard();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} else if (HasDisableReason(DISABLE_REASON_NOT_SIGNED_IN)) {
// On ChromeOS-Ash, signout is not possible, so it's not necessary to handle
// this case.
@@ -388,18 +388,18 @@ void SyncServiceImpl::Initialize(DataTypeController::TypeVector controllers) {
// ChromeOS-Ash since it's supposedly unreachable, *but* during the very
// first startup of a fresh profile, the signed-in account isn't known yet
// at this point (see also https://crbug.com/1458701#c7).
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
StopAndClear(ResetEngineReason::kNotSignedIn);
#endif
}
const bool is_sync_feature_requested_for_metrics =
IsLocalSyncEnabled() ||
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
!user_settings_->IsSyncFeatureDisabledViaDashboard();
#else
HasSyncConsent();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Note: We need to record the initial state *after* calling
// RegisterForAuthNotifications(), because before that the authenticated
@@ -832,9 +832,9 @@ base::android::ScopedJavaLocalRef<jobject> SyncServiceImpl::GetJavaObject() {
void SyncServiceImpl::SetSyncFeatureRequested() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
user_settings_->ClearSyncFeatureDisabledViaDashboard();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// If the Sync engine was already initialized (probably running in transport
// mode), just reconfigure.
@@ -1180,14 +1180,14 @@ void SyncServiceImpl::OnActionableProtocolError(
// should be okay.
StopAndClear(ResetEngineReason::kDisableSyncOnClient);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// On Ash, the primary account is always set and sync the feature
// turned on, so a dedicated bit is needed to ensure that
// Sync-the-feature remains off. Note that sync-the-transport will restart
// immediately because IsEngineAllowedToRun() is almost certainly true at
// this point and StopAndClear() leads to TryStart().
user_settings_->SetSyncFeatureDisabledViaDashboard();
#else // !BUILDFLAG(IS_CHROMEOS_ASH)
#else // !BUILDFLAG(IS_CHROMEOS)
// On every platform except ash, revoke the Sync consent/Clear primary
// account after a dashboard clear.
// TODO(crbug.com/40066949): Simplify once kSync becomes unreachable or is
@@ -1218,7 +1218,7 @@ void SyncServiceImpl::OnActionableProtocolError(
signin_metrics::ProfileSignout::kServerForcedDisable);
#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
break;
case STOP_SYNC_FOR_DISABLED_ACCOUNT:
// Sync disabled by domain admin. Stop syncing until next restart.
@@ -1672,7 +1672,7 @@ void SyncServiceImpl::ConfigureDataTypeManager(ConfigureReason reason) {
}
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
bool sync_everything_os = sync_prefs_.IsSyncAllOsTypesEnabled();
base::UmaHistogramBoolean("Sync.SyncEverythingOS", sync_everything_os);
if (!sync_everything_os) {
@@ -1682,7 +1682,7 @@ void SyncServiceImpl::ConfigureDataTypeManager(ConfigureReason reason) {
base::UmaHistogramEnumeration("Sync.CustomOSSync", canonical_data_type);
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
}
@@ -1775,14 +1775,14 @@ void SyncServiceImpl::OnSyncManagedPrefChange(bool is_sync_managed) {
if (is_sync_managed) {
StopAndClear(ResetEngineReason::kEnterprisePolicy);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// On ChromeOS Ash, sync-the-feature stays disabled even after the policy is
// removed, for historic reasons. It is unclear if this behavior is
// optional, because it is indistinguishable from the
// sync-reset-via-dashboard case. It can be resolved by invoking
// SetSyncFeatureRequested().
sync_prefs_.SetSyncFeatureDisabledViaDashboard();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} else {
// Sync is no longer disabled by policy. Try starting it up if appropriate.
DCHECK(!engine_);
@@ -1792,7 +1792,7 @@ void SyncServiceImpl::OnSyncManagedPrefChange(bool is_sync_managed) {
}
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
void SyncServiceImpl::OnFirstSetupCompletePrefChange(
bool is_initial_sync_feature_setup_complete) {
if (engine_ && engine_->IsInitialized()) {
@@ -1802,7 +1802,7 @@ void SyncServiceImpl::OnFirstSetupCompletePrefChange(
MaybeRecordTrustedVaultHistograms();
}
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
void SyncServiceImpl::OnAccountsCookieDeletedByUserAction() {
// Pass an empty `signin::AccountsInCookieJarInfo` to simulate empty cookies.
@@ -2075,13 +2075,13 @@ void SyncServiceImpl::StopAndClear(ResetEngineReason reset_engine_reason) {
// passphrase pref should be cleared before clearing
// InitialSyncFeatureSetupComplete().
sync_prefs_.ClearAllEncryptionBootstrapTokens();
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Note: ResetEngine() does *not* clear directly user-controlled prefs (such
// as the set of selected types), so that if the user ever chooses to enable
// Sync again, they start off with their previous settings by default.
// However, they do have to go through the initial setup again.
sync_prefs_.ClearInitialSyncFeatureSetupComplete();
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
sync_prefs_.ClearPassphrasePromptMutedProductVersion();
// Cached information provided by SyncEngine must be cleared.
sync_prefs_.ClearCachedPassphraseType();

@@ -213,10 +213,10 @@ class SyncServiceImpl : public SyncService,
// SyncPrefObserver implementation.
void OnSyncManagedPrefChange(bool is_sync_managed) override;
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
void OnFirstSetupCompletePrefChange(
bool is_initial_sync_feature_setup_complete) override;
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
void OnSelectedTypesPrefChange() override;
// KeyedService implementation. This must be called exactly

@@ -151,9 +151,9 @@ class SyncServiceImplStartupTest : public testing::Test {
void SetSyncFeatureEnabledPrefs() {
CHECK(!sync_service_);
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
sync_prefs_.SetInitialSyncFeatureSetupComplete();
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
}
SyncPrefs* sync_prefs() { return &sync_prefs_; }
@@ -189,7 +189,7 @@ class SyncServiceImplStartupTest : public testing::Test {
};
// ChromeOS does not support sign-in after startup
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplStartupTest, StartFirstTime) {
// We've never completed startup.
ASSERT_FALSE(sync_prefs()->IsInitialSyncFeatureSetupComplete());
@@ -250,7 +250,7 @@ TEST_F(SyncServiceImplStartupTest, StartFirstTime) {
EXPECT_EQ(SyncService::TransportState::ACTIVE,
sync_service()->GetTransportState());
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplStartupTest, StartNoCredentials) {
// We're already signed in, but don't have a refresh token.
@@ -391,7 +391,7 @@ TEST_F(SyncServiceImplStartupTest, StartInvalidCredentials) {
sync_service()->GetTransportState());
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplStartupTest, StartAshNoCredentials) {
// We've never completed startup.
ASSERT_FALSE(
@@ -460,7 +460,7 @@ TEST_F(SyncServiceImplStartupTest, ResetSyncViaDashboard) {
EXPECT_EQ(expected_transport_state_after_reset,
sync_service()->GetTransportState());
EXPECT_EQ(
BUILDFLAG(IS_CHROMEOS_ASH),
BUILDFLAG(IS_CHROMEOS),
sync_service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled());
@@ -474,7 +474,7 @@ TEST_F(SyncServiceImplStartupTest, ResetSyncViaDashboard) {
}
// ChromeOS does not support sign-in after startup.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Verify that enabling sync honors existing values of data type preferences.
TEST_F(SyncServiceImplStartupTest, HonorsExistingDatatypePrefs) {
// Explicitly set Keep Everything Synced to false and have only bookmarks
@@ -557,7 +557,7 @@ TEST_F(SyncServiceImplStartupTest, SwitchManaged) {
EXPECT_EQ(SyncService::DisableReasonSet(),
sync_service()->GetDisableReasons());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
EXPECT_TRUE(
sync_service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
// On ChromeOS Ash, sync-the-feature stays disabled even after the policy is
@@ -569,7 +569,7 @@ TEST_F(SyncServiceImplStartupTest, SwitchManaged) {
#else
EXPECT_FALSE(
sync_service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled());
EXPECT_FALSE(sync_service()->IsSyncFeatureActive());
@@ -584,9 +584,9 @@ TEST_F(SyncServiceImplStartupTest, StartDownloadFailed) {
ASSERT_FALSE(
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
ASSERT_FALSE(sync_prefs()->IsInitialSyncFeatureSetupComplete());
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
FastForwardUntilNoTasksRemain();
@@ -604,7 +604,7 @@ TEST_F(SyncServiceImplStartupTest, StartDownloadFailed) {
}
// ChromeOS does not support sign-in after startup.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplStartupTest, FullStartupSequenceFirstTime) {
// We've never completed startup.
ASSERT_FALSE(sync_prefs()->IsInitialSyncFeatureSetupComplete());
@@ -683,7 +683,7 @@ TEST_F(SyncServiceImplStartupTest, FullStartupSequenceFirstTime) {
sync_service()->GetTransportState());
EXPECT_TRUE(sync_service()->IsSyncFeatureActive());
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplStartupTest, FullStartupSequenceNthTime) {
// The user is already signed in and has completed Sync setup before.
@@ -769,7 +769,7 @@ TEST_F(SyncServiceImplStartupTest, DeferredStartInterruptedByDataType) {
}
// ChromeOS does not support sign-in after startup.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplStartupTest, UserTriggeredStartIsNotDeferredStart) {
// Signed-out at first.
base::HistogramTester histogram_tester;

@@ -245,11 +245,11 @@ class SyncServiceImplTest : public ::testing::Test {
/*keep_everything_synced=*/true,
/*registered_types=*/UserSelectableTypeSet::All(),
/*selected_types=*/UserSelectableTypeSet::All());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ASSERT_TRUE(sync_prefs.IsInitialSyncFeatureSetupComplete());
#else // BUILDFLAG(IS_CHROMEOS_ASH)
#else // BUILDFLAG(IS_CHROMEOS)
sync_prefs.SetInitialSyncFeatureSetupComplete();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
void SetInvalidationsEnabled() {
@@ -341,7 +341,7 @@ TEST_F(SyncServiceImplTest, SuccessfulLocalBackendInitialization) {
}
// ChromeOS Ash sets FirstSetupComplete automatically.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Verify that an initialization where first setup is not complete does not
// start up Sync-the-feature.
TEST_F(SyncServiceImplTest, NeedsConfirmation) {
@@ -373,7 +373,7 @@ TEST_F(SyncServiceImplTest, DataTypesForTransportMode) {
InitializeService();
base::RunLoop().RunUntilIdle();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Sync-the-feature is normally enabled in Ash. Triggering a dashboard reset
// is one way to achieve otherwise.
SyncProtocolError client_cmd;
@@ -457,7 +457,7 @@ TEST_F(SyncServiceImplTest, DisabledByPolicyBeforeInitThenPolicyRemoved) {
EXPECT_FALSE(service()->IsSyncFeatureActive());
EXPECT_TRUE(service()->GetDisableReasons().empty());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// On ChromeOS Ash, the first setup is marked as complete automatically.
ASSERT_TRUE(
service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
@@ -479,7 +479,7 @@ TEST_F(SyncServiceImplTest, DisabledByPolicyBeforeInitThenPolicyRemoved) {
service()->GetUserSettings()->SetInitialSyncFeatureSetupComplete(
syncer::SyncFirstSetupCompleteSource::BASIC_FLOW);
base::RunLoop().RunUntilIdle();
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Sync-the-feature is considered on.
EXPECT_EQ(SyncService::TransportState::ACTIVE,
@@ -528,7 +528,7 @@ TEST_F(SyncServiceImplTest, AbortedByShutdown) {
// Certain SyncServiceImpl tests don't apply to Chrome OS, for example
// things that deal with concepts like "signing out".
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
// Test the user signing out before the backend's initialization completes.
TEST_F(SyncServiceImplTest, EarlySignOut) {
// Set up a fake sync engine that will not immediately finish initialization.
@@ -557,11 +557,11 @@ TEST_F(SyncServiceImplTest, EarlySignOut) {
EXPECT_FALSE(service()->IsSyncFeatureActive());
EXPECT_FALSE(service()->IsSyncFeatureEnabled());
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
// Certain SyncServiceImpl tests don't apply to Chrome OS, for example
// things that deal with concepts like "signing out".
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplTest, SignOutDisablesSyncTransportAndSyncFeature) {
// Sign-in and enable sync.
PopulatePrefsForInitialSyncFeatureSetupComplete();
@@ -644,7 +644,7 @@ TEST_F(SyncServiceImplTest,
EXPECT_FALSE(
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(
SyncServiceImplTest,
@@ -664,7 +664,7 @@ TEST_F(
params.emplace_back(CONTACT_INFO, /*enable_transport_mode=*/true);
InitializeService(std::move(params));
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Sync-the-feature is normally enabled in Ash. Triggering a dashboard reset
// is one way to achieve otherwise.
SyncProtocolError client_cmd;
@@ -703,7 +703,7 @@ TEST_F(
UserSelectableType::kAutofill));
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(
SyncServiceImplTest,
AddressesSyncValueShouldRemainUnchangedForCustomPassphraseUsersAfterTheirInitialSignin) {
@@ -768,7 +768,7 @@ TEST_F(
EXPECT_TRUE(service()->GetUserSettings()->GetSelectedTypes().Has(
UserSelectableType::kAutofill));
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(
SyncServiceImplTest,
@@ -795,7 +795,7 @@ TEST_F(
params.emplace_back(CONTACT_INFO, /*enable_transport_mode=*/true);
InitializeService(std::move(params));
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Sync-the-feature is normally enabled in Ash. Triggering a dashboard reset
// is one way to achieve otherwise.
SyncProtocolError client_cmd;
@@ -971,7 +971,7 @@ TEST_F(SyncServiceImplTest, CredentialsRejectedByClient_StopSync) {
}
// CrOS Ash does not support signout.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplTest, SignOutRevokeAccessToken) {
PopulatePrefsForInitialSyncFeatureSetupComplete();
SignInWithSyncConsent();
@@ -1013,7 +1013,7 @@ TEST_F(SyncServiceImplTest, SignOutRevokeAccessToken) {
// Verify that sync transport data is cleared when the service is initializing
// and account is signed out.
// This code path doesn't exist on ChromeOS-Ash, since signout is not possible.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplTest, ClearTransportDataOnInitializeWhenSignedOut) {
PopulatePrefsForInitialSyncFeatureSetupComplete();
@@ -1030,7 +1030,7 @@ TEST_F(SyncServiceImplTest, ClearTransportDataOnInitializeWhenSignedOut) {
EXPECT_FALSE(
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplTest, DashboardResetTwiceDoesNotCrash) {
PopulatePrefsForInitialSyncFeatureSetupComplete();
@@ -1265,10 +1265,10 @@ TEST_F(SyncServiceImplTest, DisableSyncOnClient) {
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
ASSERT_EQ(0, get_controller(BOOKMARKS)->model()->clear_metadata_count());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ASSERT_FALSE(
service()->GetUserSettings()->IsSyncFeatureDisabledViaDashboard());
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// TODO(crbug.com/40066949): Update once kSync becomes unreachable or is
// deleted from the codebase. See ConsentLevel::kSync documentation for
@@ -1290,7 +1290,7 @@ TEST_F(SyncServiceImplTest, DisableSyncOnClient) {
EXPECT_FALSE(
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Ash does not support signout.
// TODO(crbug.com/40066949): Remove once kSync becomes unreachable or is
// deleted from the codebase. See ConsentLevel::kSync documentation for
@@ -1330,7 +1330,7 @@ TEST_F(SyncServiceImplTest, DisableSyncOnClient) {
base::RunLoop().RunUntilIdle();
EXPECT_EQ(SyncService::TransportState::ACTIVE,
service()->GetTransportState());
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// TrustedVault data should have been cleared.
EXPECT_THAT(trusted_vault_client()->GetStoredKeys(primary_account_gaia_id),
@@ -1606,7 +1606,7 @@ TEST_F(SyncServiceImplTest, ShouldSendDataTypesToSyncInvalidationsService) {
EXPECT_TRUE(engine()->started_handling_invalidations());
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplTest,
ShouldSendDataTypesToSyncInvalidationsServiceInTransportMode) {
SignInWithoutSyncConsent();
@@ -2072,7 +2072,7 @@ TEST_F(SyncServiceImplTest, ShouldRecordUserActionableErrorOnSyncPaused) {
// These tests cover signing in after browser startup, which isn't supported on
// ChromeOS-Ash (where there's always a signed-in user).
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(
SyncServiceImplTest,
GetTypesWithPendingDownloadForInitialSyncDuringFirstSyncInTransportMode) {
@@ -2130,7 +2130,7 @@ TEST_F(SyncServiceImplTest,
EXPECT_EQ(DataTypeSet(),
service()->GetTypesWithPendingDownloadForInitialSync());
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplTest,
GetTypesWithPendingDownloadForInitialSyncDuringNthSync) {
@@ -2387,13 +2387,13 @@ TEST_F(SyncServiceImplTest, ShouldCacheTrustedVaultAutoUpgradeDebugInfo) {
base::RunLoop().RunUntilIdle();
SignInWithSyncConsent();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ASSERT_TRUE(
service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
#else // BUILDFLAG(IS_CHROMEOS_ASH)
#else // BUILDFLAG(IS_CHROMEOS)
service()->GetUserSettings()->SetInitialSyncFeatureSetupComplete(
syncer::SyncFirstSetupCompleteSource::BASIC_FLOW);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
base::RunLoop().RunUntilIdle();
@@ -2466,7 +2466,7 @@ TEST_F(SyncServiceImplTest, ShouldCacheTrustedVaultAutoUpgradeDebugInfo) {
.cohort());
}
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
TEST_F(SyncServiceImplTest, ShouldRecordHistoryOptInStateOnSignin) {
// Allow UserSelectableType::kHistory in transport mode.
base::test::ScopedFeatureList features{kReplaceSyncPromosWithSignInPromos};
@@ -2597,7 +2597,7 @@ TEST_F(SyncServiceImplTest, ShouldRecordHistoryOptInStateOnSync) {
"Signin.HistoryAlreadyOptedInAccessPoint."),
Contains(Pair("Signin.HistoryAlreadyOptedInAccessPoint.OnSync", 1)));
}
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
} // namespace
} // namespace syncer

@@ -22,12 +22,12 @@ class SyncUserSettingsMock : public SyncUserSettings {
SyncUserSettingsMock();
~SyncUserSettingsMock() override;
MOCK_METHOD(bool, IsInitialSyncFeatureSetupComplete, (), (const override));
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
MOCK_METHOD(void,
SetInitialSyncFeatureSetupComplete,
(SyncFirstSetupCompleteSource),
(override));
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
#endif // !BUILDFLAG(IS_CHROMEOS)
MOCK_METHOD(bool, IsSyncEverythingEnabled, (), (const override));
MOCK_METHOD(UserSelectableTypeSet, GetSelectedTypes, (), (const override));
MOCK_METHOD(bool,
@@ -62,7 +62,7 @@ class SyncUserSettingsMock : public SyncUserSettings {
(),
(const override));
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
MOCK_METHOD(bool, IsSyncFeatureDisabledViaDashboard, (), (const override));
MOCK_METHOD(bool, IsSyncAllOsTypesEnabled, (), (const override));
MOCK_METHOD(UserSelectableOsTypeSet,

@@ -78,13 +78,13 @@ void TestSyncService::SetSignedOut() {
}
void TestSyncService::MimicDashboardClear() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Clearing sync from the dashboard results in
// IsSyncFeatureDisabledViaDashboard() returning true.
user_settings_.SetSyncFeatureDisabledViaDashboard(true);
#else
SetSignedIn(signin::ConsentLevel::kSignin);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
void TestSyncService::SetAllowedByEnterprisePolicy(bool allowed) {
@@ -197,9 +197,9 @@ base::android::ScopedJavaLocalRef<jobject> TestSyncService::GetJavaObject() {
#endif // BUILDFLAG(IS_ANDROID)
void TestSyncService::SetSyncFeatureRequested() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
user_settings_.SetSyncFeatureDisabledViaDashboard(false);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
TestSyncUserSettings* TestSyncService::GetUserSettings() {
@@ -284,11 +284,11 @@ DataTypeSet TestSyncService::GetActiveDataTypes() const {
if (GetTransportState() != TransportState::ACTIVE) {
return DataTypeSet();
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
if (user_settings_.IsSyncFeatureDisabledViaDashboard()) {
return DataTypeSet();
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
return Difference(GetPreferredDataTypes(), failed_data_types_);
}

@@ -44,7 +44,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/system/fake_statistics_provider.h"
#endif
@@ -515,7 +515,7 @@ class DeviceInfoSyncBridgeTest : public testing::Test,
: store_(DataTypeStoreTestUtil::CreateInMemoryStoreForTest()) {
DeviceInfoPrefs::RegisterProfilePrefs(pref_service_.registry());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
statistics_provider_ =
std::make_unique<ash::system::ScopedFakeStatisticsProvider>();
#endif
@@ -616,7 +616,7 @@ class DeviceInfoSyncBridgeTest : public testing::Test,
return local_device_info_provider_;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ash::system::ScopedFakeStatisticsProvider* statistics_provider() {
EXPECT_TRUE(statistics_provider_);
return statistics_provider_.get();
@@ -751,7 +751,7 @@ class DeviceInfoSyncBridgeTest : public testing::Test,
raw_ptr<TestLocalDeviceInfoProvider> local_device_info_provider_ = nullptr;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<ash::system::ScopedFakeStatisticsProvider>
statistics_provider_;
#endif

@@ -115,7 +115,7 @@ class LocalDeviceInfoProviderImplTest : public testing::Test {
std::unique_ptr<LocalDeviceInfoProviderImpl> provider_;
};
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(LocalDeviceInfoProviderImplTest, UmaToggleFullHardwareClass) {
InitializeProvider(kLocalDeviceGuid);
@@ -135,7 +135,7 @@ TEST_F(LocalDeviceInfoProviderImplTest, UmaToggleFullHardwareClass) {
EXPECT_EQ(provider_->GetLocalDeviceInfo()->full_hardware_class(),
kLocalFullHardwareClass);
}
#else // NOT BUILDFLAG(IS_CHROMEOS_ASH)
#else // NOT BUILDFLAG(IS_CHROMEOS)
TEST_F(LocalDeviceInfoProviderImplTest,
UmaEnabledNonChromeOSHardwareClassEmpty) {
// Tests that the |full_hardware_class| doesn't get updated when on
@@ -150,7 +150,7 @@ TEST_F(LocalDeviceInfoProviderImplTest,
// |kLocalFullHardwareClass| is reset after retrieving |local_device_info|
EXPECT_EQ(local_device_info->full_hardware_class(), "");
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
TEST_F(LocalDeviceInfoProviderImplTest, GetLocalDeviceInfo) {
ASSERT_EQ(nullptr, provider_->GetLocalDeviceInfo());

@@ -19,7 +19,7 @@
#include "components/sync/protocol/sync_enums.pb.h"
#include "ui/base/device_form_factor.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/system/statistics_provider.h"
#endif
@@ -66,7 +66,7 @@ void OnPersonalizableDeviceNameReady(LocalDeviceNameInfo* name_info_ptr,
void OnMachineStatisticsLoaded(LocalDeviceNameInfo* name_info_ptr,
base::ScopedClosureRunner done_closure) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// |full_hardware_class| is set on Chrome OS devices if the user has UMA
// enabled. Otherwise |full_hardware_class| is set to an empty string.
if (const std::optional<std::string_view> full_hardware_class =
@@ -106,7 +106,7 @@ sync_pb::SyncEnums::DeviceType GetLocalDeviceType() {
}
DeviceInfo::OsType GetLocalDeviceOSType() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return DeviceInfo::OsType::kChromeOsAsh;
#elif BUILDFLAG(IS_LINUX)
return DeviceInfo::OsType::kLinux;
@@ -167,7 +167,7 @@ void GetLocalDeviceNameInfo(
base::BindOnce(&OnHardwareInfoReady, name_info_ptr,
base::ScopedClosureRunner(done_closure)));
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Bind hwclass once the statistics are available on ChromeOS devices.
ash::system::StatisticsProvider::GetInstance()
->ScheduleOnMachineStatisticsLoaded(

@@ -11,10 +11,10 @@
#include "build/chromeos_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "base/command_line.h"
#include "base/test/scoped_chromeos_version_info.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace syncer {
namespace {
@@ -26,7 +26,7 @@ TEST(GetClientNameTest, GetPersonalizableDeviceNameBlocking) {
EXPECT_FALSE(client_name.empty());
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Call GetPersonalizableDeviceNameBlocking on ChromeOS where the
// board type is CHROMEBOOK and make sure the return value is "Chromebook".
@@ -46,7 +46,7 @@ TEST(GetClientNameTest, GetPersonalizableDeviceNameBlockingChromebox) {
EXPECT_EQ("Chromebox", client_name);
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} // namespace
} // namespace syncer

@@ -72,7 +72,7 @@ UkmConsentStateObserver::~UkmConsentStateObserver() {
}
bool UkmConsentStateObserver::ProfileState::IsUkmConsented() const {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return consent_state.Has(MSBB) || consent_state.Has(APPS);
#else
return consent_state.Has(MSBB);
@@ -104,7 +104,7 @@ UkmConsentStateObserver::ProfileState UkmConsentStateObserver::GetProfileState(
state.SetConsentType(EXTENSIONS);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const bool app_sync_consent =
CanUploadUkmForType(sync_service, syncer::DataType::APPS, msbb_consent) ||
// Demo mode is a special managed guest session that doesn't support
@@ -238,7 +238,7 @@ void UkmConsentStateObserver::OnSyncShutdown(syncer::SyncService* sync) {
bool UkmConsentStateObserver::IsUkmAllowedForAllProfiles() {
const UkmConsentState ukm_consent_state = GetUkmConsentState();
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
return ukm_consent_state.Has(MSBB) || ukm_consent_state.Has(APPS);
#else
return ukm_consent_state.Has(MSBB);
@@ -256,7 +256,7 @@ UkmConsentState UkmConsentStateObserver::GetUkmConsentState() {
return ukm_consent_state_.value_or(UkmConsentState());
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
void UkmConsentStateObserver::SetIsDemoMode(bool is_device_in_demo_mode) {
is_device_in_demo_mode_ = is_device_in_demo_mode;
}

@@ -71,7 +71,7 @@ class UkmConsentStateObserver
bool total_purge,
UkmConsentState previous_consent_state) = 0;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Used to set is_demo_mode_ field.
void SetIsDemoMode(bool is_demo_mode);
@@ -157,7 +157,7 @@ class UkmConsentStateObserver
// if constructed with UkmConsentStateObserver(NoInitialUkmConsentStateTag).
std::optional<UkmConsentState> ukm_consent_state_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Indicate whether the device is in demo mode. If it is true,
// set APPS consent to collect App usage data for active demo
// session. Default to false.

@@ -18,12 +18,9 @@
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/components/kiosk/kiosk_test_utils.h" // nogncheck
#include "chromeos/components/mgs/managed_guest_session_test_utils.h"
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/user_manager/fake_user_manager.h"
#include "components/user_manager/scoped_user_manager.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace ukm {
@@ -35,7 +32,7 @@ class MockSyncService : public syncer::TestSyncService {
SetMaxTransportState(TransportState::INITIALIZING);
SetLastCycleSnapshot(syncer::SyncCycleSnapshot());
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
SetAppSync(false);
#endif
}
@@ -75,7 +72,6 @@ class MockSyncService : public syncer::TestSyncService {
#if BUILDFLAG(IS_CHROMEOS)
void SetAppSync(bool enabled) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
auto selected_os_types = GetUserSettings()->GetSelectedOsTypes();
if (enabled) {
@@ -85,10 +81,6 @@ class MockSyncService : public syncer::TestSyncService {
}
GetUserSettings()->SetSelectedOsTypes(false, selected_os_types);
#else
GetUserSettings()->SetAppsSyncEnabledByOs(enabled);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
NotifyObserversOfStateChanged();
}
#endif // BUILDFLAG(IS_CHROMEOS)
@@ -171,11 +163,11 @@ class UkmConsentStateObserverTest : public testing::TestWithParam<bool> {
void ExpectDwaAllowedForAllProfiles(TestUkmConsentStateObserver& observer,
bool expected_allowed) {
// App sync is turned off by default in CHROMEOS_ASH. This results in DWA not
// App sync is turned off by default in CHROMEOS. This results in DWA not
// being allowed for that particular test setup, however can be enabled for
// other platforms.
// DWA and ChromeOS are tested further below.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#if !BUILDFLAG(IS_CHROMEOS)
EXPECT_EQ(expected_allowed, observer.IsDwaAllowedForAllProfiles());
#endif
}
@@ -314,7 +306,7 @@ TEST_F(UkmConsentStateObserverTest, NoInitialUkmConsentState) {
sync.Shutdown();
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(UkmConsentStateObserverTest, VerifyConsentStates) {
sync_preferences::TestingPrefServiceSyncable prefs;
RegisterUrlKeyedAnonymizedDataCollectionPref(prefs);
@@ -428,10 +420,6 @@ TEST_F(UkmConsentStateObserverTest, VerifyConflictingProfilesRevokesConsent) {
EXPECT_FALSE(observer.ResetPurged());
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Test consent state for kiosk.
class KioskUkmConsentStateObserverTest : public UkmConsentStateObserverTest {
public:
@@ -440,10 +428,8 @@ class KioskUkmConsentStateObserverTest : public UkmConsentStateObserverTest {
TEST_P(KioskUkmConsentStateObserverTest, VerifyDefaultConsent) {
// Enter Kiosk session.
#if BUILDFLAG(IS_CHROMEOS_ASH)
user_manager::ScopedUserManager user_manager(
std::make_unique<user_manager::FakeUserManager>());
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
chromeos::SetUpFakeKioskSession();
sync_preferences::TestingPrefServiceSyncable prefs;

@@ -2213,9 +2213,7 @@ TEST_F(UkmServiceTest, NotifyObserverOnShutdown) {
ukm::UkmRecorder::Get()->AddObserver(&observer);
EXPECT_CALL(observer, OnStartingShutdown()).Times(1);
}
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
namespace {
class UkmServiceTestWithIndependentAppKM
@@ -2402,7 +2400,7 @@ INSTANTIATE_TEST_SUITE_P(
}
});
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
class MockUkmRecorder : public ukm::UkmRecorder {
public:

@@ -48,7 +48,7 @@ Study::Platform ClientFilterableState::GetCurrentPlatform() {
return Study::PLATFORM_IOS;
#elif BUILDFLAG(IS_MAC)
return Study::PLATFORM_MAC;
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
return Study::PLATFORM_CHROMEOS;
#elif BUILDFLAG(IS_ANDROID)
return Study::PLATFORM_ANDROID;
@@ -85,7 +85,7 @@ base::Version ClientFilterableState::GetOSVersion() {
std::string ClientFilterableState::GetHardwareClass() {
// TODO(crbug.com/40708998): Expand to other platforms.
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
return base::SysInfo::HardwareModelName();
#else
return "";

@@ -874,7 +874,7 @@ TEST_F(FieldTrialUtilTest, TestEscapeValue) {
EXPECT_EQ(str, base::UnescapeValue(escaped_str));
}
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
TEST_F(FieldTrialUtilTest,
AssociateParamsFromFieldTrialConfigWithHardwareClassMatch) {
std::string hardware_class = ClientFilterableState::GetHardwareClass();
@@ -1004,6 +1004,6 @@ TEST_F(FieldTrialUtilTest,
EXPECT_EQ("TestGroup", base::FieldTrialList::FindFullName("TestTrial"));
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_ANDROID)
#endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
} // namespace variations

@@ -41,7 +41,7 @@ GoogleGroupsManager::GoogleGroupsManager(
// Register for preference changes.
pref_change_registrar_.Init(&source_prefs_.get());
pref_change_registrar_.Add(
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
variations::kOsDogfoodGroupsSyncPrefName,
#else
variations::kDogfoodGroupsSyncPrefName,
@@ -59,7 +59,7 @@ GoogleGroupsManager::~GoogleGroupsManager() = default;
void GoogleGroupsManager::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterListPref(
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
variations::kOsDogfoodGroupsSyncPrefName,
user_prefs::PrefRegistrySyncable::SYNCABLE_OS_PRIORITY_PREF
#else
@@ -129,7 +129,7 @@ void GoogleGroupsManager::OnSyncShutdown(syncer::SyncService* sync) {
void GoogleGroupsManager::ClearSigninScopedState() {
source_prefs_->ClearPref(
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
variations::kOsDogfoodGroupsSyncPrefName
#else
variations::kDogfoodGroupsSyncPrefName
@@ -147,7 +147,7 @@ void GoogleGroupsManager::UpdateGoogleGroups() {
base::Value::Dict& target_prefs_dict = target_prefs_update.Get();
const base::Value::List& source_list = source_prefs_->GetList(
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
variations::kOsDogfoodGroupsSyncPrefName
#else
variations::kDogfoodGroupsSyncPrefName

@@ -10,7 +10,7 @@ namespace variations {
// gaia IDs for a given syncing user.
// The variables below are the pref name, and the key for the gaia ID within
// the dictionary value.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
inline constexpr char kOsDogfoodGroupsSyncPrefName[] = "sync.os_dogfood_groups";
#else
inline constexpr char kDogfoodGroupsSyncPrefName[] = "sync.dogfood_groups";

@@ -36,7 +36,7 @@ class GoogleGroupsManagerTest : public ::testing::Test {
pref_groups_list.Append(std::move(group_dict));
}
source_prefs_.SetList(
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
variations::kOsDogfoodGroupsSyncPrefName,
#else
variations::kDogfoodGroupsSyncPrefName,
@@ -59,7 +59,7 @@ class GoogleGroupsManagerTest : public ::testing::Test {
void CheckSourcePrefCleared() {
EXPECT_TRUE(source_prefs_
.GetList(
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
variations::kOsDogfoodGroupsSyncPrefName
#else
variations::kDogfoodGroupsSyncPrefName

@@ -94,7 +94,7 @@ std::string GetPlatformString() {
return "ios";
#elif BUILDFLAG(IS_MAC)
return "mac";
#elif BUILDFLAG(IS_CHROMEOS_ASH)
#elif BUILDFLAG(IS_CHROMEOS)
return "chromeos";
#elif BUILDFLAG(IS_ANDROID)
return "android";
@@ -252,7 +252,7 @@ std::unique_ptr<SeedResponse> MaybeImportFirstRunSeed(
} // namespace
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// This is a utility which syncs the policy-managed value of
// |prefs::kDeviceVariationsRestrictionsByPolicy| into
// |prefs::kVariationsRestrictionsByPolicy|.
@@ -329,7 +329,7 @@ class DeviceVariationsRestrictionByPolicyApplicator {
base::WeakPtrFactory<DeviceVariationsRestrictionByPolicyApplicator>
weak_ptr_factory_{this};
};
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
VariationsService::VariationsService(
std::unique_ptr<VariationsServiceClient> client,
@@ -372,7 +372,7 @@ VariationsService::VariationsService(
DCHECK(client_);
DCHECK(resource_request_allowed_notifier_);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
device_variations_restrictions_by_policy_applicator_ =
std::make_unique<DeviceVariationsRestrictionByPolicyApplicator>(
policy_pref_service_);
@@ -516,7 +516,7 @@ GURL VariationsService::GetVariationsServerURL(HttpOptions http_options) {
}
void VariationsService::EnsureLocaleEquals(const std::string& locale) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Chrome OS may switch language on the fly.
return;
#else

@@ -58,7 +58,7 @@ class VariationsSeed;
namespace variations {
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
class DeviceVariationsRestrictionByPolicyApplicator;
#endif
@@ -473,7 +473,7 @@ class VariationsService
// server url.
std::string osname_server_param_override_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
std::unique_ptr<DeviceVariationsRestrictionByPolicyApplicator>
device_variations_restrictions_by_policy_applicator_;
#endif

@@ -23,7 +23,7 @@
#include "components/variations/synthetic_trials.h"
#include "components/variations/variations_switches.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "base/task/thread_pool.h"
#include "components/variations/variations_crash_keys_chromeos.h"
#endif
@@ -105,11 +105,11 @@ class VariationsCrashKeys final : public base::FieldTrialList::Observer {
// observer calls that happen on a different thread.
scoped_refptr<base::SequencedTaskRunner> ui_thread_task_runner_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Task runner corresponding to a background thread, used for tasks that may
// block.
scoped_refptr<base::SequencedTaskRunner> background_thread_task_runner_;
#endif // IS_CHROMEOS_ASH
#endif // IS_CHROMEOS
// A serialized string containing the variations state.
std::string variations_string_;
@@ -149,10 +149,10 @@ VariationsCrashKeys::VariationsCrashKeys() {
for (const auto& entry : active_groups) {
AppendFieldTrial(entry.trial_name, entry.group_name, entry.is_overridden);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
background_thread_task_runner_ = base::ThreadPool::CreateSequencedTaskRunner(
{base::TaskPriority::BEST_EFFORT, base::MayBlock()});
#endif // IS_CHROMEOS_ASH
#endif // IS_CHROMEOS
UpdateCrashKeys();
}
@@ -252,9 +252,9 @@ void VariationsCrashKeys::UpdateCrashKeys() {
variations::switches::kVariationsSeedVersion));
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
ReportVariationsToChromeOs(background_thread_task_runner_, info);
#endif // IS_CHROMEOS_ASH
#endif // IS_CHROMEOS
}
void VariationsCrashKeys::OnSyntheticTrialsChanged(

@@ -18,9 +18,9 @@ namespace variations {
namespace {
// Path where we put variations in cryptohome.
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
constexpr char kCrashVariationsFileName[] = ".variations-list.txt";
#endif // IS_CHROMEOS_ASH
#endif // IS_CHROMEOS
void WriteVariationsToFile(ExperimentListInfo info) {
std::string combined_string = base::StrCat(

@@ -38,11 +38,11 @@
#include "components/variations/metrics.h"
#endif // BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "base/functional/callback.h"
#include "chromeos/ash/components/dbus/featured/featured.pb.h"
#include "chromeos/ash/components/dbus/featured/featured_client.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(IS_IOS)
#include "components/variations/metrics.h"
@@ -72,11 +72,11 @@ constexpr char kIdenticalToSafeSeedSentinel[] = "safe_seed_content";
// The maximum size of an uncompressed seed at 50 MiB.
constexpr std::size_t kMaxUncompressedSeedSize = 50 * 1024 * 1024;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Number of attempts to send the safe seed from Chrome to CrOS platforms before
// giving up.
constexpr int kSendPlatformSafeSeedMaxAttempts = 2;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// The name of the seed file that stores the latest seed data.
const base::FilePath::CharType kSeedFilename[] =
@@ -813,7 +813,7 @@ void VariationsSeedStore::StoreValidatedSafeSeed(
}
safe_seed_store_->SetFetchTime(seed_fetch_time);
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// `SendSafeSeedToPlatform` will send the safe seed at most twice and should
// only be called if the seed is successfully validated.
// This is a best effort attempt and it is possible that the safe seed for
@@ -821,7 +821,7 @@ void VariationsSeedStore::StoreValidatedSafeSeed(
send_seed_to_platform_attempts_ = 0;
SendSafeSeedToPlatform(GetSafeSeedStateForPlatform(
seed, seed_milestone, client_state, seed_fetch_time));
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
}
// static
@@ -959,7 +959,7 @@ bool VariationsSeedStore::ApplyDeltaPatch(const std::string& existing_data,
return true;
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
featured::SeedDetails VariationsSeedStore::GetSafeSeedStateForPlatform(
const ValidatedSeed& seed,
const int seed_milestone,
@@ -1002,6 +1002,6 @@ void VariationsSeedStore::SendSafeSeedToPlatform(
weak_ptr_factory_.GetWeakPtr(), safe_seed));
}
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} // namespace variations

@@ -25,9 +25,9 @@
#include "components/variations/seed_response.h"
#include "components/variations/variations_safe_seed_store.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/dbus/featured/featured.pb.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
class PrefService;
class PrefRegistrySimple;
@@ -403,7 +403,7 @@ class COMPONENT_EXPORT(VARIATIONS) VariationsSeedStore {
// Handles reads and writes to seed files.
std::unique_ptr<SeedReaderWriter> seed_reader_writer_;
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
// Gets the combined server and client state used for early boot variations
// platform disaster recovery.
featured::SeedDetails GetSafeSeedStateForPlatform(
@@ -423,7 +423,7 @@ class COMPONENT_EXPORT(VARIATIONS) VariationsSeedStore {
// A counter that keeps track of how many times the current safe seed is sent
// to platform.
size_t send_seed_to_platform_attempts_ = 0;
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.

@@ -41,10 +41,10 @@
#include "components/variations/android/variations_seed_bridge.h"
#endif // BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
#include "chromeos/ash/components/dbus/featured/fake_featured_client.h"
#include "chromeos/ash/components/dbus/featured/featured.pb.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
namespace variations {
namespace {
@@ -2140,7 +2140,7 @@ TEST_P(VariationsSeedStoreFirstRunPrefsTest, FirstRunPrefsAllowed) {
}
#endif // BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_CHROMEOS_ASH)
#if BUILDFLAG(IS_CHROMEOS)
const featured::SeedDetails CreateDummySafeSeed(
ClientFilterableState* client_state,
base::Time fetch_time_to_store) {
@@ -2311,6 +2311,6 @@ TEST_P(StoreSafeSeedDataAllGroupsTest, SendSafeSeedToPlatform_FailTwoAttempts) {
ash::featured::FeaturedClient::Shutdown();
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
#endif // BUILDFLAG(IS_CHROMEOS)
} // namespace variations