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:

committed by
Chromium LUCI CQ

parent
47f064801e
commit
0ea7859156
components
account_manager_core
chromeos
crash
core
permissions
policy
core
browser
policy_conversions.ccpolicy_conversions.hpolicy_conversions_client.hpolicy_conversions_client_unittest.ccpolicy_pref_mapping_test.cc
common
cloud
affiliation_unittest.cccloud_policy_client_unittest.cccloud_policy_constants.cccloud_policy_util.cccloud_policy_validator.cccloud_policy_validator_unittest.ccencrypted_reporting_job_configuration_unittest.ccrealtime_reporting_job_configuration_unittest.cc
generate_policy_source_unittest.cctest
management
policy_merger.ccpolicy_switches.ccpolicy_switches.hremote_commands
prefs
signin
core
internal
identity_manager
account_fetcher_service.ccaccount_tracker_service.ccaccount_tracker_service.haccount_tracker_service_unittest.ccaccounts_mutator_impl.ccaccounts_mutator_impl.hprimary_account_manager.ccprimary_account_manager.hprimary_account_manager_unittest.ccprimary_account_mutator_impl.ccprimary_account_mutator_impl.hprofile_oauth2_token_service.ccprofile_oauth2_token_service_builder.cc
public
base
device_id_helper.ccdevice_id_helper.hdevice_id_helper_unittest.ccsignin_pref_names.ccsignin_pref_names.hsignin_switches.ccsignin_switches.h
identity_manager
access_token_restriction.ccaccess_token_restriction_unittest.ccaccounts_mutator.haccounts_mutator_unittest.ccidentity_manager.hidentity_manager_builder.ccidentity_manager_unittest.ccidentity_test_environment.ccidentity_test_environment.hidentity_test_utils.ccidentity_test_utils.hprimary_account_access_token_fetcher_unittest.ccprimary_account_mutator.hprimary_account_mutator_unittest.cctest_accounts.cc
sync
service
sync_auth_manager_unittest.ccsync_policy_handler.ccsync_policy_handler_unittest.ccsync_service.ccsync_service_impl.ccsync_service_impl.hsync_service_impl_startup_unittest.ccsync_service_impl_unittest.cc
test
sync_device_info
device_info_sync_bridge_unittest.cclocal_device_info_provider_impl_unittest.cclocal_device_info_util.cclocal_device_info_util_unittest.cc
ukm
observers
ukm_service_unittest.ccvariations
client_filterable_state.cc
field_trial_config
service
google_groups_manager.ccgoogle_groups_manager_prefs.hgoogle_groups_manager_unittest.ccvariations_service.ccvariations_service.h
variations_crash_keys.ccvariations_crash_keys_chromeos.ccvariations_seed_store.ccvariations_seed_store.hvariations_seed_store_unittest.cc@ -602,7 +602,7 @@ void AccountManager::UpsertAccountInternal(
|
|||||||
// This is a new account. Insert it.
|
// This is a new account. Insert it.
|
||||||
// Note: AccountManager may be used on Lacros in tests. Don't check pref
|
// Note: AccountManager may be used on Lacros in tests. Don't check pref
|
||||||
// service in this case.
|
// service in this case.
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// New account insertions can only happen through a user action, which
|
// New account insertions can only happen through a user action, which
|
||||||
// implies that |Profile| must have been fully initialized at this point.
|
// implies that |Profile| must have been fully initialized at this point.
|
||||||
// |ProfileImpl|'s constructor guarantees that
|
// |ProfileImpl|'s constructor guarantees that
|
||||||
@ -615,7 +615,7 @@ void AccountManager::UpsertAccountInternal(
|
|||||||
// adding a Secondary Account are already blocked.
|
// adding a Secondary Account are already blocked.
|
||||||
CHECK(accounts_.empty());
|
CHECK(accounts_.empty());
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
accounts_.emplace(account_key, account);
|
accounts_.emplace(account_key, account);
|
||||||
PersistAccountsAsync();
|
PersistAccountsAsync();
|
||||||
NotifyTokenObservers(
|
NotifyTokenObservers(
|
||||||
|
@ -117,7 +117,7 @@ void DestroyCrashpadClient();
|
|||||||
|
|
||||||
// ChromeOS has its own, OS-level consent system; Chrome does not maintain a
|
// ChromeOS has its own, OS-level consent system; Chrome does not maintain a
|
||||||
// separate Upload Consent on ChromeOS.
|
// 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
|
// 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
|
// into account. Consent may be ignored, uploads may not be enabled even with
|
||||||
@ -129,7 +129,7 @@ void DestroyCrashpadClient();
|
|||||||
// running.
|
// running.
|
||||||
void SetUploadConsent(bool consent);
|
void SetUploadConsent(bool consent);
|
||||||
|
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
enum class ReportUploadState {
|
enum class ReportUploadState {
|
||||||
NotUploaded,
|
NotUploaded,
|
||||||
|
@ -143,7 +143,7 @@ bool PlatformCrashpadInitialization(
|
|||||||
DCHECK(exe_path.empty());
|
DCHECK(exe_path.empty());
|
||||||
|
|
||||||
crashpad::CrashpadClient client;
|
crashpad::CrashpadClient client;
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
std::string crash_loop_before =
|
std::string crash_loop_before =
|
||||||
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
||||||
switches::kCrashLoopBefore);
|
switches::kCrashLoopBefore);
|
||||||
|
@ -810,7 +810,7 @@ TEST_F(PermissionContextBaseTests, TestGlobalKillSwitch) {
|
|||||||
TestGlobalPermissionsKillSwitch(ContentSettingsType::NOTIFICATIONS);
|
TestGlobalPermissionsKillSwitch(ContentSettingsType::NOTIFICATIONS);
|
||||||
TestGlobalPermissionsKillSwitch(ContentSettingsType::MIDI_SYSEX);
|
TestGlobalPermissionsKillSwitch(ContentSettingsType::MIDI_SYSEX);
|
||||||
TestGlobalPermissionsKillSwitch(ContentSettingsType::DURABLE_STORAGE);
|
TestGlobalPermissionsKillSwitch(ContentSettingsType::DURABLE_STORAGE);
|
||||||
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
|
||||||
TestGlobalPermissionsKillSwitch(
|
TestGlobalPermissionsKillSwitch(
|
||||||
ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER);
|
ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER);
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,9 +48,9 @@ const char kPrecedencePoliciesId[] = "precedence";
|
|||||||
const char kPrecedencePoliciesName[] = "Policy Precedence";
|
const char kPrecedencePoliciesName[] = "Policy Precedence";
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
const char kDeviceLocalAccountPoliciesId[] = "deviceLocalAccountPolicies";
|
const char kDeviceLocalAccountPoliciesId[] = "deviceLocalAccountPolicies";
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
PolicyConversions::Delegate::Delegate(PolicyConversionsClient* client)
|
PolicyConversions::Delegate::Delegate(PolicyConversionsClient* client)
|
||||||
: client_(client) {}
|
: client_(client) {}
|
||||||
@ -139,17 +139,17 @@ Value::Dict DefaultPolicyConversions::ToValueDict() {
|
|||||||
all_policies.Merge(GetExtensionPolicies());
|
all_policies.Merge(GetExtensionPolicies());
|
||||||
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
all_policies.Set(kDeviceLocalAccountPoliciesId,
|
all_policies.Set(kDeviceLocalAccountPoliciesId,
|
||||||
GetDeviceLocalAccountPolicies());
|
GetDeviceLocalAccountPolicies());
|
||||||
Value::Dict identity_fields = client()->GetIdentityFields();
|
Value::Dict identity_fields = client()->GetIdentityFields();
|
||||||
if (!identity_fields.empty())
|
if (!identity_fields.empty())
|
||||||
all_policies.Merge(std::move(identity_fields));
|
all_policies.Merge(std::move(identity_fields));
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
return all_policies;
|
return all_policies;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
Value::Dict DefaultPolicyConversions::GetDeviceLocalAccountPolicies() {
|
Value::Dict DefaultPolicyConversions::GetDeviceLocalAccountPolicies() {
|
||||||
Value::List policies = client()->GetDeviceLocalAccountPolicies();
|
Value::List policies = client()->GetDeviceLocalAccountPolicies();
|
||||||
Value::Dict device_values;
|
Value::Dict device_values;
|
||||||
@ -171,10 +171,10 @@ base::Value::Dict DefaultPolicyConversions::GetExtensionPolicies() {
|
|||||||
extension_policies.Set("extensionPolicies",
|
extension_policies.Set("extensionPolicies",
|
||||||
GetExtensionPolicies(POLICY_DOMAIN_EXTENSIONS));
|
GetExtensionPolicies(POLICY_DOMAIN_EXTENSIONS));
|
||||||
}
|
}
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
extension_policies.Set("loginScreenExtensionPolicies",
|
extension_policies.Set("loginScreenExtensionPolicies",
|
||||||
GetExtensionPolicies(POLICY_DOMAIN_SIGNIN_EXTENSIONS));
|
GetExtensionPolicies(POLICY_DOMAIN_SIGNIN_EXTENSIONS));
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
return extension_policies;
|
return extension_policies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ class POLICY_EXPORT DefaultPolicyConversions
|
|||||||
base::Value::Dict GetExtensionPolicies(PolicyDomain policy_domain);
|
base::Value::Dict GetExtensionPolicies(PolicyDomain policy_domain);
|
||||||
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
base::Value::Dict GetDeviceLocalAccountPolicies();
|
base::Value::Dict GetDeviceLocalAccountPolicies();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -97,7 +97,7 @@ class POLICY_EXPORT PolicyConversionsClient {
|
|||||||
virtual base::Value::List GetExtensionPolicies(
|
virtual base::Value::List GetExtensionPolicies(
|
||||||
PolicyDomain policy_domain) = 0;
|
PolicyDomain policy_domain) = 0;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Returns policies for ChromeOS device.
|
// Returns policies for ChromeOS device.
|
||||||
virtual base::Value::List GetDeviceLocalAccountPolicies() = 0;
|
virtual base::Value::List GetDeviceLocalAccountPolicies() = 0;
|
||||||
// Returns device specific information if this device is enterprise managed.
|
// 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 {
|
base::Value::List GetExtensionPolicies(PolicyDomain policy_domain) override {
|
||||||
return base::Value::List();
|
return base::Value::List();
|
||||||
}
|
}
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
base::Value::List GetDeviceLocalAccountPolicies() override {
|
base::Value::List GetDeviceLocalAccountPolicies() override {
|
||||||
return base::Value::List();
|
return base::Value::List();
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ class PolicyTestCase {
|
|||||||
bool IsOsSupported() const {
|
bool IsOsSupported() const {
|
||||||
#if BUILDFLAG(IS_ANDROID)
|
#if BUILDFLAG(IS_ANDROID)
|
||||||
const std::string os("android");
|
const std::string os("android");
|
||||||
#elif BUILDFLAG(IS_CHROMEOS_ASH)
|
#elif BUILDFLAG(IS_CHROMEOS)
|
||||||
const std::string os("chromeos_ash");
|
const std::string os("chromeos_ash");
|
||||||
#elif BUILDFLAG(IS_IOS)
|
#elif BUILDFLAG(IS_IOS)
|
||||||
const std::string os("ios");
|
const std::string os("ios");
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "services/network/test/test_network_connection_tracker.h"
|
#include "services/network/test/test_network_connection_tracker.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.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"
|
#include "components/policy/core/common/cloud/mock_user_cloud_policy_store.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ namespace {
|
|||||||
constexpr char kAffiliationId1[] = "abc";
|
constexpr char kAffiliationId1[] = "abc";
|
||||||
constexpr char kAffiliationId2[] = "def";
|
constexpr char kAffiliationId2[] = "def";
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
constexpr char kNonEmptyDmToken[] = "test-dm-token";
|
constexpr char kNonEmptyDmToken[] = "test-dm-token";
|
||||||
|
|
||||||
policy::MockCloudPolicyClient* ConnectNewMockClient(
|
policy::MockCloudPolicyClient* ConnectNewMockClient(
|
||||||
@ -106,7 +106,7 @@ TEST(CloudManagementAffiliationTest, UserAffiliated) {
|
|||||||
EXPECT_FALSE(IsUserAffiliated(user_ids, device_ids, "user"));
|
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.
|
// Tests getting affiliation IDs from core for user.
|
||||||
TEST(CloudManagementAffiliationTest, GetUserAffiliationIdsFromCore_User) {
|
TEST(CloudManagementAffiliationTest, GetUserAffiliationIdsFromCore_User) {
|
||||||
base::test::TaskEnvironment task_environment;
|
base::test::TaskEnvironment task_environment;
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
#include "testing/gmock/include/gmock/gmock.h"
|
#include "testing/gmock/include/gmock/gmock.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.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"
|
#include "chromeos/ash/components/system/fake_statistics_provider.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -459,7 +459,7 @@ class CloudPolicyClientTest : public testing::Test {
|
|||||||
job_type_(DeviceManagementService::JobConfiguration::TYPE_INVALID),
|
job_type_(DeviceManagementService::JobConfiguration::TYPE_INVALID),
|
||||||
client_id_(kClientID),
|
client_id_(kClientID),
|
||||||
policy_type_(dm_protocol::kChromeUserPolicyType) {
|
policy_type_(dm_protocol::kChromeUserPolicyType) {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
fake_statistics_provider_.SetMachineStatistic(ash::system::kSerialNumberKey,
|
fake_statistics_provider_.SetMachineStatistic(ash::system::kSerialNumberKey,
|
||||||
"fake_serial_number");
|
"fake_serial_number");
|
||||||
#endif
|
#endif
|
||||||
@ -606,7 +606,7 @@ class CloudPolicyClientTest : public testing::Test {
|
|||||||
std::unique_ptr<CloudPolicyClient> client_;
|
std::unique_ptr<CloudPolicyClient> client_;
|
||||||
network::TestURLLoaderFactory url_loader_factory_;
|
network::TestURLLoaderFactory url_loader_factory_;
|
||||||
scoped_refptr<network::SharedURLLoaderFactory> shared_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_;
|
ash::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ const char kValueRequestFmRegistrationTokenUpload[] =
|
|||||||
"fm_registration_token_upload";
|
"fm_registration_token_upload";
|
||||||
|
|
||||||
const char kChromeDevicePolicyType[] = "google/chromeos/device";
|
const char kChromeDevicePolicyType[] = "google/chromeos/device";
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
const char kChromeUserPolicyType[] = "google/chromeos/user";
|
const char kChromeUserPolicyType[] = "google/chromeos/user";
|
||||||
#elif BUILDFLAG(IS_ANDROID)
|
#elif BUILDFLAG(IS_ANDROID)
|
||||||
const char kChromeUserPolicyType[] = "google/android/user";
|
const char kChromeUserPolicyType[] = "google/android/user";
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "components/version_info/version_info.h"
|
#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 "chromeos/ash/components/system/statistics_provider.h"
|
||||||
#include "components/user_manager/user.h"
|
#include "components/user_manager/user.h"
|
||||||
#include "components/user_manager/user_manager.h"
|
#include "components/user_manager/user_manager.h"
|
||||||
@ -181,7 +181,7 @@ std::string GetOSUsername() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return base::WideToUTF8(username);
|
return base::WideToUTF8(username);
|
||||||
#elif BUILDFLAG(IS_CHROMEOS_ASH)
|
#elif BUILDFLAG(IS_CHROMEOS)
|
||||||
if (!user_manager::UserManager::IsInitialized())
|
if (!user_manager::UserManager::IsInitialized())
|
||||||
return std::string();
|
return std::string();
|
||||||
auto* user = user_manager::UserManager::Get()->GetPrimaryUser();
|
auto* user = user_manager::UserManager::Get()->GetPrimaryUser();
|
||||||
@ -213,7 +213,7 @@ em::Channel ConvertToProtoChannel(version_info::Channel channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string GetDeviceName() {
|
std::string GetDeviceName() {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
return std::string(
|
return std::string(
|
||||||
ash::system::StatisticsProvider::GetInstance()->GetMachineID().value_or(
|
ash::system::StatisticsProvider::GetInstance()->GetMachineID().value_or(
|
||||||
""));
|
""));
|
||||||
|
@ -34,9 +34,9 @@
|
|||||||
#include "google_apis/gaia/gaia_auth_util.h"
|
#include "google_apis/gaia/gaia_auth_util.h"
|
||||||
#include "google_apis/gaia/gaia_id.h"
|
#include "google_apis/gaia/gaia_id.h"
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
#include "base/system/sys_info.h"
|
#include "base/system/sys_info.h"
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
namespace em = enterprise_management;
|
namespace em = enterprise_management;
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ CloudPolicyValidatorBase::CloudPolicyValidatorBase(
|
|||||||
std::optional<std::string>
|
std::optional<std::string>
|
||||||
CloudPolicyValidatorBase::GetCurrentPolicyVerificationKey() {
|
CloudPolicyValidatorBase::GetCurrentPolicyVerificationKey() {
|
||||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
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
|
// Empty `verification_key_` is only allowed on Chrome OS test image when
|
||||||
// policy key verification is disabled via command line flag.
|
// policy key verification is disabled via command line flag.
|
||||||
if (command_line->HasSwitch(switches::kDisablePolicyKeyVerification)) {
|
if (command_line->HasSwitch(switches::kDisablePolicyKeyVerification)) {
|
||||||
@ -317,7 +317,7 @@ CloudPolicyValidatorBase::GetCurrentPolicyVerificationKey() {
|
|||||||
// GetPolicyVerificationKey() returns a non-empty string.
|
// GetPolicyVerificationKey() returns a non-empty string.
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
if (command_line->HasSwitch(switches::kPolicyVerificationKey)) {
|
if (command_line->HasSwitch(switches::kPolicyVerificationKey)) {
|
||||||
CHECK_IS_TEST();
|
CHECK_IS_TEST();
|
||||||
std::string decoded_key;
|
std::string decoded_key;
|
||||||
@ -434,12 +434,12 @@ void CloudPolicyValidatorBase::RunChecks() {
|
|||||||
// Verifies the |new_public_key_verification_signature_deprecated| for the
|
// Verifies the |new_public_key_verification_signature_deprecated| for the
|
||||||
// |new_public_key| in the policy blob.
|
// |new_public_key| in the policy blob.
|
||||||
bool CloudPolicyValidatorBase::CheckNewPublicKeyVerificationSignature() {
|
bool CloudPolicyValidatorBase::CheckNewPublicKeyVerificationSignature() {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Skip verification if the key is empty (disabled via command line).
|
// Skip verification if the key is empty (disabled via command line).
|
||||||
if (!verification_key_) {
|
if (!verification_key_) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
if (policy_->has_new_public_key_verification_data() &&
|
if (policy_->has_new_public_key_verification_data() &&
|
||||||
policy_->has_new_public_key_verification_data_signature() &&
|
policy_->has_new_public_key_verification_data_signature() &&
|
||||||
@ -593,12 +593,12 @@ CloudPolicyValidatorBase::Status CloudPolicyValidatorBase::CheckInitialKey() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CloudPolicyValidatorBase::Status CloudPolicyValidatorBase::CheckCachedKey() {
|
CloudPolicyValidatorBase::Status CloudPolicyValidatorBase::CheckCachedKey() {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Skip verification if the key is empty (disabled via command line).
|
// Skip verification if the key is empty (disabled via command line).
|
||||||
if (!verification_key_) {
|
if (!verification_key_) {
|
||||||
return VALIDATION_OK;
|
return VALIDATION_OK;
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
if (VerifySignature(new_cached_key_, verification_key_.value(),
|
if (VerifySignature(new_cached_key_, verification_key_.value(),
|
||||||
new_cached_key_signature_,
|
new_cached_key_signature_,
|
||||||
|
@ -28,12 +28,12 @@
|
|||||||
#include "testing/gmock/include/gmock/gmock.h"
|
#include "testing/gmock/include/gmock/gmock.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.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/system/sys_info.h"
|
||||||
#include "base/test/scoped_chromeos_version_info.h"
|
#include "base/test/scoped_chromeos_version_info.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "testing/gtest/include/gtest/gtest-death-test.h"
|
#include "testing/gtest/include/gtest/gtest-death-test.h"
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
namespace em = enterprise_management;
|
namespace em = enterprise_management;
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ class CloudPolicyValidatorTest : public testing::Test {
|
|||||||
MOCK_METHOD1(ValidationCompletion, void(UserCloudPolicyValidator* validator));
|
MOCK_METHOD1(ValidationCompletion, void(UserCloudPolicyValidator* validator));
|
||||||
};
|
};
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(CloudPolicyValidatorTest,
|
TEST_F(CloudPolicyValidatorTest,
|
||||||
SuccessfulValidationWithDisableKeyVerificationOnTestImage) {
|
SuccessfulValidationWithDisableKeyVerificationOnTestImage) {
|
||||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
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) {
|
TEST_F(CloudPolicyValidatorTest, SuccessfulValidation) {
|
||||||
Validate(Invoke(this, &CloudPolicyValidatorTest::CheckSuccessfulValidation));
|
Validate(Invoke(this, &CloudPolicyValidatorTest::CheckSuccessfulValidation));
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "services/network/test/test_url_loader_factory.h"
|
#include "services/network/test/test_url_loader_factory.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.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"
|
#include "chromeos/ash/components/system/fake_statistics_provider.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ class ResponseValueBuilder {
|
|||||||
class EncryptedReportingJobConfigurationTest : public testing::Test {
|
class EncryptedReportingJobConfigurationTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
EncryptedReportingJobConfigurationTest()
|
EncryptedReportingJobConfigurationTest()
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
: fake_serial_number_(&fake_statistics_provider_)
|
: fake_serial_number_(&fake_statistics_provider_)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -310,7 +310,7 @@ class EncryptedReportingJobConfigurationTest : public testing::Test {
|
|||||||
|
|
||||||
policy::MockCloudPolicyClient client_;
|
policy::MockCloudPolicyClient client_;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ash::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
|
ash::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
|
||||||
class ScopedFakeSerialNumber {
|
class ScopedFakeSerialNumber {
|
||||||
public:
|
public:
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "testing/gmock/include/gmock/gmock.h"
|
#include "testing/gmock/include/gmock/gmock.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.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"
|
#include "chromeos/ash/components/system/fake_statistics_provider.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class MockCallbackObserver {
|
|||||||
class RealtimeReportingJobConfigurationTest : public testing::Test {
|
class RealtimeReportingJobConfigurationTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
RealtimeReportingJobConfigurationTest()
|
RealtimeReportingJobConfigurationTest()
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
: client_(&service_),
|
: client_(&service_),
|
||||||
fake_serial_number_(&fake_statistics_provider_)
|
fake_serial_number_(&fake_statistics_provider_)
|
||||||
#else
|
#else
|
||||||
@ -159,7 +159,7 @@ class RealtimeReportingJobConfigurationTest : public testing::Test {
|
|||||||
MockCloudPolicyClient client_;
|
MockCloudPolicyClient client_;
|
||||||
StrictMock<MockCallbackObserver> callback_observer_;
|
StrictMock<MockCallbackObserver> callback_observer_;
|
||||||
DeviceManagementService::Job job_;
|
DeviceManagementService::Job job_;
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ash::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
|
ash::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
|
||||||
class ScopedFakeSerialNumber {
|
class ScopedFakeSerialNumber {
|
||||||
public:
|
public:
|
||||||
|
@ -675,7 +675,7 @@ TypedPolicyBuilder<em::ExternalPolicyData>::TypedPolicyBuilder() {
|
|||||||
template class TypedPolicyBuilder<em::ExternalPolicyData>;
|
template class TypedPolicyBuilder<em::ExternalPolicyData>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
StringPolicyBuilder::StringPolicyBuilder() = default;
|
StringPolicyBuilder::StringPolicyBuilder() = default;
|
||||||
|
|
||||||
void StringPolicyBuilder::Build() {
|
void StringPolicyBuilder::Build() {
|
||||||
|
@ -226,7 +226,7 @@ using ComponentCloudPolicyBuilder =
|
|||||||
TypedPolicyBuilder<enterprise_management::ExternalPolicyData>;
|
TypedPolicyBuilder<enterprise_management::ExternalPolicyData>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
using ComponentActiveDirectoryPolicyBuilder = StringPolicyBuilder;
|
using ComponentActiveDirectoryPolicyBuilder = StringPolicyBuilder;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ namespace policy {
|
|||||||
|
|
||||||
namespace {
|
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
|
// Checks if two schemas are the same or not. Note that this function doesn't
|
||||||
// consider restrictions on integers and strings nor pattern properties.
|
// consider restrictions on integers and strings nor pattern properties.
|
||||||
bool IsSameSchema(Schema a, Schema b) {
|
bool IsSameSchema(Schema a, Schema b) {
|
||||||
@ -170,7 +170,7 @@ TEST(GeneratePolicySource, ChromeSchemaData) {
|
|||||||
ASSERT_EQ(base::Value::Type::STRING, subschema.type());
|
ASSERT_EQ(base::Value::Type::STRING, subschema.type());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
subschema = schema.GetKnownProperty(key::kPowerManagementIdleSettings);
|
subschema = schema.GetKnownProperty(key::kPowerManagementIdleSettings);
|
||||||
ASSERT_TRUE(subschema.valid());
|
ASSERT_TRUE(subschema.valid());
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ TEST(GeneratePolicySource, PolicyScope) {
|
|||||||
ASSERT_TRUE(details);
|
ASSERT_TRUE(details);
|
||||||
EXPECT_EQ(kBrowser, details->scope);
|
EXPECT_EQ(kBrowser, details->scope);
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
details = GetChromePolicyDetails(key::kDeviceGuestModeEnabled);
|
details = GetChromePolicyDetails(key::kDeviceGuestModeEnabled);
|
||||||
ASSERT_TRUE(details);
|
ASSERT_TRUE(details);
|
||||||
EXPECT_EQ(kDevice, details->scope);
|
EXPECT_EQ(kDevice, details->scope);
|
||||||
@ -232,7 +232,7 @@ TEST(GeneratePolicySource, PolicyDetails) {
|
|||||||
EXPECT_EQ(0u, details->max_external_data_size);
|
EXPECT_EQ(0u, details->max_external_data_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
details = GetChromePolicyDetails(key::kDevicePolicyRefreshRate);
|
details = GetChromePolicyDetails(key::kDevicePolicyRefreshRate);
|
||||||
ASSERT_TRUE(details);
|
ASSERT_TRUE(details);
|
||||||
EXPECT_FALSE(details->is_deprecated);
|
EXPECT_FALSE(details->is_deprecated);
|
||||||
|
@ -53,7 +53,7 @@ void PlatformManagementService::AddLocalBrowserManagementStatusProvider(
|
|||||||
has_local_browser_managment_status_provider_ = true;
|
has_local_browser_managment_status_provider_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
void PlatformManagementService::AddChromeOsStatusProvider(
|
void PlatformManagementService::AddChromeOsStatusProvider(
|
||||||
std::unique_ptr<ManagementStatusProvider> provider) {
|
std::unique_ptr<ManagementStatusProvider> provider) {
|
||||||
AddManagementStatusProvider(std::move(provider));
|
AddManagementStatusProvider(std::move(provider));
|
||||||
|
@ -29,7 +29,7 @@ class POLICY_EXPORT PlatformManagementService : public ManagementService {
|
|||||||
return has_local_browser_managment_status_provider_;
|
return has_local_browser_managment_status_provider_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
void AddChromeOsStatusProvider(
|
void AddChromeOsStatusProvider(
|
||||||
std::unique_ptr<ManagementStatusProvider> provider);
|
std::unique_ptr<ManagementStatusProvider> provider);
|
||||||
bool has_cros_status_provider() const { return has_cros_status_provider_; }
|
bool has_cros_status_provider() const { return has_cros_status_provider_; }
|
||||||
@ -57,7 +57,7 @@ class POLICY_EXPORT PlatformManagementService : public ManagementService {
|
|||||||
~PlatformManagementService() override;
|
~PlatformManagementService() override;
|
||||||
|
|
||||||
bool has_local_browser_managment_status_provider_;
|
bool has_local_browser_managment_status_provider_;
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
bool has_cros_status_provider_;
|
bool has_cros_status_provider_;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -26,13 +26,13 @@ namespace {
|
|||||||
|
|
||||||
#if !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_ANDROID)
|
#if !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_ANDROID)
|
||||||
constexpr const char* kDictionaryPoliciesToMerge[] = {
|
constexpr const char* kDictionaryPoliciesToMerge[] = {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
key::kExtensionSettings, key::kDeviceLoginScreenPowerManagement,
|
key::kExtensionSettings, key::kDeviceLoginScreenPowerManagement,
|
||||||
key::kKeyPermissions, key::kPowerManagementIdleSettings,
|
key::kKeyPermissions, key::kPowerManagementIdleSettings,
|
||||||
key::kScreenBrightnessPercent, key::kScreenLockDelays,
|
key::kScreenBrightnessPercent, key::kScreenLockDelays,
|
||||||
#else
|
#else
|
||||||
key::kExtensionSettings,
|
key::kExtensionSettings,
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
};
|
};
|
||||||
#endif // !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_ANDROID)
|
#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.
|
// line flag. Can be used only for unit tests or browser tests.
|
||||||
const char kPolicyVerificationKey[] = "policy-verification-key";
|
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
|
// Disables the verification of policy signing keys. It just works on Chrome OS
|
||||||
// test images and crashes otherwise.
|
// test images and crashes otherwise.
|
||||||
// TODO(crbug.com/1225054): This flag might introduce security risks. Find a
|
// TODO(crbug.com/1225054): This flag might introduce security risks. Find a
|
||||||
// better solution to enable policy tast test for Family Link account.
|
// better solution to enable policy tast test for Family Link account.
|
||||||
const char kDisablePolicyKeyVerification[] = "disable-policy-key-verification";
|
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.
|
// Specifies the base URL to contact the secure connect Api.
|
||||||
const char kSecureConnectApiUrl[] = "secure-connect-api-url";
|
const char kSecureConnectApiUrl[] = "secure-connect-api-url";
|
||||||
|
@ -20,9 +20,9 @@ extern const char kChromePolicy[];
|
|||||||
extern const char kSecureConnectApiUrl[];
|
extern const char kSecureConnectApiUrl[];
|
||||||
extern const char kFileStorageServerUploadUrl[];
|
extern const char kFileStorageServerUploadUrl[];
|
||||||
extern const char kPolicyVerificationKey[];
|
extern const char kPolicyVerificationKey[];
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
extern const char kDisablePolicyKeyVerification[];
|
extern const char kDisablePolicyKeyVerification[];
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
} // namespace switches
|
} // namespace switches
|
||||||
} // namespace policy
|
} // namespace policy
|
||||||
|
@ -187,7 +187,7 @@ std::string RemoteCommandsService::GetRequestType(
|
|||||||
case PolicyInvalidationScope::kCBCM:
|
case PolicyInvalidationScope::kCBCM:
|
||||||
return dm_protocol::kChromeBrowserRemoteCommandType;
|
return dm_protocol::kChromeBrowserRemoteCommandType;
|
||||||
case PolicyInvalidationScope::kUser:
|
case PolicyInvalidationScope::kUser:
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
return dm_protocol::kChromeAshUserRemoteCommandType;
|
return dm_protocol::kChromeAshUserRemoteCommandType;
|
||||||
#else
|
#else
|
||||||
return dm_protocol::kChromeUserRemoteCommandType;
|
return dm_protocol::kChromeUserRemoteCommandType;
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "components/prefs/android/pref_service_android.h"
|
#include "components/prefs/android/pref_service_android.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
namespace pref_service_util {
|
namespace pref_service_util {
|
||||||
void GetAllDottedPaths(std::string_view prefix,
|
void GetAllDottedPaths(std::string_view prefix,
|
||||||
const base::Value::Dict& dict,
|
const base::Value::Dict& dict,
|
||||||
@ -63,7 +63,7 @@ void GetAllDottedPaths(const base::Value::Dict& dict,
|
|||||||
GetAllDottedPaths("", dict, paths);
|
GetAllDottedPaths("", dict, paths);
|
||||||
}
|
}
|
||||||
} // namespace pref_service_util
|
} // namespace pref_service_util
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
PrefService::PersistentPrefStoreLoadingObserver::
|
PrefService::PersistentPrefStoreLoadingObserver::
|
||||||
PersistentPrefStoreLoadingObserver(PrefService* pref_service)
|
PersistentPrefStoreLoadingObserver(PrefService* pref_service)
|
||||||
|
@ -62,7 +62,7 @@ class PrefMemberBase;
|
|||||||
class ScopedUserPrefUpdateBase;
|
class ScopedUserPrefUpdateBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
namespace pref_service_util {
|
namespace pref_service_util {
|
||||||
// Gets all the dotted paths from `dict`. For example if values stored are
|
// 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"].
|
// `{"a" : { "b" : true, "c": false }}`, then `paths` gets ["a.b", "a.c"].
|
||||||
|
@ -31,7 +31,7 @@ const char kPrefName[] = "pref.name";
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST(PrefServiceUtilTest, GetAllDottedPaths) {
|
TEST(PrefServiceUtilTest, GetAllDottedPaths) {
|
||||||
using pref_service_util::GetAllDottedPaths;
|
using pref_service_util::GetAllDottedPaths;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ std::string TokenServiceLoadCredentialsStateToLabel(
|
|||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
std::string SigninStatusFieldToLabel(
|
std::string SigninStatusFieldToLabel(
|
||||||
signin_internals_util::TimedSigninStatusField field) {
|
signin_internals_util::TimedSigninStatusField field) {
|
||||||
switch (field) {
|
switch (field) {
|
||||||
@ -163,7 +163,7 @@ std::string SigninStatusFieldToLabel(
|
|||||||
}
|
}
|
||||||
NOTREACHED();
|
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
|
// 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.
|
// 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",
|
AddSectionEntry(basic_info, "Network calls delayed",
|
||||||
signin_client->AreNetworkCallsDelayed() ? "True" : "False");
|
signin_client->AreNetworkCallsDelayed() ? "True" : "False");
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
const auto& last_signout_value =
|
const auto& last_signout_value =
|
||||||
timed_signin_fields[signin_internals_util::LAST_SIGNOUT_SOURCE -
|
timed_signin_fields[signin_internals_util::LAST_SIGNOUT_SOURCE -
|
||||||
signin_internals_util::TIMED_FIELDS_BEGIN];
|
signin_internals_util::TIMED_FIELDS_BEGIN];
|
||||||
@ -726,12 +726,12 @@ base::Value::Dict AboutSigninInternals::SigninStatus::ToValue(
|
|||||||
basic_info,
|
basic_info,
|
||||||
SigninStatusFieldToLabel(signin_internals_util::LAST_SIGNOUT_SOURCE),
|
SigninStatusFieldToLabel(signin_internals_util::LAST_SIGNOUT_SOURCE),
|
||||||
last_signout_value.first, last_signout_value.second);
|
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");
|
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.
|
// Time and status information of the possible sign in types.
|
||||||
{
|
{
|
||||||
base::Value::List detailed_info;
|
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");
|
AddSection(signin_info, std::move(detailed_info), "Last Signin Details");
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
base::Value::Dict signin_status;
|
base::Value::Dict signin_status;
|
||||||
signin_status.Set("signin_info", std::move(signin_info));
|
signin_status.Set("signin_info", std::move(signin_info));
|
||||||
|
@ -61,11 +61,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS)
|
#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 "chromeos/ash/components/install_attributes/stub_install_attributes.h"
|
||||||
|
#include "components/account_manager_core/mock_account_manager_facade.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using signin_metrics::AccountReconcilorState;
|
using signin_metrics::AccountReconcilorState;
|
||||||
@ -340,7 +337,7 @@ class AccountReconcilorTest : public ::testing::Test {
|
|||||||
network::TestURLLoaderFactory test_url_loader_factory_;
|
network::TestURLLoaderFactory test_url_loader_factory_;
|
||||||
|
|
||||||
signin::ConsentLevel consent_level_for_reconcile_ =
|
signin::ConsentLevel consent_level_for_reconcile_ =
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// TODO(crbug.com/40067189): Migrate away from
|
// TODO(crbug.com/40067189): Migrate away from
|
||||||
// `ConsentLevel::kSync` on Ash.
|
// `ConsentLevel::kSync` on Ash.
|
||||||
signin::ConsentLevel::kSync;
|
signin::ConsentLevel::kSync;
|
||||||
@ -827,7 +824,7 @@ class AccountReconcilorTestTable
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(AccountReconcilorMirrorTest, IdentityManagerRegistration) {
|
TEST_F(AccountReconcilorMirrorTest, IdentityManagerRegistration) {
|
||||||
AccountReconcilor* reconcilor = GetMockReconcilor();
|
AccountReconcilor* reconcilor = GetMockReconcilor();
|
||||||
ASSERT_TRUE(reconcilor);
|
ASSERT_TRUE(reconcilor);
|
||||||
@ -860,7 +857,7 @@ TEST_F(AccountReconcilorMirrorTest, Reauth) {
|
|||||||
ASSERT_TRUE(reconcilor->IsRegisteredWithIdentityManager());
|
ASSERT_TRUE(reconcilor->IsRegisteredWithIdentityManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(AccountReconcilorMirrorTest, ProfileAlreadyConnected) {
|
TEST_F(AccountReconcilorMirrorTest, ProfileAlreadyConnected) {
|
||||||
ConnectProfileToAccount(kFakeEmail);
|
ConnectProfileToAccount(kFakeEmail);
|
||||||
@ -2364,7 +2361,7 @@ TEST_F(AccountReconcilorMirrorTest,
|
|||||||
ASSERT_TRUE(reconcilor->is_reconcile_started_);
|
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.
|
// This test is needed until chrome changes to use gaia obfuscated id.
|
||||||
// The primary account manager and token service use the gaia "email" property,
|
// The primary account manager and token service use the gaia "email" property,
|
||||||
// which preserves dots in usernames and preserves case.
|
// which preserves dots in usernames and preserves case.
|
||||||
@ -2507,7 +2504,7 @@ TEST_F(AccountReconcilorTest, AuthErrorTriggersListAccount) {
|
|||||||
identity_test_env()->identity_manager()->RemoveObserver(&observer);
|
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,
|
// This test does not run on ChromeOS because it clears the primary account,
|
||||||
// which is not a flow that exists on ChromeOS.
|
// 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;
|
expected_counts["Signin.Reconciler.Duration.UpTo3mins.Failure"] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(AccountReconcilorMirrorTest, StartReconcileRemoveFromCookie) {
|
TEST_F(AccountReconcilorMirrorTest, StartReconcileRemoveFromCookie) {
|
||||||
AccountInfo account_info = ConnectProfileToAccount(kFakeEmail);
|
AccountInfo account_info = ConnectProfileToAccount(kFakeEmail);
|
||||||
|
@ -40,7 +40,7 @@ bool MirrorAccountReconcilorDelegate::ShouldAbortReconcileIfPrimaryHasError()
|
|||||||
|
|
||||||
ConsentLevel MirrorAccountReconcilorDelegate::GetConsentLevelForPrimaryAccount()
|
ConsentLevel MirrorAccountReconcilorDelegate::GetConsentLevelForPrimaryAccount()
|
||||||
const {
|
const {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// TODO(crbug.com/40067189): Migrate away from `ConsentLevel::kSync` on
|
// TODO(crbug.com/40067189): Migrate away from `ConsentLevel::kSync` on
|
||||||
// Ash.
|
// Ash.
|
||||||
return ConsentLevel::kSync;
|
return ConsentLevel::kSync;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "net/http/http_status_code.h"
|
#include "net/http/http_status_code.h"
|
||||||
#include "services/network/public/cpp/shared_url_loader_factory.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"
|
#include "ash/constants/ash_features.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ AccountTrackerService::~AccountTrackerService() {
|
|||||||
// static
|
// static
|
||||||
void AccountTrackerService::RegisterPrefs(PrefRegistrySimple* registry) {
|
void AccountTrackerService::RegisterPrefs(PrefRegistrySimple* registry) {
|
||||||
registry->RegisterListPref(prefs::kAccountInfo);
|
registry->RegisterListPref(prefs::kAccountInfo);
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
registry->RegisterIntegerPref(prefs::kAccountIdMigrationState,
|
registry->RegisterIntegerPref(prefs::kAccountIdMigrationState,
|
||||||
AccountTrackerService::MIGRATION_NOT_STARTED);
|
AccountTrackerService::MIGRATION_NOT_STARTED);
|
||||||
#endif
|
#endif
|
||||||
@ -265,7 +265,7 @@ AccountInfo AccountTrackerService::FindAccountInfoByEmail(
|
|||||||
return AccountInfo();
|
return AccountInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
AccountTrackerService::AccountIdMigrationState
|
AccountTrackerService::AccountIdMigrationState
|
||||||
AccountTrackerService::GetMigrationState() const {
|
AccountTrackerService::GetMigrationState() const {
|
||||||
return GetMigrationState(pref_service_);
|
return GetMigrationState(pref_service_);
|
||||||
@ -456,7 +456,7 @@ void AccountTrackerService::ResetForTesting() {
|
|||||||
Initialize(prefs, base::FilePath());
|
Initialize(prefs, base::FilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
void AccountTrackerService::MigrateToGaiaId() {
|
void AccountTrackerService::MigrateToGaiaId() {
|
||||||
DCHECK_EQ(GetMigrationState(), MIGRATION_IN_PROGRESS);
|
DCHECK_EQ(GetMigrationState(), MIGRATION_IN_PROGRESS);
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ void AccountTrackerService::MigrateToGaiaId() {
|
|||||||
accounts_.erase(account_id);
|
accounts_.erase(account_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
bool AccountTrackerService::AreAllAccountsMigrated() const {
|
bool AccountTrackerService::AreAllAccountsMigrated() const {
|
||||||
for (const auto& pair : accounts_) {
|
for (const auto& pair : accounts_) {
|
||||||
@ -513,7 +513,7 @@ bool AccountTrackerService::AreAllAccountsMigrated() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
AccountTrackerService::AccountIdMigrationState
|
AccountTrackerService::AccountIdMigrationState
|
||||||
AccountTrackerService::ComputeNewMigrationState() const {
|
AccountTrackerService::ComputeNewMigrationState() const {
|
||||||
if (accounts_.empty()) {
|
if (accounts_.empty()) {
|
||||||
@ -550,7 +550,7 @@ AccountTrackerService::GetMigrationState(const PrefService* pref_service) {
|
|||||||
return static_cast<AccountTrackerService::AccountIdMigrationState>(
|
return static_cast<AccountTrackerService::AccountIdMigrationState>(
|
||||||
pref_service->GetInteger(prefs::kAccountIdMigrationState));
|
pref_service->GetInteger(prefs::kAccountIdMigrationState));
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
base::FilePath AccountTrackerService::GetImagePathFor(
|
base::FilePath AccountTrackerService::GetImagePathFor(
|
||||||
const CoreAccountId& account_id) {
|
const CoreAccountId& account_id) {
|
||||||
@ -738,7 +738,7 @@ void AccountTrackerService::LoadFromPrefs() {
|
|||||||
RemoveAccountImageFromDisk(account_id);
|
RemoveAccountImageFromDisk(account_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
if (GetMigrationState() != MIGRATION_DONE) {
|
if (GetMigrationState() != MIGRATION_DONE) {
|
||||||
const AccountIdMigrationState new_state = ComputeNewMigrationState();
|
const AccountIdMigrationState new_state = ComputeNewMigrationState();
|
||||||
SetMigrationState(new_state);
|
SetMigrationState(new_state);
|
||||||
@ -756,7 +756,7 @@ void AccountTrackerService::LoadFromPrefs() {
|
|||||||
#else
|
#else
|
||||||
DCHECK(AreAllAccountsMigrated())
|
DCHECK(AreAllAccountsMigrated())
|
||||||
<< "accounts = " << AccountsToString(accounts_);
|
<< "accounts = " << AccountsToString(accounts_);
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
UMA_HISTOGRAM_COUNTS_100("Signin.AccountTracker.CountOfLoadedAccounts",
|
UMA_HISTOGRAM_COUNTS_100("Signin.AccountTracker.CountOfLoadedAccounts",
|
||||||
accounts_.size());
|
accounts_.size());
|
||||||
@ -825,7 +825,7 @@ void AccountTrackerService::RemoveFromPrefs(const AccountInfo& account_info) {
|
|||||||
CoreAccountId AccountTrackerService::PickAccountIdForAccount(
|
CoreAccountId AccountTrackerService::PickAccountIdForAccount(
|
||||||
const GaiaId& gaia,
|
const GaiaId& gaia,
|
||||||
const std::string& email) const {
|
const std::string& email) const {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
DCHECK(!email.empty());
|
DCHECK(!email.empty());
|
||||||
switch (GetMigrationState(pref_service_)) {
|
switch (GetMigrationState(pref_service_)) {
|
||||||
case MIGRATION_NOT_STARTED:
|
case MIGRATION_NOT_STARTED:
|
||||||
|
@ -60,7 +60,7 @@ class AccountTrackerService {
|
|||||||
typedef base::RepeatingCallback<void(const AccountInfo& info)>
|
typedef base::RepeatingCallback<void(const AccountInfo& info)>
|
||||||
AccountInfoCallback;
|
AccountInfoCallback;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Possible values for the kAccountIdMigrationState preference.
|
// Possible values for the kAccountIdMigrationState preference.
|
||||||
// Keep in sync with OAuth2LoginAccountRevokedMigrationState histogram enum.
|
// Keep in sync with OAuth2LoginAccountRevokedMigrationState histogram enum.
|
||||||
// These values are persisted to logs. Entries should not be renumbered and
|
// These values are persisted to logs. Entries should not be renumbered and
|
||||||
@ -133,7 +133,7 @@ class AccountTrackerService {
|
|||||||
|
|
||||||
void RemoveAccount(const CoreAccountId& account_id);
|
void RemoveAccount(const CoreAccountId& account_id);
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
AccountIdMigrationState GetMigrationState() const;
|
AccountIdMigrationState GetMigrationState() const;
|
||||||
void SetMigrationDone();
|
void SetMigrationDone();
|
||||||
#endif
|
#endif
|
||||||
@ -217,7 +217,7 @@ class AccountTrackerService {
|
|||||||
// be the case when the migration state is set to MIGRATION_DONE.
|
// be the case when the migration state is set to MIGRATION_DONE.
|
||||||
bool AreAllAccountsMigrated() const;
|
bool AreAllAccountsMigrated() const;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Migrate accounts to be keyed by gaia id instead of normalized email.
|
// Migrate accounts to be keyed by gaia id instead of normalized email.
|
||||||
// Requires that the migration state is set to MIGRATION_IN_PROGRESS.
|
// Requires that the migration state is set to MIGRATION_IN_PROGRESS.
|
||||||
void MigrateToGaiaId();
|
void MigrateToGaiaId();
|
||||||
@ -233,7 +233,7 @@ class AccountTrackerService {
|
|||||||
// Returns the saved migration state in the preferences.
|
// Returns the saved migration state in the preferences.
|
||||||
static AccountIdMigrationState GetMigrationState(
|
static AccountIdMigrationState GetMigrationState(
|
||||||
const PrefService* pref_service);
|
const PrefService* pref_service);
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// Update the child status on the provided account.
|
// Update the child status on the provided account.
|
||||||
// This does not notify observers, or persist updates to disk - the caller
|
// 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/gmock/include/gmock/gmock.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
#include "ash/constants/ash_features.h"
|
#include "ash/constants/ash_features.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ const AccountKey kAccountKeyIncomplete = {"incomplete"};
|
|||||||
const AccountKey kAccountKeyFooBar = {"foobar"};
|
const AccountKey kAccountKeyFooBar = {"foobar"};
|
||||||
const AccountKey kAccountKeyFooDotBar = {"foo.bar"};
|
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"};
|
const AccountKey kAccountKeyAdvancedProtection = {"advanced_protection"};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ class AccountTrackerServiceTest : public testing::Test {
|
|||||||
DCHECK(!account_tracker_);
|
DCHECK(!account_tracker_);
|
||||||
DCHECK(!account_fetcher_);
|
DCHECK(!account_fetcher_);
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
pref_service_.SetInteger(prefs::kAccountIdMigrationState,
|
pref_service_.SetInteger(prefs::kAccountIdMigrationState,
|
||||||
AccountTrackerService::MIGRATION_NOT_STARTED);
|
AccountTrackerService::MIGRATION_NOT_STARTED);
|
||||||
#endif
|
#endif
|
||||||
@ -983,7 +983,7 @@ TEST_F(AccountTrackerServiceTest, Persistence) {
|
|||||||
true);
|
true);
|
||||||
#endif
|
#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(
|
account_tracker()->SetIsAdvancedProtectionAccount(
|
||||||
AccountKeyToAccountId(kAccountKeyBeta), true);
|
AccountKeyToAccountId(kAccountKeyBeta), true);
|
||||||
#endif
|
#endif
|
||||||
@ -997,7 +997,7 @@ TEST_F(AccountTrackerServiceTest, Persistence) {
|
|||||||
CheckAccountDetails(kAccountKeyBeta, infos[0]);
|
CheckAccountDetails(kAccountKeyBeta, infos[0]);
|
||||||
CheckAccountCapabilities(kAccountKeyBeta, infos[0]);
|
CheckAccountCapabilities(kAccountKeyBeta, infos[0]);
|
||||||
EXPECT_EQ(signin::Tribool::kTrue, infos[0].is_child_account);
|
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);
|
EXPECT_TRUE(infos[0].is_under_advanced_protection);
|
||||||
#else
|
#else
|
||||||
EXPECT_FALSE(infos[0].is_under_advanced_protection);
|
EXPECT_FALSE(infos[0].is_under_advanced_protection);
|
||||||
@ -1215,7 +1215,7 @@ TEST_F(AccountTrackerServiceTest, TimerRefresh) {
|
|||||||
EXPECT_FALSE(account_fetcher()->AreAllAccountCapabilitiesFetched());
|
EXPECT_FALSE(account_fetcher()->AreAllAccountCapabilitiesFetched());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(AccountTrackerServiceTest, MigrateAccountIdToGaiaId) {
|
TEST_F(AccountTrackerServiceTest, MigrateAccountIdToGaiaId) {
|
||||||
const std::string email_alpha = AccountKeyToEmail(kAccountKeyAlpha);
|
const std::string email_alpha = AccountKeyToEmail(kAccountKeyAlpha);
|
||||||
const std::string gaia_alpha = AccountKeyToGaiaId(kAccountKeyAlpha);
|
const std::string gaia_alpha = AccountKeyToGaiaId(kAccountKeyAlpha);
|
||||||
@ -1368,7 +1368,7 @@ TEST_F(AccountTrackerServiceTest, GaiaIdMigrationCrashInTheMiddle) {
|
|||||||
accounts = account_tracker()->GetAccounts();
|
accounts = account_tracker()->GetAccounts();
|
||||||
EXPECT_EQ(2u, accounts.size());
|
EXPECT_EQ(2u, accounts.size());
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(AccountTrackerServiceTest, ChildAccountBasic) {
|
TEST_F(AccountTrackerServiceTest, ChildAccountBasic) {
|
||||||
SimulateTokenAvailable(kAccountKeyChild);
|
SimulateTokenAvailable(kAccountKeyChild);
|
||||||
@ -1618,7 +1618,7 @@ TEST_F(AccountTrackerServiceTest, RemoveAccountBeforeCapabilitiesFetched) {
|
|||||||
EXPECT_TRUE(account_fetcher()->AreAllAccountCapabilitiesFetched());
|
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) {
|
TEST_F(AccountTrackerServiceTest, AdvancedProtectionAccountBasic) {
|
||||||
SimulateTokenAvailable(kAccountKeyAdvancedProtection);
|
SimulateTokenAvailable(kAccountKeyAdvancedProtection);
|
||||||
IssueAccessToken(kAccountKeyAdvancedProtection);
|
IssueAccessToken(kAccountKeyAdvancedProtection);
|
||||||
@ -1647,7 +1647,7 @@ TEST_F(AccountTrackerServiceTest, CountOfLoadedAccounts_NoAccount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(AccountTrackerServiceTest, CountOfLoadedAccounts_TwoAccounts) {
|
TEST_F(AccountTrackerServiceTest, CountOfLoadedAccounts_TwoAccounts) {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
prefs()->SetInteger(prefs::kAccountIdMigrationState,
|
prefs()->SetInteger(prefs::kAccountIdMigrationState,
|
||||||
AccountTrackerService::MIGRATION_DONE);
|
AccountTrackerService::MIGRATION_DONE);
|
||||||
#endif
|
#endif
|
||||||
@ -1677,7 +1677,7 @@ TEST_F(AccountTrackerServiceTest, CountOfLoadedAccounts_TwoAccounts) {
|
|||||||
testing::ElementsAre(base::Bucket(2, 1)));
|
testing::ElementsAre(base::Bucket(2, 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(AccountTrackerServiceTest, Migrate_CountOfLoadedAccounts_TwoAccounts) {
|
TEST_F(AccountTrackerServiceTest, Migrate_CountOfLoadedAccounts_TwoAccounts) {
|
||||||
const std::string email_alpha = AccountKeyToEmail(kAccountKeyAlpha);
|
const std::string email_alpha = AccountKeyToEmail(kAccountKeyAlpha);
|
||||||
const std::string gaia_alpha = AccountKeyToGaiaId(kAccountKeyAlpha);
|
const std::string gaia_alpha = AccountKeyToGaiaId(kAccountKeyAlpha);
|
||||||
|
@ -50,7 +50,7 @@ CoreAccountId AccountsMutatorImpl::AddOrUpdateAccount(
|
|||||||
const std::vector<uint8_t>& wrapped_binding_key
|
const std::vector<uint8_t>& wrapped_binding_key
|
||||||
#endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
#endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
||||||
) {
|
) {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
#else
|
#else
|
||||||
CoreAccountId account_id =
|
CoreAccountId account_id =
|
||||||
@ -93,7 +93,7 @@ void AccountsMutatorImpl::UpdateAccountInfo(
|
|||||||
void AccountsMutatorImpl::RemoveAccount(
|
void AccountsMutatorImpl::RemoveAccount(
|
||||||
const CoreAccountId& account_id,
|
const CoreAccountId& account_id,
|
||||||
signin_metrics::SourceForRefreshTokenOperation source) {
|
signin_metrics::SourceForRefreshTokenOperation source) {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
#else
|
#else
|
||||||
token_service_->RevokeCredentials(account_id, source);
|
token_service_->RevokeCredentials(account_id, source);
|
||||||
@ -102,7 +102,7 @@ void AccountsMutatorImpl::RemoveAccount(
|
|||||||
|
|
||||||
void AccountsMutatorImpl::RemoveAllAccounts(
|
void AccountsMutatorImpl::RemoveAllAccounts(
|
||||||
signin_metrics::SourceForRefreshTokenOperation source) {
|
signin_metrics::SourceForRefreshTokenOperation source) {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
#else
|
#else
|
||||||
token_service_->RevokeAllCredentials(source);
|
token_service_->RevokeAllCredentials(source);
|
||||||
@ -111,7 +111,7 @@ void AccountsMutatorImpl::RemoveAllAccounts(
|
|||||||
|
|
||||||
void AccountsMutatorImpl::InvalidateRefreshTokenForPrimaryAccount(
|
void AccountsMutatorImpl::InvalidateRefreshTokenForPrimaryAccount(
|
||||||
signin_metrics::SourceForRefreshTokenOperation source) {
|
signin_metrics::SourceForRefreshTokenOperation source) {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
#else
|
#else
|
||||||
DCHECK(primary_account_manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
DCHECK(primary_account_manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
||||||
@ -153,7 +153,7 @@ void AccountsMutatorImpl::MoveAccount(AccountsMutator* target,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
CoreAccountId AccountsMutatorImpl::SeedAccountInfo(const GaiaId& gaia_id,
|
CoreAccountId AccountsMutatorImpl::SeedAccountInfo(const GaiaId& gaia_id,
|
||||||
const std::string& email) {
|
const std::string& email) {
|
||||||
return account_tracker_service_->SeedAccountInfo(gaia_id, email);
|
return account_tracker_service_->SeedAccountInfo(gaia_id, email);
|
||||||
|
@ -67,7 +67,7 @@ class AccountsMutatorImpl : public AccountsMutator {
|
|||||||
const CoreAccountId& account_id) override;
|
const CoreAccountId& account_id) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
CoreAccountId SeedAccountInfo(const GaiaId& gaia,
|
CoreAccountId SeedAccountInfo(const GaiaId& gaia,
|
||||||
const std::string& email) override;
|
const std::string& email) override;
|
||||||
#endif
|
#endif
|
||||||
|
@ -343,7 +343,7 @@ void PrimaryAccountManager::PrepareToLoadPrefs() {
|
|||||||
prefs->SetBoolean(prefs::kGoogleServicesConsentedToSync, false);
|
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.
|
// Migrate primary account ID from email to Gaia ID if needed.
|
||||||
std::string pref_account_id =
|
std::string pref_account_id =
|
||||||
prefs->GetString(prefs::kGoogleServicesAccountId);
|
prefs->GetString(prefs::kGoogleServicesAccountId);
|
||||||
@ -612,7 +612,7 @@ void PrimaryAccountManager::RemoveObserver(Observer* observer) {
|
|||||||
observers_.RemoveObserver(observer);
|
observers_.RemoveObserver(observer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
void PrimaryAccountManager::ClearPrimaryAccount(
|
void PrimaryAccountManager::ClearPrimaryAccount(
|
||||||
signin_metrics::ProfileSignout signout_source_metric) {
|
signin_metrics::ProfileSignout signout_source_metric) {
|
||||||
StartSignOut(signout_source_metric, RemoveAccountsOption::kRemoveAllAccounts);
|
StartSignOut(signout_source_metric, RemoveAccountsOption::kRemoveAllAccounts);
|
||||||
@ -624,7 +624,7 @@ void PrimaryAccountManager::RemovePrimaryAccountButKeepTokens(
|
|||||||
RemoveAccountsOption::kKeepAllAccountsAndClearPrimary);
|
RemoveAccountsOption::kKeepAllAccountsAndClearPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
void PrimaryAccountManager::RevokeSyncConsent(
|
void PrimaryAccountManager::RevokeSyncConsent(
|
||||||
signin_metrics::ProfileSignout signout_source_metric) {
|
signin_metrics::ProfileSignout signout_source_metric) {
|
||||||
@ -795,7 +795,7 @@ void PrimaryAccountManager::FirePrimaryAccountChanged(
|
|||||||
void PrimaryAccountManager::OnRefreshTokensLoaded() {
|
void PrimaryAccountManager::OnRefreshTokensLoaded() {
|
||||||
token_service_observation_.Reset();
|
token_service_observation_.Reset();
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
if (account_tracker_service_->GetMigrationState() ==
|
if (account_tracker_service_->GetMigrationState() ==
|
||||||
AccountTrackerService::MIGRATION_IN_PROGRESS) {
|
AccountTrackerService::MIGRATION_IN_PROGRESS) {
|
||||||
account_tracker_service_->SetMigrationDone();
|
account_tracker_service_->SetMigrationDone();
|
||||||
|
@ -128,7 +128,7 @@ class PrimaryAccountManager : public ProfileOAuth2TokenServiceObserver {
|
|||||||
|
|
||||||
// Signout API surfaces (not supported on ChromeOS, where signout is not
|
// Signout API surfaces (not supported on ChromeOS, where signout is not
|
||||||
// permitted).
|
// permitted).
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
// Clears the primary account, erasing all keys associated with the primary
|
// Clears the primary account, erasing all keys associated with the primary
|
||||||
// account (also cancels all auth in progress).
|
// account (also cancels all auth in progress).
|
||||||
// It removes all accounts from the identity manager by revoking all refresh
|
// It removes all accounts from the identity manager by revoking all refresh
|
||||||
@ -141,7 +141,7 @@ class PrimaryAccountManager : public ProfileOAuth2TokenServiceObserver {
|
|||||||
void RemovePrimaryAccountButKeepTokens(
|
void RemovePrimaryAccountButKeepTokens(
|
||||||
signin_metrics::ProfileSignout signout_source_metric);
|
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
|
// Rovokes the sync consent but leaves the primary account and the rest of
|
||||||
// the accounts untouched.
|
// the accounts untouched.
|
||||||
|
@ -204,7 +204,7 @@ class PrimaryAccountManagerTest : public testing::Test,
|
|||||||
int num_unconsented_account_changed_{0};
|
int num_unconsented_account_changed_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(PrimaryAccountManagerTest, SignOut) {
|
TEST_F(PrimaryAccountManagerTest, SignOut) {
|
||||||
CreatePrimaryAccountManager();
|
CreatePrimaryAccountManager();
|
||||||
CoreAccountId main_account_id =
|
CoreAccountId main_account_id =
|
||||||
@ -385,7 +385,7 @@ TEST_F(PrimaryAccountManagerTest, RevokeSyncConsentAllowedSignoutProhibited) {
|
|||||||
EXPECT_FALSE(manager_->HasPrimaryAccount(ConsentLevel::kSync));
|
EXPECT_FALSE(manager_->HasPrimaryAccount(ConsentLevel::kSync));
|
||||||
EXPECT_TRUE(manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
EXPECT_TRUE(manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
manager_->ClearPrimaryAccount(signin_metrics::ProfileSignout::kTest);
|
manager_->ClearPrimaryAccount(signin_metrics::ProfileSignout::kTest);
|
||||||
EXPECT_TRUE(manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
EXPECT_TRUE(manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
||||||
CheckSigninMetrics({.sign_in = AccessPoint::ACCESS_POINT_UNKNOWN,
|
CheckSigninMetrics({.sign_in = AccessPoint::ACCESS_POINT_UNKNOWN,
|
||||||
@ -518,7 +518,7 @@ TEST_F(PrimaryAccountManagerTest,
|
|||||||
kLastSignedInUsername);
|
kLastSignedInUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(PrimaryAccountManagerTest, GaiaIdMigration) {
|
TEST_F(PrimaryAccountManagerTest, GaiaIdMigration) {
|
||||||
ASSERT_EQ(AccountTrackerService::MIGRATION_DONE,
|
ASSERT_EQ(AccountTrackerService::MIGRATION_DONE,
|
||||||
account_tracker()->GetMigrationState());
|
account_tracker()->GetMigrationState());
|
||||||
@ -757,7 +757,7 @@ TEST_F(PrimaryAccountManagerTest, RevokeSyncConsent) {
|
|||||||
manager_->GetPrimaryAccountInfo(ConsentLevel::kSignin).account_id);
|
manager_->GetPrimaryAccountInfo(ConsentLevel::kSignin).account_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(PrimaryAccountManagerTest, ClearPrimaryAccount) {
|
TEST_F(PrimaryAccountManagerTest, ClearPrimaryAccount) {
|
||||||
CreatePrimaryAccountManager();
|
CreatePrimaryAccountManager();
|
||||||
CoreAccountId account_id = AddToAccountTracker("gaia_id", "user@gmail.com");
|
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::kSync));
|
||||||
EXPECT_FALSE(manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
EXPECT_FALSE(manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(PrimaryAccountManagerTest,
|
TEST_F(PrimaryAccountManagerTest,
|
||||||
RecordExistingPreviousSyncAccountIfCurrentlySignedOut) {
|
RecordExistingPreviousSyncAccountIfCurrentlySignedOut) {
|
||||||
@ -1005,7 +1005,7 @@ TEST_F(PrimaryAccountManagerTest, ExplicitSigninPref) {
|
|||||||
EXPECT_TRUE(prefs()->GetBoolean(
|
EXPECT_TRUE(prefs()->GetBoolean(
|
||||||
kExplicitBrowserSigninWithoutFeatureEnabledForTesting));
|
kExplicitBrowserSigninWithoutFeatureEnabledForTesting));
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
// Clearing signin.
|
// Clearing signin.
|
||||||
manager_->ClearPrimaryAccount(signin_metrics::ProfileSignout::kTest);
|
manager_->ClearPrimaryAccount(signin_metrics::ProfileSignout::kTest);
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ PrimaryAccountMutatorImpl::SetPrimaryAccount(
|
|||||||
DCHECK(!account_info.email.empty());
|
DCHECK(!account_info.email.empty());
|
||||||
DCHECK(!account_info.gaia.empty());
|
DCHECK(!account_info.gaia.empty());
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
bool is_signin_allowed = pref_service_->GetBoolean(prefs::kSigninAllowed);
|
bool is_signin_allowed = pref_service_->GetBoolean(prefs::kSigninAllowed);
|
||||||
if (!is_signin_allowed)
|
if (!is_signin_allowed)
|
||||||
return PrimaryAccountError::kSigninNotAllowed;
|
return PrimaryAccountError::kSigninNotAllowed;
|
||||||
@ -63,7 +63,7 @@ PrimaryAccountMutatorImpl::SetPrimaryAccount(
|
|||||||
|
|
||||||
switch (consent_level) {
|
switch (consent_level) {
|
||||||
case ConsentLevel::kSync:
|
case ConsentLevel::kSync:
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
// TODO(crbug.com/40067025): Replace with NOTREACHED on iOS after all
|
// TODO(crbug.com/40067025): Replace with NOTREACHED on iOS after all
|
||||||
// flows have been migrated away from kSync. See ConsentLevel::kSync
|
// flows have been migrated away from kSync. See ConsentLevel::kSync
|
||||||
// documentation for details.
|
// documentation for details.
|
||||||
@ -72,7 +72,7 @@ PrimaryAccountMutatorImpl::SetPrimaryAccount(
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case ConsentLevel::kSignin:
|
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.
|
// On Chrome OS the UPA can only be set once and never removed or changed.
|
||||||
DCHECK(
|
DCHECK(
|
||||||
!primary_account_manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
!primary_account_manager_->HasPrimaryAccount(ConsentLevel::kSignin));
|
||||||
@ -98,7 +98,7 @@ PrimaryAccountMutatorImpl::SetPrimaryAccount(
|
|||||||
return PrimaryAccountError::kNoError;
|
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
|
// 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
|
// data types if they want. Revoking sync consent can lead to breakages in
|
||||||
// IdentityManager dependencies like `chrome.identity` extension API - that
|
// IdentityManager dependencies like `chrome.identity` extension API - that
|
||||||
@ -130,6 +130,6 @@ bool PrimaryAccountMutatorImpl::RemovePrimaryAccountButKeepTokens(
|
|||||||
primary_account_manager_->RemovePrimaryAccountButKeepTokens(source_metric);
|
primary_account_manager_->RemovePrimaryAccountButKeepTokens(source_metric);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
} // namespace signin
|
} // namespace signin
|
||||||
|
@ -35,16 +35,16 @@ class PrimaryAccountMutatorImpl : public PrimaryAccountMutator {
|
|||||||
ConsentLevel consent_level,
|
ConsentLevel consent_level,
|
||||||
signin_metrics::AccessPoint access_point,
|
signin_metrics::AccessPoint access_point,
|
||||||
base::OnceClosure prefs_committed_callback) override;
|
base::OnceClosure prefs_committed_callback) override;
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
void RevokeSyncConsent(signin_metrics::ProfileSignout source_metric) override;
|
void RevokeSyncConsent(signin_metrics::ProfileSignout source_metric) override;
|
||||||
bool ClearPrimaryAccount(
|
bool ClearPrimaryAccount(
|
||||||
signin_metrics::ProfileSignout source_metric) override;
|
signin_metrics::ProfileSignout source_metric) override;
|
||||||
bool RemovePrimaryAccountButKeepTokens(
|
bool RemovePrimaryAccountButKeepTokens(
|
||||||
signin_metrics::ProfileSignout source_metric) override;
|
signin_metrics::ProfileSignout source_metric) override;
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
// Returns true if transitioning from Sync to Signin consent level is allowed
|
// Returns true if transitioning from Sync to Signin consent level is allowed
|
||||||
// for this platform / configuration.
|
// for this platform / configuration.
|
||||||
bool CanTransitionFromSyncToSigninConsentLevel() const;
|
bool CanTransitionFromSyncToSigninConsentLevel() const;
|
||||||
|
@ -436,7 +436,7 @@ bool ProfileOAuth2TokenService::HasLoadCredentialsFinishedWithNoErrors() {
|
|||||||
|
|
||||||
void ProfileOAuth2TokenService::RecreateDeviceIdIfNeeded() {
|
void ProfileOAuth2TokenService::RecreateDeviceIdIfNeeded() {
|
||||||
// On ChromeOS the device ID is not managed by the token service.
|
// On ChromeOS the device ID is not managed by the token service.
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
if (AreAllCredentialsLoaded() && HasLoadCredentialsFinishedWithNoErrors() &&
|
if (AreAllCredentialsLoaded() && HasLoadCredentialsFinishedWithNoErrors() &&
|
||||||
GetAccounts().empty()) {
|
GetAccounts().empty()) {
|
||||||
signin::RecreateSigninScopedDeviceId(user_prefs_);
|
signin::RecreateSigninScopedDeviceId(user_prefs_);
|
||||||
|
@ -185,8 +185,6 @@ std::unique_ptr<ProfileOAuth2TokenService> BuildProfileOAuth2TokenService(
|
|||||||
#endif // BUILDFLAG(IS_CHROMEOS)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
|
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
|
||||||
bool delete_signin_cookies_on_exit,
|
bool delete_signin_cookies_on_exit,
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
|
||||||
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
|
|
||||||
scoped_refptr<TokenWebData> token_web_data,
|
scoped_refptr<TokenWebData> token_web_data,
|
||||||
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
||||||
unexportable_keys::UnexportableKeyService* unexportable_key_service,
|
unexportable_keys::UnexportableKeyService* unexportable_key_service,
|
||||||
@ -201,7 +199,7 @@ std::unique_ptr<ProfileOAuth2TokenService> BuildProfileOAuth2TokenService(
|
|||||||
#endif
|
#endif
|
||||||
SigninClient* signin_client) {
|
SigninClient* signin_client) {
|
||||||
// On ChromeOS the device ID is not managed by the token service.
|
// 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
|
// 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
|
// device ID is needed on the network thread, but can only be generated on the
|
||||||
// main thread.
|
// main thread.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
namespace signin {
|
namespace signin {
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
std::string GetSigninScopedDeviceId(PrefService* prefs) {
|
std::string GetSigninScopedDeviceId(PrefService* prefs) {
|
||||||
std::string signin_scoped_device_id =
|
std::string signin_scoped_device_id =
|
||||||
|
@ -14,7 +14,7 @@ class PrefService;
|
|||||||
|
|
||||||
namespace signin {
|
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
|
// Returns device id that is scoped to single signin. This device id will be
|
||||||
// regenerated if user signs out and signs back in.
|
// regenerated if user signs out and signs back in.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
namespace signin {
|
namespace signin {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST(DeviceIdHelper, GenerateSigninScopedDeviceId) {
|
TEST(DeviceIdHelper, GenerateSigninScopedDeviceId) {
|
||||||
EXPECT_FALSE(GenerateSigninScopedDeviceId().empty());
|
EXPECT_FALSE(GenerateSigninScopedDeviceId().empty());
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
namespace prefs {
|
namespace prefs {
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// A boolean pref - should unauthenticated user should be logged out
|
// A boolean pref - should unauthenticated user should be logged out
|
||||||
// automatically. Default value is false.
|
// automatically. Default value is false.
|
||||||
const char kForceLogoutUnauthenticatedUserEnabled[] =
|
const char kForceLogoutUnauthenticatedUserEnabled[] =
|
||||||
@ -18,7 +18,7 @@ const char kForceLogoutUnauthenticatedUserEnabled[] =
|
|||||||
// email to gaia id for the the profile. See account_tracker_service.h
|
// email to gaia id for the the profile. See account_tracker_service.h
|
||||||
// for possible values.
|
// for possible values.
|
||||||
const char kAccountIdMigrationState[] = "account_id_migration_state";
|
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
|
// Name of the preference property that persists the account information
|
||||||
// tracked by this signin.
|
// tracked by this signin.
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace prefs {
|
namespace prefs {
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
COMPONENT_EXPORT(SIGNIN_SWITCHES)
|
COMPONENT_EXPORT(SIGNIN_SWITCHES)
|
||||||
extern const char kForceLogoutUnauthenticatedUserEnabled[];
|
extern const char kForceLogoutUnauthenticatedUserEnabled[];
|
||||||
COMPONENT_EXPORT(SIGNIN_SWITCHES)
|
COMPONENT_EXPORT(SIGNIN_SWITCHES)
|
||||||
|
@ -180,14 +180,14 @@ bool IsBatchUploadDesktopEnabled() {
|
|||||||
|
|
||||||
} // namespace switches
|
} // namespace switches
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Enables the generation of pseudo-stable per-user per-device device
|
// Enables the generation of pseudo-stable per-user per-device device
|
||||||
// identifiers. This identifier can be reset by the user by powerwashing the
|
// identifiers. This identifier can be reset by the user by powerwashing the
|
||||||
// device.
|
// device.
|
||||||
BASE_FEATURE(kStableDeviceId,
|
BASE_FEATURE(kStableDeviceId,
|
||||||
"StableDeviceId",
|
"StableDeviceId",
|
||||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// Disables signout for enteprise managed profiles
|
// Disables signout for enteprise managed profiles
|
||||||
BASE_FEATURE(kDisallowManagedProfileSignout,
|
BASE_FEATURE(kDisallowManagedProfileSignout,
|
||||||
|
@ -151,10 +151,10 @@ bool IsBatchUploadDesktopEnabled();
|
|||||||
|
|
||||||
// TODO(crbug.com/337879458): Move switches below into the switches namespace.
|
// TODO(crbug.com/337879458): Move switches below into the switches namespace.
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
COMPONENT_EXPORT(SIGNIN_SWITCHES)
|
COMPONENT_EXPORT(SIGNIN_SWITCHES)
|
||||||
BASE_DECLARE_FEATURE(kStableDeviceId);
|
BASE_DECLARE_FEATURE(kStableDeviceId);
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
COMPONENT_EXPORT(SIGNIN_SWITCHES)
|
COMPONENT_EXPORT(SIGNIN_SWITCHES)
|
||||||
BASE_DECLARE_FEATURE(kDisallowManagedProfileSignout);
|
BASE_DECLARE_FEATURE(kDisallowManagedProfileSignout);
|
||||||
|
@ -125,7 +125,7 @@ bool IsUnconsentedSignedInOAuth2Scopes(const std::string& scope) {
|
|||||||
GaiaConstants::kAidaOAuth2Scope,
|
GaiaConstants::kAidaOAuth2Scope,
|
||||||
|
|
||||||
// Required by ChromeOS only.
|
// Required by ChromeOS only.
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
GaiaConstants::kAssistantOAuth2Scope,
|
GaiaConstants::kAssistantOAuth2Scope,
|
||||||
GaiaConstants::kAuditRecordingOAuth2Scope,
|
GaiaConstants::kAuditRecordingOAuth2Scope,
|
||||||
GaiaConstants::kCastBackdropOAuth2Scope,
|
GaiaConstants::kCastBackdropOAuth2Scope,
|
||||||
@ -141,7 +141,7 @@ bool IsUnconsentedSignedInOAuth2Scopes(const std::string& scope) {
|
|||||||
GaiaConstants::kContactsOAuth2Scope,
|
GaiaConstants::kContactsOAuth2Scope,
|
||||||
GaiaConstants::kPhotosOAuth2Scope,
|
GaiaConstants::kPhotosOAuth2Scope,
|
||||||
GaiaConstants::kTachyonOAuthScope,
|
GaiaConstants::kTachyonOAuthScope,
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
// clang-format on
|
// clang-format on
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ const AccessTokenRestrictionTestParam kTestParams[] = {
|
|||||||
{GaiaConstants::kCloudSearchQueryOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
{GaiaConstants::kCloudSearchQueryOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
||||||
{GaiaConstants::kOAuth1LoginScope, OAuth2ScopeRestriction::kSignedIn},
|
{GaiaConstants::kOAuth1LoginScope, OAuth2ScopeRestriction::kSignedIn},
|
||||||
{GaiaConstants::kCalendarReadOnlyOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
{GaiaConstants::kCalendarReadOnlyOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
{GaiaConstants::kAssistantOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
{GaiaConstants::kAssistantOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
||||||
{GaiaConstants::kAuditRecordingOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
{GaiaConstants::kAuditRecordingOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
||||||
{GaiaConstants::kCastBackdropOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
{GaiaConstants::kCastBackdropOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
||||||
@ -62,7 +62,7 @@ const AccessTokenRestrictionTestParam kTestParams[] = {
|
|||||||
{GaiaConstants::kContactsOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
{GaiaConstants::kContactsOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
||||||
{GaiaConstants::kPhotosOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
{GaiaConstants::kPhotosOAuth2Scope, OAuth2ScopeRestriction::kSignedIn},
|
||||||
{GaiaConstants::kTachyonOAuthScope, OAuth2ScopeRestriction::kSignedIn},
|
{GaiaConstants::kTachyonOAuthScope, OAuth2ScopeRestriction::kSignedIn},
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
{GaiaConstants::kAnyApiOAuth2Scope, OAuth2ScopeRestriction::kPrivilegedOAuth2Consumer},
|
{GaiaConstants::kAnyApiOAuth2Scope, OAuth2ScopeRestriction::kPrivilegedOAuth2Consumer},
|
||||||
{GaiaConstants::kChromeSyncSupervisedOAuth2Scope, OAuth2ScopeRestriction::kExplicitConsent},
|
{GaiaConstants::kChromeSyncSupervisedOAuth2Scope, OAuth2ScopeRestriction::kExplicitConsent},
|
||||||
{GaiaConstants::kKidManagementPrivilegedOAuth2Scope, OAuth2ScopeRestriction::kExplicitConsent},
|
{GaiaConstants::kKidManagementPrivilegedOAuth2Scope, OAuth2ScopeRestriction::kExplicitConsent},
|
||||||
|
@ -84,7 +84,7 @@ class AccountsMutator {
|
|||||||
const CoreAccountId& account_id) = 0;
|
const CoreAccountId& account_id) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Seeds account into AccountTrackerService. Used by UserSessionManager to
|
// Seeds account into AccountTrackerService. Used by UserSessionManager to
|
||||||
// manually seed the primary account before credentials are loaded.
|
// manually seed the primary account before credentials are loaded.
|
||||||
// TODO(crbug.com/40176006): Remove after adding an account cache to
|
// TODO(crbug.com/40176006): Remove after adding an account cache to
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const char kTestEmail[] = "test_user@test.com";
|
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 kTestGaiaId[] = "gaia-id-test_user-test.com";
|
||||||
const char kTestGaiaId2[] = "gaia-id-test_user-2-test.com";
|
const char kTestGaiaId2[] = "gaia-id-test_user-2-test.com";
|
||||||
const char kTestEmail2[] = "test_user@test-2.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);
|
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
|
// Test that a new account gets added to the AccountTrackerService when calling
|
||||||
// AddOrUpdateAccount() and that a new refresh token becomes available for the
|
// AddOrUpdateAccount() and that a new refresh token becomes available for the
|
||||||
// passed account_id when adding an account for the first time.
|
// passed account_id when adding an account for the first time.
|
||||||
@ -617,7 +617,7 @@ TEST_F(AccountsMutatorTest, RemoveRefreshTokenFromSource) {
|
|||||||
EXPECT_EQ("Settings::Signout",
|
EXPECT_EQ("Settings::Signout",
|
||||||
identity_manager_diagnostics_observer()->token_remover_source());
|
identity_manager_diagnostics_observer()->token_remover_source());
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
|
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
|
||||||
TEST_F(AccountsMutatorTest, MoveAccount) {
|
TEST_F(AccountsMutatorTest, MoveAccount) {
|
||||||
|
@ -559,7 +559,7 @@ class IdentityManager : public KeyedService,
|
|||||||
#if BUILDFLAG(IS_CHROMEOS)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
friend account_manager::AccountManagerFacade* GetAccountManagerFacade(
|
friend account_manager::AccountManagerFacade* GetAccountManagerFacade(
|
||||||
IdentityManager* identity_manager);
|
IdentityManager* identity_manager);
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// Temporary access to getters (e.g. GetTokenService()).
|
// Temporary access to getters (e.g. GetTokenService()).
|
||||||
// TODO(crbug.com/40619310): Remove this friendship by
|
// TODO(crbug.com/40619310): Remove this friendship by
|
||||||
|
@ -119,8 +119,6 @@ IdentityManager::InitParameters BuildIdentityManagerInitParameters(
|
|||||||
#endif // BUILDFLAG(IS_CHROMEOS)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
|
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
|
||||||
params->delete_signin_cookies_on_exit,
|
params->delete_signin_cookies_on_exit,
|
||||||
#endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
|
|
||||||
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
|
|
||||||
params->token_web_data,
|
params->token_web_data,
|
||||||
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
|
||||||
params->unexportable_key_service,
|
params->unexportable_key_service,
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
#include "components/signin/internal/identity_manager/child_account_info_fetcher_android.h"
|
#include "components/signin/internal/identity_manager/child_account_info_fetcher_android.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
#include "chromeos/ash/components/account_manager/account_manager_factory.h"
|
#include "chromeos/ash/components/account_manager/account_manager_factory.h"
|
||||||
#include "components/account_manager_core/account.h"
|
#include "components/account_manager_core/account.h"
|
||||||
#include "components/account_manager_core/account_manager_facade_impl.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 kTestLocale = "locale";
|
||||||
const std::string kTestPictureUrl = "http://picture.example.com/picture.jpg";
|
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";
|
const std::string kTestEmailWithPeriod = "m.e@gmail.com";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ class IdentityManagerTest : public testing::Test {
|
|||||||
account_tracker_service->Initialize(&pref_service_,
|
account_tracker_service->Initialize(&pref_service_,
|
||||||
temp_profile_dir_.GetPath());
|
temp_profile_dir_.GetPath());
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
account_manager::AccountManager::RegisterPrefs(pref_service_.registry());
|
account_manager::AccountManager::RegisterPrefs(pref_service_.registry());
|
||||||
auto* ash_account_manager = GetAccountManagerFactory()->GetAccountManager(
|
auto* ash_account_manager = GetAccountManagerFactory()->GetAccountManager(
|
||||||
temp_profile_dir_.GetPath().value());
|
temp_profile_dir_.GetPath().value());
|
||||||
@ -452,7 +452,7 @@ class IdentityManagerTest : public testing::Test {
|
|||||||
token_service.get(), account_tracker_service.get(),
|
token_service.get(), account_tracker_service.get(),
|
||||||
primary_account_manager.get(), &pref_service_);
|
primary_account_manager.get(), &pref_service_);
|
||||||
#endif
|
#endif
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
init_params.account_manager_facade = account_manager_facade_.get();
|
init_params.account_manager_facade = account_manager_facade_.get();
|
||||||
#endif
|
#endif
|
||||||
init_params.signin_client = &signin_client_;
|
init_params.signin_client = &signin_client_;
|
||||||
@ -502,7 +502,7 @@ class IdentityManagerTest : public testing::Test {
|
|||||||
return &test_url_loader_factory_;
|
return &test_url_loader_factory_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ash::AccountManagerFactory* GetAccountManagerFactory() {
|
ash::AccountManagerFactory* GetAccountManagerFactory() {
|
||||||
return &account_manager_factory_;
|
return &account_manager_factory_;
|
||||||
}
|
}
|
||||||
@ -511,7 +511,7 @@ class IdentityManagerTest : public testing::Test {
|
|||||||
private:
|
private:
|
||||||
base::ScopedTempDir temp_profile_dir_;
|
base::ScopedTempDir temp_profile_dir_;
|
||||||
base::test::TaskEnvironment task_environment_;
|
base::test::TaskEnvironment task_environment_;
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ash::AccountManagerFactory account_manager_factory_;
|
ash::AccountManagerFactory account_manager_factory_;
|
||||||
std::unique_ptr<account_manager::AccountManagerFacadeImpl>
|
std::unique_ptr<account_manager::AccountManagerFacadeImpl>
|
||||||
account_manager_facade_;
|
account_manager_facade_;
|
||||||
@ -543,7 +543,7 @@ TEST_F(IdentityManagerTest, Construct) {
|
|||||||
EXPECT_NE(identity_manager()->GetAccountsMutator(), nullptr);
|
EXPECT_NE(identity_manager()->GetAccountsMutator(), nullptr);
|
||||||
EXPECT_EQ(identity_manager()->GetDeviceAccountsSynchronizer(), nullptr);
|
EXPECT_EQ(identity_manager()->GetDeviceAccountsSynchronizer(), nullptr);
|
||||||
#endif
|
#endif
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
EXPECT_NE(identity_manager()->GetAccountManagerFacade(), nullptr);
|
EXPECT_NE(identity_manager()->GetAccountManagerFacade(), nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -564,7 +564,7 @@ TEST_F(IdentityManagerTest, PrimaryAccountInfoAtStartup) {
|
|||||||
|
|
||||||
// Signin/signout tests aren't relevant and cannot build on ChromeOS, which
|
// Signin/signout tests aren't relevant and cannot build on ChromeOS, which
|
||||||
// doesn't support signin/signout.
|
// 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
|
// Test that the user signing in results in firing of the IdentityManager
|
||||||
// observer callback and the IdentityManager's state being updated.
|
// observer callback and the IdentityManager's state being updated.
|
||||||
TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSignin) {
|
TEST_F(IdentityManagerTest, PrimaryAccountInfoAfterSignin) {
|
||||||
@ -674,7 +674,7 @@ TEST_F(IdentityManagerTest,
|
|||||||
EXPECT_EQ(primary_account_id,
|
EXPECT_EQ(primary_account_id,
|
||||||
identity_manager()->GetPrimaryAccountId(ConsentLevel::kSignin));
|
identity_manager()->GetPrimaryAccountId(ConsentLevel::kSignin));
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(IdentityManagerTest, HasPrimaryAccount) {
|
TEST_F(IdentityManagerTest, HasPrimaryAccount) {
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
@ -689,7 +689,7 @@ TEST_F(IdentityManagerTest, HasPrimaryAccount) {
|
|||||||
identity_manager()->HasPrimaryAccount(signin::ConsentLevel::kSync));
|
identity_manager()->HasPrimaryAccount(signin::ConsentLevel::kSync));
|
||||||
EXPECT_TRUE(identity_manager()->HasPrimaryAccount(ConsentLevel::kSignin));
|
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
|
// Signing out should cause IdentityManager to recognize that there is no
|
||||||
// longer a primary account.
|
// longer a primary account.
|
||||||
ClearPrimaryAccount(identity_manager());
|
ClearPrimaryAccount(identity_manager());
|
||||||
@ -1534,7 +1534,7 @@ TEST_F(IdentityManagerTest, GetAccountsCookieMutator) {
|
|||||||
EXPECT_TRUE(mutator);
|
EXPECT_TRUE(mutator);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// On ChromeOS, AccountTrackerService first receives the normalized email
|
// On ChromeOS, AccountTrackerService first receives the normalized email
|
||||||
// address from GAIA and then later has it updated with the user's
|
// 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
|
// originally-specified version of their email address (at the time of that
|
||||||
@ -1637,7 +1637,7 @@ TEST_F(IdentityManagerTest, CallbackSentOnSecondaryAccountRefreshTokenRemoval) {
|
|||||||
identity_manager_observer()->AccountIdFromRefreshTokenRemovedCallback());
|
identity_manager_observer()->AccountIdFromRefreshTokenRemovedCallback());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(
|
TEST_F(
|
||||||
IdentityManagerTest,
|
IdentityManagerTest,
|
||||||
CallbackSentOnSecondaryAccountRefreshTokenUpdateWithValidTokenWhenNoPrimaryAccount) {
|
CallbackSentOnSecondaryAccountRefreshTokenUpdateWithValidTokenWhenNoPrimaryAccount) {
|
||||||
@ -2308,7 +2308,7 @@ TEST_F(IdentityManagerTest, FindExtendedPrimaryAccountInfo) {
|
|||||||
EXPECT_EQ(core_info.email, extended_info.email);
|
EXPECT_EQ(core_info.email, extended_info.email);
|
||||||
EXPECT_EQ(core_info.gaia, extended_info.gaia);
|
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.
|
// It's not possible to sign out on Ash.
|
||||||
ClearPrimaryAccount(identity_manager());
|
ClearPrimaryAccount(identity_manager());
|
||||||
SetRefreshTokenForAccount(identity_manager(), core_info.account_id, "token");
|
SetRefreshTokenForAccount(identity_manager(), core_info.account_id, "token");
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "services/network/test/test_url_loader_factory.h"
|
#include "services/network/test/test_url_loader_factory.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.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 "chromeos/ash/components/account_manager/account_manager_factory.h"
|
||||||
#include "components/account_manager_core/account_manager_facade_impl.h"
|
#include "components/account_manager_core/account_manager_facade_impl.h"
|
||||||
#include "components/account_manager_core/chromeos/account_manager.h"
|
#include "components/account_manager_core/chromeos/account_manager.h"
|
||||||
@ -79,14 +79,14 @@ class IdentityManagerDependenciesOwner {
|
|||||||
~IdentityManagerDependenciesOwner();
|
~IdentityManagerDependenciesOwner();
|
||||||
|
|
||||||
sync_preferences::TestingPrefServiceSyncable* pref_service();
|
sync_preferences::TestingPrefServiceSyncable* pref_service();
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ash::AccountManagerFactory* account_manager_factory();
|
ash::AccountManagerFactory* account_manager_factory();
|
||||||
account_manager::AccountManagerFacade* GetAccountManagerFacadeForEmptyPath();
|
account_manager::AccountManagerFacade* GetAccountManagerFacadeForEmptyPath();
|
||||||
#endif
|
#endif
|
||||||
TestSigninClient* signin_client();
|
TestSigninClient* signin_client();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
std::unique_ptr<ash::AccountManagerFactory> account_manager_factory_;
|
std::unique_ptr<ash::AccountManagerFactory> account_manager_factory_;
|
||||||
std::unique_ptr<account_manager::AccountManagerFacadeImpl>
|
std::unique_ptr<account_manager::AccountManagerFacadeImpl>
|
||||||
account_manager_facade_for_empty_path_;
|
account_manager_facade_for_empty_path_;
|
||||||
@ -105,7 +105,7 @@ IdentityManagerDependenciesOwner::IdentityManagerDependenciesOwner(
|
|||||||
sync_preferences::TestingPrefServiceSyncable* pref_service_param,
|
sync_preferences::TestingPrefServiceSyncable* pref_service_param,
|
||||||
TestSigninClient* signin_client_param)
|
TestSigninClient* signin_client_param)
|
||||||
:
|
:
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
account_manager_factory_(std::make_unique<ash::AccountManagerFactory>()),
|
account_manager_factory_(std::make_unique<ash::AccountManagerFactory>()),
|
||||||
#endif
|
#endif
|
||||||
owned_pref_service_(
|
owned_pref_service_(
|
||||||
@ -119,7 +119,7 @@ IdentityManagerDependenciesOwner::IdentityManagerDependenciesOwner(
|
|||||||
? nullptr
|
? nullptr
|
||||||
: std::make_unique<TestSigninClient>(pref_service())),
|
: std::make_unique<TestSigninClient>(pref_service())),
|
||||||
raw_signin_client_(signin_client_param) {
|
raw_signin_client_(signin_client_param) {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
mojo::Remote<crosapi::mojom::AccountManager> remote;
|
mojo::Remote<crosapi::mojom::AccountManager> remote;
|
||||||
crosapi::AccountManagerMojoService* account_manager_mojo_service =
|
crosapi::AccountManagerMojoService* account_manager_mojo_service =
|
||||||
account_manager_factory_->GetAccountManagerMojoService(std::string());
|
account_manager_factory_->GetAccountManagerMojoService(std::string());
|
||||||
@ -149,7 +149,7 @@ IdentityManagerDependenciesOwner::pref_service() {
|
|||||||
: owned_pref_service_.get();
|
: owned_pref_service_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ash::AccountManagerFactory*
|
ash::AccountManagerFactory*
|
||||||
IdentityManagerDependenciesOwner::account_manager_factory() {
|
IdentityManagerDependenciesOwner::account_manager_factory() {
|
||||||
DCHECK(account_manager_factory_);
|
DCHECK(account_manager_factory_);
|
||||||
@ -224,7 +224,7 @@ IdentityTestEnvironment::IdentityTestEnvironment(
|
|||||||
IdentityManager::RegisterProfilePrefs(test_pref_service->registry());
|
IdentityManager::RegisterProfilePrefs(test_pref_service->registry());
|
||||||
SigninPrefs::RegisterProfilePrefs(test_pref_service->registry());
|
SigninPrefs::RegisterProfilePrefs(test_pref_service->registry());
|
||||||
IdentityManager::RegisterLocalStatePrefs(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());
|
account_manager::AccountManager::RegisterPrefs(test_pref_service->registry());
|
||||||
|
|
||||||
owned_identity_manager_ = BuildIdentityManagerForTests(
|
owned_identity_manager_ = BuildIdentityManagerForTests(
|
||||||
@ -234,12 +234,12 @@ IdentityTestEnvironment::IdentityTestEnvironment(
|
|||||||
#else
|
#else
|
||||||
owned_identity_manager_ = BuildIdentityManagerForTests(
|
owned_identity_manager_ = BuildIdentityManagerForTests(
|
||||||
test_signin_client, test_pref_service, base::FilePath());
|
test_signin_client, test_pref_service, base::FilePath());
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// static
|
// static
|
||||||
std::unique_ptr<IdentityManager>
|
std::unique_ptr<IdentityManager>
|
||||||
IdentityTestEnvironment::BuildIdentityManagerForTests(
|
IdentityTestEnvironment::BuildIdentityManagerForTests(
|
||||||
@ -303,7 +303,7 @@ IdentityTestEnvironment::BuildIdentityManagerForTests(
|
|||||||
std::move(account_tracker_service), std::move(token_service),
|
std::move(account_tracker_service), std::move(token_service),
|
||||||
signin_client, pref_service, user_data_dir);
|
signin_client, pref_service, user_data_dir);
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
IdentityTestEnvironment::PendingRequest::PendingRequest(
|
IdentityTestEnvironment::PendingRequest::PendingRequest(
|
||||||
CoreAccountId account_id,
|
CoreAccountId account_id,
|
||||||
@ -328,7 +328,7 @@ IdentityTestEnvironment::FinishBuildIdentityManagerForTests(
|
|||||||
SigninClient* signin_client,
|
SigninClient* signin_client,
|
||||||
PrefService* pref_service,
|
PrefService* pref_service,
|
||||||
base::FilePath user_data_dir
|
base::FilePath user_data_dir
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
,
|
,
|
||||||
account_manager::AccountManagerFacade* account_manager_facade
|
account_manager::AccountManagerFacade* account_manager_facade
|
||||||
#endif
|
#endif
|
||||||
@ -380,7 +380,7 @@ IdentityTestEnvironment::FinishBuildIdentityManagerForTests(
|
|||||||
init_params.token_service = std::move(token_service);
|
init_params.token_service = std::move(token_service);
|
||||||
// TODO: Set the account_manager_facade on Lacros once Mirror is enabled by
|
// TODO: Set the account_manager_facade on Lacros once Mirror is enabled by
|
||||||
// default.
|
// default.
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
init_params.account_manager_facade = account_manager_facade;
|
init_params.account_manager_facade = account_manager_facade;
|
||||||
#endif
|
#endif
|
||||||
init_params.signin_client = signin_client;
|
init_params.signin_client = signin_client;
|
||||||
@ -448,11 +448,11 @@ AccountInfo IdentityTestEnvironment::MakePrimaryAccountAvailable(
|
|||||||
consent_level);
|
consent_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
void IdentityTestEnvironment::RevokeSyncConsent() {
|
void IdentityTestEnvironment::RevokeSyncConsent() {
|
||||||
signin::RevokeSyncConsent(identity_manager());
|
signin::RevokeSyncConsent(identity_manager());
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
void IdentityTestEnvironment::ClearPrimaryAccount() {
|
void IdentityTestEnvironment::ClearPrimaryAccount() {
|
||||||
signin::ClearPrimaryAccount(identity_manager());
|
signin::ClearPrimaryAccount(identity_manager());
|
||||||
|
@ -30,7 +30,7 @@ class IdentityTestEnvironmentProfileAdaptor;
|
|||||||
class PrefService;
|
class PrefService;
|
||||||
class TestSigninClient;
|
class TestSigninClient;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
namespace account_manager {
|
namespace account_manager {
|
||||||
class AccountManagerFacade;
|
class AccountManagerFacade;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ class AccountManagerFacade;
|
|||||||
namespace ash {
|
namespace ash {
|
||||||
class AccountManagerFactory;
|
class AccountManagerFactory;
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
namespace sync_preferences {
|
namespace sync_preferences {
|
||||||
class TestingPrefServiceSyncable;
|
class TestingPrefServiceSyncable;
|
||||||
@ -179,11 +179,11 @@ class IdentityTestEnvironment : public IdentityManager::DiagnosticsObserver,
|
|||||||
AccountInfo MakePrimaryAccountAvailable(const std::string& email,
|
AccountInfo MakePrimaryAccountAvailable(const std::string& email,
|
||||||
ConsentLevel consent_level);
|
ConsentLevel consent_level);
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
// Revokes sync consent from the primary account: the primary account is left
|
// Revokes sync consent from the primary account: the primary account is left
|
||||||
// at ConsentLevel::kSignin.
|
// at ConsentLevel::kSignin.
|
||||||
void RevokeSyncConsent();
|
void RevokeSyncConsent();
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// Clears the primary account, removes all accounts and revokes the sync
|
// Clears the primary account, removes all accounts and revokes the sync
|
||||||
// consent. Blocks until the primary account is cleared.
|
// consent. Blocks until the primary account is cleared.
|
||||||
@ -419,7 +419,7 @@ class IdentityTestEnvironment : public IdentityManager::DiagnosticsObserver,
|
|||||||
SigninClient* signin_client,
|
SigninClient* signin_client,
|
||||||
PrefService* pref_service,
|
PrefService* pref_service,
|
||||||
base::FilePath user_data_dir
|
base::FilePath user_data_dir
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
,
|
,
|
||||||
ash::AccountManagerFactory* account_manager_factory,
|
ash::AccountManagerFactory* account_manager_factory,
|
||||||
account_manager::AccountManagerFacade* account_manager_facade
|
account_manager::AccountManagerFacade* account_manager_facade
|
||||||
@ -432,7 +432,7 @@ class IdentityTestEnvironment : public IdentityManager::DiagnosticsObserver,
|
|||||||
SigninClient* signin_client,
|
SigninClient* signin_client,
|
||||||
PrefService* pref_service,
|
PrefService* pref_service,
|
||||||
base::FilePath user_data_dir
|
base::FilePath user_data_dir
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
,
|
,
|
||||||
account_manager::AccountManagerFacade* account_manager_facade
|
account_manager::AccountManagerFacade* account_manager_facade
|
||||||
#endif
|
#endif
|
||||||
|
@ -328,7 +328,7 @@ AccountInfo MakePrimaryAccountAvailable(IdentityManager* identity_manager,
|
|||||||
return primary_account_info;
|
return primary_account_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
// TODO(crbug.com/40067058): remove this function once `ConsentLevel::kSync` is
|
// TODO(crbug.com/40067058): remove this function once `ConsentLevel::kSync` is
|
||||||
// removed.
|
// removed.
|
||||||
void RevokeSyncConsent(IdentityManager* identity_manager) {
|
void RevokeSyncConsent(IdentityManager* identity_manager) {
|
||||||
@ -350,10 +350,10 @@ void RevokeSyncConsent(IdentityManager* identity_manager) {
|
|||||||
signin_metrics::ProfileSignout::kTest);
|
signin_metrics::ProfileSignout::kTest);
|
||||||
run_loop.Run();
|
run_loop.Run();
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
void ClearPrimaryAccount(IdentityManager* identity_manager) {
|
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
|
// TODO(blundell): If we ever need this functionality on ChromeOS (which seems
|
||||||
// unlikely), plumb this through to just clear the primary account info
|
// unlikely), plumb this through to just clear the primary account info
|
||||||
// synchronously with IdentityManager.
|
// synchronously with IdentityManager.
|
||||||
|
@ -115,7 +115,7 @@ AccountInfo MakePrimaryAccountAvailable(IdentityManager* identity_manager,
|
|||||||
const std::string& email,
|
const std::string& email,
|
||||||
ConsentLevel consent_level);
|
ConsentLevel consent_level);
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
// Revokes sync consent from the primary account: the primary account is left
|
// Revokes sync consent from the primary account: the primary account is left
|
||||||
// at ConsentLevel::kSignin.
|
// at ConsentLevel::kSignin.
|
||||||
// NOTE: See disclaimer at top of file re: direct usage.
|
// 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
|
// TODO(crbug.com/40067058): remove this function once `ConsentLevel::kSync` is
|
||||||
// removed.
|
// removed.
|
||||||
void RevokeSyncConsent(IdentityManager* identity_manager);
|
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
|
// Clears the primary account, removes all accounts and revokes the sync
|
||||||
// consent (if applicable). Blocks until the primary account is cleared.
|
// consent (if applicable). Blocks until the primary account is cleared.
|
||||||
|
@ -454,7 +454,7 @@ TEST_P(PrimaryAccountAccessTokenFetcherTest, IdentityManagerShutdownNoAccount) {
|
|||||||
ShutdownIdentityManager();
|
ShutdownIdentityManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_P(PrimaryAccountAccessTokenFetcherTest,
|
TEST_P(PrimaryAccountAccessTokenFetcherTest,
|
||||||
ShouldNotRetryCanceledAccessTokenRequestIfSignedOut) {
|
ShouldNotRetryCanceledAccessTokenRequestIfSignedOut) {
|
||||||
@ -531,7 +531,7 @@ INSTANTIATE_TEST_SUITE_P(All,
|
|||||||
testing::Values(ConsentLevel::kSignin,
|
testing::Values(ConsentLevel::kSignin,
|
||||||
ConsentLevel::kSync));
|
ConsentLevel::kSync));
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Chrome OS can directly set the unconsented primary account during login,
|
// Chrome OS can directly set the unconsented primary account during login,
|
||||||
// so it has additional tests.
|
// so it has additional tests.
|
||||||
TEST_F(PrimaryAccountAccessTokenFetcherTest,
|
TEST_F(PrimaryAccountAccessTokenFetcherTest,
|
||||||
@ -595,6 +595,6 @@ TEST_F(PrimaryAccountAccessTokenFetcherTest,
|
|||||||
access_token_info().token, access_token_info().expiration_time,
|
access_token_info().token, access_token_info().expiration_time,
|
||||||
access_token_info().id_token);
|
access_token_info().id_token);
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
} // namespace signin
|
} // namespace signin
|
||||||
|
@ -92,7 +92,7 @@ class PrimaryAccountMutator {
|
|||||||
signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN,
|
signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN,
|
||||||
base::OnceClosure prefs_committed_callback = base::NullCallback()) = 0;
|
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
|
// Revokes sync consent from the primary account: the primary account is left
|
||||||
// at ConsentLevel::kSignin.
|
// at ConsentLevel::kSignin.
|
||||||
//
|
//
|
||||||
@ -111,7 +111,7 @@ class PrimaryAccountMutator {
|
|||||||
// was successful and false if there was no primary account set.
|
// was successful and false if there was no primary account set.
|
||||||
virtual bool RemovePrimaryAccountButKeepTokens(
|
virtual bool RemovePrimaryAccountButKeepTokens(
|
||||||
signin_metrics::ProfileSignout source_metric) = 0;
|
signin_metrics::ProfileSignout source_metric) = 0;
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace signin
|
} // namespace signin
|
||||||
|
@ -31,7 +31,7 @@ namespace {
|
|||||||
|
|
||||||
// Constants used by the different tests.
|
// Constants used by the different tests.
|
||||||
const char kPrimaryAccountEmail[] = "primary.account@example.com";
|
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 kAnotherAccountEmail[] = "another.account@example.com";
|
||||||
const char kUnknownAccountId[] = "{unknown account id}";
|
const char kUnknownAccountId[] = "{unknown account id}";
|
||||||
#endif
|
#endif
|
||||||
@ -100,7 +100,7 @@ class ClearPrimaryAccountTestObserver
|
|||||||
scoped_observation_{this};
|
scoped_observation_{this};
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
// Helper for testing of RevokeSyncConsent/ClearPrimaryAccount(). This function
|
// Helper for testing of RevokeSyncConsent/ClearPrimaryAccount(). This function
|
||||||
// requires lots of tests due to having different behaviors based on its
|
// 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
|
// 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));
|
secondary_account_info.account_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_Sync) {
|
|||||||
// ChromeOS, where those preconditions do not exist.
|
// ChromeOS, where those preconditions do not exist.
|
||||||
// TODO(crbug.com/41470280): Run these tests on ChromeOS if/once we
|
// TODO(crbug.com/41470280): Run these tests on ChromeOS if/once we
|
||||||
// enable those preconditions on that platform
|
// 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
|
// Checks that setting the primary account fails if the account is not known by
|
||||||
// the identity system.
|
// the identity system.
|
||||||
TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_NoAccount) {
|
TEST_F(PrimaryAccountMutatorTest, SetPrimaryAccount_NoAccount) {
|
||||||
@ -657,4 +657,4 @@ TEST_F(PrimaryAccountMutatorTest, RevokeSyncConsent) {
|
|||||||
TEST_F(PrimaryAccountMutatorTest, ClearPrimaryAccount_SigninOnly) {
|
TEST_F(PrimaryAccountMutatorTest, ClearPrimaryAccount_SigninOnly) {
|
||||||
RunClearPrimaryAccountTestForSigninOnly();
|
RunClearPrimaryAccountTestForSigninOnly();
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
@ -23,7 +23,7 @@ namespace signin {
|
|||||||
const char kPlatform[] = "win";
|
const char kPlatform[] = "win";
|
||||||
#elif BUILDFLAG(IS_MAC)
|
#elif BUILDFLAG(IS_MAC)
|
||||||
const char kPlatform[] = "mac";
|
const char kPlatform[] = "mac";
|
||||||
#elif BUILDFLAG(IS_CHROMEOS_ASH)
|
#elif BUILDFLAG(IS_CHROMEOS)
|
||||||
const char kPlatform[] = "chromeos";
|
const char kPlatform[] = "chromeos";
|
||||||
#elif BUILDFLAG(IS_LINUX)
|
#elif BUILDFLAG(IS_LINUX)
|
||||||
const char kPlatform[] = "linux";
|
const char kPlatform[] = "linux";
|
||||||
|
@ -95,15 +95,15 @@ TEST_F(SyncAuthManagerTest, IgnoresEventsIfNotRegistered) {
|
|||||||
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
|
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
|
||||||
|
|
||||||
// ChromeOS doesn't support sign-out.
|
// ChromeOS doesn't support sign-out.
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
identity_env()->ClearPrimaryAccount();
|
identity_env()->ClearPrimaryAccount();
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
|
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChromeOS doesn't support sign-out.
|
// ChromeOS doesn't support sign-out.
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncAuthManagerTest, ForwardsPrimaryAccountEvents) {
|
TEST_F(SyncAuthManagerTest, ForwardsPrimaryAccountEvents) {
|
||||||
// Start out already signed in before the SyncAuthManager is created.
|
// Start out already signed in before the SyncAuthManager is created.
|
||||||
CoreAccountId account_id =
|
CoreAccountId account_id =
|
||||||
@ -181,10 +181,10 @@ TEST_F(SyncAuthManagerTest, NotifiesOfSignoutBeforeAccessTokenIsGone) {
|
|||||||
ASSERT_TRUE(
|
ASSERT_TRUE(
|
||||||
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
|
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.
|
// 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) {
|
TEST_F(SyncAuthManagerTest, ForwardsUnconsentedAccountEvents) {
|
||||||
base::MockCallback<AccountStateChangedCallback> account_state_changed;
|
base::MockCallback<AccountStateChangedCallback> account_state_changed;
|
||||||
base::MockCallback<CredentialsChangedCallback> credentials_changed;
|
base::MockCallback<CredentialsChangedCallback> credentials_changed;
|
||||||
@ -215,11 +215,11 @@ TEST_F(SyncAuthManagerTest, ForwardsUnconsentedAccountEvents) {
|
|||||||
|
|
||||||
EXPECT_TRUE(auth_manager->GetActiveAccountInfo().is_sync_consented);
|
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)
|
// !BUILDFLAG(IS_IOS)
|
||||||
|
|
||||||
// ChromeOS doesn't support sign-out.
|
// ChromeOS doesn't support sign-out.
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncAuthManagerTest, ClearsAuthErrorOnSignoutWithRefreshTokenRemoval) {
|
TEST_F(SyncAuthManagerTest, ClearsAuthErrorOnSignoutWithRefreshTokenRemoval) {
|
||||||
// Start out already signed in before the SyncAuthManager is created.
|
// Start out already signed in before the SyncAuthManager is created.
|
||||||
CoreAccountId account_id =
|
CoreAccountId account_id =
|
||||||
@ -284,7 +284,7 @@ TEST_F(SyncAuthManagerTest,
|
|||||||
EXPECT_EQ(auth_manager->GetLastAuthError().state(),
|
EXPECT_EQ(auth_manager->GetLastAuthError().state(),
|
||||||
GoogleServiceAuthError::NONE);
|
GoogleServiceAuthError::NONE);
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(SyncAuthManagerTest, DoesNotClearAuthErrorOnSyncDisable) {
|
TEST_F(SyncAuthManagerTest, DoesNotClearAuthErrorOnSyncDisable) {
|
||||||
// Start out already signed in before the SyncAuthManager is created.
|
// 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)
|
#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.
|
// 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
|
// On CrOS the unconsented primary account can't be changed or removed, but can
|
||||||
// be granted sync consent.
|
// be granted sync consent.
|
||||||
@ -939,7 +939,7 @@ TEST_F(SyncAuthManagerTest,
|
|||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
auth_manager->GetActiveAccountInfo().account_info.account_id.empty());
|
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)
|
// !BUILDFLAG(IS_IOS)
|
||||||
|
|
||||||
TEST_F(SyncAuthManagerTest, DetectsInvalidRefreshTokenAtStartup) {
|
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,
|
// Check for OS types. This includes types that used to be browser types,
|
||||||
// like "apps" and "preferences".
|
// like "apps" and "preferences".
|
||||||
std::optional<UserSelectableOsType> os_type =
|
std::optional<UserSelectableOsType> os_type =
|
||||||
@ -42,7 +42,7 @@ void DisableSyncType(const std::string& type_name, PrefValueMap* prefs) {
|
|||||||
if (os_type.has_value()) {
|
if (os_type.has_value()) {
|
||||||
syncer::SyncPrefs::SetOsTypeDisabledByPolicy(prefs, *os_type);
|
syncer::SyncPrefs::SetOsTypeDisabledByPolicy(prefs, *os_type);
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -230,7 +230,7 @@ TEST(SyncPolicyHandlerTest, SyncTypesListDisabledUnknownEntry) {
|
|||||||
EXPECT_TRUE(enabled);
|
EXPECT_TRUE(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST(SyncPolicyHandlerOsTest, SyncTypesListDisabled_OsTypes) {
|
TEST(SyncPolicyHandlerOsTest, SyncTypesListDisabled_OsTypes) {
|
||||||
// Start with prefs enabled so we can sense that they have changed.
|
// 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));
|
ASSERT_TRUE(prefs.GetBoolean(prefs::internal::kSyncOsPreferences, &enabled));
|
||||||
EXPECT_FALSE(enabled);
|
EXPECT_FALSE(enabled);
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace syncer
|
} // namespace syncer
|
||||||
|
@ -36,9 +36,9 @@ bool SyncService::IsSyncFeatureEnabled() const {
|
|||||||
|
|
||||||
bool SyncService::CanSyncFeatureStart() const {
|
bool SyncService::CanSyncFeatureStart() const {
|
||||||
return GetDisableReasons().empty() &&
|
return GetDisableReasons().empty() &&
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
!GetUserSettings()->IsSyncFeatureDisabledViaDashboard() &&
|
!GetUserSettings()->IsSyncFeatureDisabledViaDashboard() &&
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
HasSyncConsent();
|
HasSyncConsent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,14 +373,14 @@ void SyncServiceImpl::Initialize(DataTypeController::TypeVector controllers) {
|
|||||||
// crash during signout).
|
// crash during signout).
|
||||||
if (HasDisableReason(DISABLE_REASON_ENTERPRISE_POLICY)) {
|
if (HasDisableReason(DISABLE_REASON_ENTERPRISE_POLICY)) {
|
||||||
StopAndClear(ResetEngineReason::kEnterprisePolicy);
|
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
|
// On ChromeOS Ash, sync-the-feature stays disabled even after the policy is
|
||||||
// removed, for historic reasons. It is unclear if this behavior is
|
// removed, for historic reasons. It is unclear if this behavior is
|
||||||
// optional, because it is indistinguishable from the
|
// optional, because it is indistinguishable from the
|
||||||
// sync-reset-via-dashboard case. It can be resolved by invoking
|
// sync-reset-via-dashboard case. It can be resolved by invoking
|
||||||
// SetSyncFeatureRequested().
|
// SetSyncFeatureRequested().
|
||||||
sync_prefs_.SetSyncFeatureDisabledViaDashboard();
|
sync_prefs_.SetSyncFeatureDisabledViaDashboard();
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
} else if (HasDisableReason(DISABLE_REASON_NOT_SIGNED_IN)) {
|
} else if (HasDisableReason(DISABLE_REASON_NOT_SIGNED_IN)) {
|
||||||
// On ChromeOS-Ash, signout is not possible, so it's not necessary to handle
|
// On ChromeOS-Ash, signout is not possible, so it's not necessary to handle
|
||||||
// this case.
|
// this case.
|
||||||
@ -388,18 +388,18 @@ void SyncServiceImpl::Initialize(DataTypeController::TypeVector controllers) {
|
|||||||
// ChromeOS-Ash since it's supposedly unreachable, *but* during the very
|
// 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
|
// first startup of a fresh profile, the signed-in account isn't known yet
|
||||||
// at this point (see also https://crbug.com/1458701#c7).
|
// at this point (see also https://crbug.com/1458701#c7).
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
StopAndClear(ResetEngineReason::kNotSignedIn);
|
StopAndClear(ResetEngineReason::kNotSignedIn);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool is_sync_feature_requested_for_metrics =
|
const bool is_sync_feature_requested_for_metrics =
|
||||||
IsLocalSyncEnabled() ||
|
IsLocalSyncEnabled() ||
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
!user_settings_->IsSyncFeatureDisabledViaDashboard();
|
!user_settings_->IsSyncFeatureDisabledViaDashboard();
|
||||||
#else
|
#else
|
||||||
HasSyncConsent();
|
HasSyncConsent();
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// Note: We need to record the initial state *after* calling
|
// Note: We need to record the initial state *after* calling
|
||||||
// RegisterForAuthNotifications(), because before that the authenticated
|
// RegisterForAuthNotifications(), because before that the authenticated
|
||||||
@ -832,9 +832,9 @@ base::android::ScopedJavaLocalRef<jobject> SyncServiceImpl::GetJavaObject() {
|
|||||||
void SyncServiceImpl::SetSyncFeatureRequested() {
|
void SyncServiceImpl::SetSyncFeatureRequested() {
|
||||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
user_settings_->ClearSyncFeatureDisabledViaDashboard();
|
user_settings_->ClearSyncFeatureDisabledViaDashboard();
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// If the Sync engine was already initialized (probably running in transport
|
// If the Sync engine was already initialized (probably running in transport
|
||||||
// mode), just reconfigure.
|
// mode), just reconfigure.
|
||||||
@ -1180,14 +1180,14 @@ void SyncServiceImpl::OnActionableProtocolError(
|
|||||||
// should be okay.
|
// should be okay.
|
||||||
StopAndClear(ResetEngineReason::kDisableSyncOnClient);
|
StopAndClear(ResetEngineReason::kDisableSyncOnClient);
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// On Ash, the primary account is always set and sync the feature
|
// On Ash, the primary account is always set and sync the feature
|
||||||
// turned on, so a dedicated bit is needed to ensure that
|
// turned on, so a dedicated bit is needed to ensure that
|
||||||
// Sync-the-feature remains off. Note that sync-the-transport will restart
|
// Sync-the-feature remains off. Note that sync-the-transport will restart
|
||||||
// immediately because IsEngineAllowedToRun() is almost certainly true at
|
// immediately because IsEngineAllowedToRun() is almost certainly true at
|
||||||
// this point and StopAndClear() leads to TryStart().
|
// this point and StopAndClear() leads to TryStart().
|
||||||
user_settings_->SetSyncFeatureDisabledViaDashboard();
|
user_settings_->SetSyncFeatureDisabledViaDashboard();
|
||||||
#else // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#else // !BUILDFLAG(IS_CHROMEOS)
|
||||||
// On every platform except ash, revoke the Sync consent/Clear primary
|
// On every platform except ash, revoke the Sync consent/Clear primary
|
||||||
// account after a dashboard clear.
|
// account after a dashboard clear.
|
||||||
// TODO(crbug.com/40066949): Simplify once kSync becomes unreachable or is
|
// TODO(crbug.com/40066949): Simplify once kSync becomes unreachable or is
|
||||||
@ -1218,7 +1218,7 @@ void SyncServiceImpl::OnActionableProtocolError(
|
|||||||
signin_metrics::ProfileSignout::kServerForcedDisable);
|
signin_metrics::ProfileSignout::kServerForcedDisable);
|
||||||
#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
|
#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
break;
|
break;
|
||||||
case STOP_SYNC_FOR_DISABLED_ACCOUNT:
|
case STOP_SYNC_FOR_DISABLED_ACCOUNT:
|
||||||
// Sync disabled by domain admin. Stop syncing until next restart.
|
// 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();
|
bool sync_everything_os = sync_prefs_.IsSyncAllOsTypesEnabled();
|
||||||
base::UmaHistogramBoolean("Sync.SyncEverythingOS", sync_everything_os);
|
base::UmaHistogramBoolean("Sync.SyncEverythingOS", sync_everything_os);
|
||||||
if (!sync_everything_os) {
|
if (!sync_everything_os) {
|
||||||
@ -1682,7 +1682,7 @@ void SyncServiceImpl::ConfigureDataTypeManager(ConfigureReason reason) {
|
|||||||
base::UmaHistogramEnumeration("Sync.CustomOSSync", canonical_data_type);
|
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) {
|
if (is_sync_managed) {
|
||||||
StopAndClear(ResetEngineReason::kEnterprisePolicy);
|
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
|
// On ChromeOS Ash, sync-the-feature stays disabled even after the policy is
|
||||||
// removed, for historic reasons. It is unclear if this behavior is
|
// removed, for historic reasons. It is unclear if this behavior is
|
||||||
// optional, because it is indistinguishable from the
|
// optional, because it is indistinguishable from the
|
||||||
// sync-reset-via-dashboard case. It can be resolved by invoking
|
// sync-reset-via-dashboard case. It can be resolved by invoking
|
||||||
// SetSyncFeatureRequested().
|
// SetSyncFeatureRequested().
|
||||||
sync_prefs_.SetSyncFeatureDisabledViaDashboard();
|
sync_prefs_.SetSyncFeatureDisabledViaDashboard();
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
} else {
|
} else {
|
||||||
// Sync is no longer disabled by policy. Try starting it up if appropriate.
|
// Sync is no longer disabled by policy. Try starting it up if appropriate.
|
||||||
DCHECK(!engine_);
|
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(
|
void SyncServiceImpl::OnFirstSetupCompletePrefChange(
|
||||||
bool is_initial_sync_feature_setup_complete) {
|
bool is_initial_sync_feature_setup_complete) {
|
||||||
if (engine_ && engine_->IsInitialized()) {
|
if (engine_ && engine_->IsInitialized()) {
|
||||||
@ -1802,7 +1802,7 @@ void SyncServiceImpl::OnFirstSetupCompletePrefChange(
|
|||||||
MaybeRecordTrustedVaultHistograms();
|
MaybeRecordTrustedVaultHistograms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
void SyncServiceImpl::OnAccountsCookieDeletedByUserAction() {
|
void SyncServiceImpl::OnAccountsCookieDeletedByUserAction() {
|
||||||
// Pass an empty `signin::AccountsInCookieJarInfo` to simulate empty cookies.
|
// 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
|
// passphrase pref should be cleared before clearing
|
||||||
// InitialSyncFeatureSetupComplete().
|
// InitialSyncFeatureSetupComplete().
|
||||||
sync_prefs_.ClearAllEncryptionBootstrapTokens();
|
sync_prefs_.ClearAllEncryptionBootstrapTokens();
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
// Note: ResetEngine() does *not* clear directly user-controlled prefs (such
|
// 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
|
// 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.
|
// Sync again, they start off with their previous settings by default.
|
||||||
// However, they do have to go through the initial setup again.
|
// However, they do have to go through the initial setup again.
|
||||||
sync_prefs_.ClearInitialSyncFeatureSetupComplete();
|
sync_prefs_.ClearInitialSyncFeatureSetupComplete();
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
sync_prefs_.ClearPassphrasePromptMutedProductVersion();
|
sync_prefs_.ClearPassphrasePromptMutedProductVersion();
|
||||||
// Cached information provided by SyncEngine must be cleared.
|
// Cached information provided by SyncEngine must be cleared.
|
||||||
sync_prefs_.ClearCachedPassphraseType();
|
sync_prefs_.ClearCachedPassphraseType();
|
||||||
|
@ -213,10 +213,10 @@ class SyncServiceImpl : public SyncService,
|
|||||||
|
|
||||||
// SyncPrefObserver implementation.
|
// SyncPrefObserver implementation.
|
||||||
void OnSyncManagedPrefChange(bool is_sync_managed) override;
|
void OnSyncManagedPrefChange(bool is_sync_managed) override;
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
void OnFirstSetupCompletePrefChange(
|
void OnFirstSetupCompletePrefChange(
|
||||||
bool is_initial_sync_feature_setup_complete) override;
|
bool is_initial_sync_feature_setup_complete) override;
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
void OnSelectedTypesPrefChange() override;
|
void OnSelectedTypesPrefChange() override;
|
||||||
|
|
||||||
// KeyedService implementation. This must be called exactly
|
// KeyedService implementation. This must be called exactly
|
||||||
|
@ -151,9 +151,9 @@ class SyncServiceImplStartupTest : public testing::Test {
|
|||||||
void SetSyncFeatureEnabledPrefs() {
|
void SetSyncFeatureEnabledPrefs() {
|
||||||
CHECK(!sync_service_);
|
CHECK(!sync_service_);
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
sync_prefs_.SetInitialSyncFeatureSetupComplete();
|
sync_prefs_.SetInitialSyncFeatureSetupComplete();
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncPrefs* sync_prefs() { return &sync_prefs_; }
|
SyncPrefs* sync_prefs() { return &sync_prefs_; }
|
||||||
@ -189,7 +189,7 @@ class SyncServiceImplStartupTest : public testing::Test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ChromeOS does not support sign-in after startup
|
// ChromeOS does not support sign-in after startup
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncServiceImplStartupTest, StartFirstTime) {
|
TEST_F(SyncServiceImplStartupTest, StartFirstTime) {
|
||||||
// We've never completed startup.
|
// We've never completed startup.
|
||||||
ASSERT_FALSE(sync_prefs()->IsInitialSyncFeatureSetupComplete());
|
ASSERT_FALSE(sync_prefs()->IsInitialSyncFeatureSetupComplete());
|
||||||
@ -250,7 +250,7 @@ TEST_F(SyncServiceImplStartupTest, StartFirstTime) {
|
|||||||
EXPECT_EQ(SyncService::TransportState::ACTIVE,
|
EXPECT_EQ(SyncService::TransportState::ACTIVE,
|
||||||
sync_service()->GetTransportState());
|
sync_service()->GetTransportState());
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(SyncServiceImplStartupTest, StartNoCredentials) {
|
TEST_F(SyncServiceImplStartupTest, StartNoCredentials) {
|
||||||
// We're already signed in, but don't have a refresh token.
|
// We're already signed in, but don't have a refresh token.
|
||||||
@ -391,7 +391,7 @@ TEST_F(SyncServiceImplStartupTest, StartInvalidCredentials) {
|
|||||||
sync_service()->GetTransportState());
|
sync_service()->GetTransportState());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncServiceImplStartupTest, StartAshNoCredentials) {
|
TEST_F(SyncServiceImplStartupTest, StartAshNoCredentials) {
|
||||||
// We've never completed startup.
|
// We've never completed startup.
|
||||||
ASSERT_FALSE(
|
ASSERT_FALSE(
|
||||||
@ -460,7 +460,7 @@ TEST_F(SyncServiceImplStartupTest, ResetSyncViaDashboard) {
|
|||||||
EXPECT_EQ(expected_transport_state_after_reset,
|
EXPECT_EQ(expected_transport_state_after_reset,
|
||||||
sync_service()->GetTransportState());
|
sync_service()->GetTransportState());
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
BUILDFLAG(IS_CHROMEOS_ASH),
|
BUILDFLAG(IS_CHROMEOS),
|
||||||
sync_service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
sync_service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
||||||
EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled());
|
EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled());
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ TEST_F(SyncServiceImplStartupTest, ResetSyncViaDashboard) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ChromeOS does not support sign-in after startup.
|
// 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.
|
// Verify that enabling sync honors existing values of data type preferences.
|
||||||
TEST_F(SyncServiceImplStartupTest, HonorsExistingDatatypePrefs) {
|
TEST_F(SyncServiceImplStartupTest, HonorsExistingDatatypePrefs) {
|
||||||
// Explicitly set Keep Everything Synced to false and have only bookmarks
|
// Explicitly set Keep Everything Synced to false and have only bookmarks
|
||||||
@ -557,7 +557,7 @@ TEST_F(SyncServiceImplStartupTest, SwitchManaged) {
|
|||||||
EXPECT_EQ(SyncService::DisableReasonSet(),
|
EXPECT_EQ(SyncService::DisableReasonSet(),
|
||||||
sync_service()->GetDisableReasons());
|
sync_service()->GetDisableReasons());
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
sync_service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
sync_service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
||||||
// On ChromeOS Ash, sync-the-feature stays disabled even after the policy is
|
// On ChromeOS Ash, sync-the-feature stays disabled even after the policy is
|
||||||
@ -569,7 +569,7 @@ TEST_F(SyncServiceImplStartupTest, SwitchManaged) {
|
|||||||
#else
|
#else
|
||||||
EXPECT_FALSE(
|
EXPECT_FALSE(
|
||||||
sync_service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
sync_service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled());
|
EXPECT_FALSE(sync_service()->IsSyncFeatureEnabled());
|
||||||
EXPECT_FALSE(sync_service()->IsSyncFeatureActive());
|
EXPECT_FALSE(sync_service()->IsSyncFeatureActive());
|
||||||
@ -584,9 +584,9 @@ TEST_F(SyncServiceImplStartupTest, StartDownloadFailed) {
|
|||||||
ASSERT_FALSE(
|
ASSERT_FALSE(
|
||||||
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
ASSERT_FALSE(sync_prefs()->IsInitialSyncFeatureSetupComplete());
|
ASSERT_FALSE(sync_prefs()->IsInitialSyncFeatureSetupComplete());
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
FastForwardUntilNoTasksRemain();
|
FastForwardUntilNoTasksRemain();
|
||||||
|
|
||||||
@ -604,7 +604,7 @@ TEST_F(SyncServiceImplStartupTest, StartDownloadFailed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ChromeOS does not support sign-in after startup.
|
// ChromeOS does not support sign-in after startup.
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncServiceImplStartupTest, FullStartupSequenceFirstTime) {
|
TEST_F(SyncServiceImplStartupTest, FullStartupSequenceFirstTime) {
|
||||||
// We've never completed startup.
|
// We've never completed startup.
|
||||||
ASSERT_FALSE(sync_prefs()->IsInitialSyncFeatureSetupComplete());
|
ASSERT_FALSE(sync_prefs()->IsInitialSyncFeatureSetupComplete());
|
||||||
@ -683,7 +683,7 @@ TEST_F(SyncServiceImplStartupTest, FullStartupSequenceFirstTime) {
|
|||||||
sync_service()->GetTransportState());
|
sync_service()->GetTransportState());
|
||||||
EXPECT_TRUE(sync_service()->IsSyncFeatureActive());
|
EXPECT_TRUE(sync_service()->IsSyncFeatureActive());
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(SyncServiceImplStartupTest, FullStartupSequenceNthTime) {
|
TEST_F(SyncServiceImplStartupTest, FullStartupSequenceNthTime) {
|
||||||
// The user is already signed in and has completed Sync setup before.
|
// 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.
|
// ChromeOS does not support sign-in after startup.
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncServiceImplStartupTest, UserTriggeredStartIsNotDeferredStart) {
|
TEST_F(SyncServiceImplStartupTest, UserTriggeredStartIsNotDeferredStart) {
|
||||||
// Signed-out at first.
|
// Signed-out at first.
|
||||||
base::HistogramTester histogram_tester;
|
base::HistogramTester histogram_tester;
|
||||||
|
@ -245,11 +245,11 @@ class SyncServiceImplTest : public ::testing::Test {
|
|||||||
/*keep_everything_synced=*/true,
|
/*keep_everything_synced=*/true,
|
||||||
/*registered_types=*/UserSelectableTypeSet::All(),
|
/*registered_types=*/UserSelectableTypeSet::All(),
|
||||||
/*selected_types=*/UserSelectableTypeSet::All());
|
/*selected_types=*/UserSelectableTypeSet::All());
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ASSERT_TRUE(sync_prefs.IsInitialSyncFeatureSetupComplete());
|
ASSERT_TRUE(sync_prefs.IsInitialSyncFeatureSetupComplete());
|
||||||
#else // BUILDFLAG(IS_CHROMEOS_ASH)
|
#else // BUILDFLAG(IS_CHROMEOS)
|
||||||
sync_prefs.SetInitialSyncFeatureSetupComplete();
|
sync_prefs.SetInitialSyncFeatureSetupComplete();
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetInvalidationsEnabled() {
|
void SetInvalidationsEnabled() {
|
||||||
@ -341,7 +341,7 @@ TEST_F(SyncServiceImplTest, SuccessfulLocalBackendInitialization) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ChromeOS Ash sets FirstSetupComplete automatically.
|
// 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
|
// Verify that an initialization where first setup is not complete does not
|
||||||
// start up Sync-the-feature.
|
// start up Sync-the-feature.
|
||||||
TEST_F(SyncServiceImplTest, NeedsConfirmation) {
|
TEST_F(SyncServiceImplTest, NeedsConfirmation) {
|
||||||
@ -373,7 +373,7 @@ TEST_F(SyncServiceImplTest, DataTypesForTransportMode) {
|
|||||||
InitializeService();
|
InitializeService();
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Sync-the-feature is normally enabled in Ash. Triggering a dashboard reset
|
// Sync-the-feature is normally enabled in Ash. Triggering a dashboard reset
|
||||||
// is one way to achieve otherwise.
|
// is one way to achieve otherwise.
|
||||||
SyncProtocolError client_cmd;
|
SyncProtocolError client_cmd;
|
||||||
@ -457,7 +457,7 @@ TEST_F(SyncServiceImplTest, DisabledByPolicyBeforeInitThenPolicyRemoved) {
|
|||||||
EXPECT_FALSE(service()->IsSyncFeatureActive());
|
EXPECT_FALSE(service()->IsSyncFeatureActive());
|
||||||
EXPECT_TRUE(service()->GetDisableReasons().empty());
|
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.
|
// On ChromeOS Ash, the first setup is marked as complete automatically.
|
||||||
ASSERT_TRUE(
|
ASSERT_TRUE(
|
||||||
service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
||||||
@ -479,7 +479,7 @@ TEST_F(SyncServiceImplTest, DisabledByPolicyBeforeInitThenPolicyRemoved) {
|
|||||||
service()->GetUserSettings()->SetInitialSyncFeatureSetupComplete(
|
service()->GetUserSettings()->SetInitialSyncFeatureSetupComplete(
|
||||||
syncer::SyncFirstSetupCompleteSource::BASIC_FLOW);
|
syncer::SyncFirstSetupCompleteSource::BASIC_FLOW);
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// Sync-the-feature is considered on.
|
// Sync-the-feature is considered on.
|
||||||
EXPECT_EQ(SyncService::TransportState::ACTIVE,
|
EXPECT_EQ(SyncService::TransportState::ACTIVE,
|
||||||
@ -528,7 +528,7 @@ TEST_F(SyncServiceImplTest, AbortedByShutdown) {
|
|||||||
|
|
||||||
// Certain SyncServiceImpl tests don't apply to Chrome OS, for example
|
// Certain SyncServiceImpl tests don't apply to Chrome OS, for example
|
||||||
// things that deal with concepts like "signing out".
|
// 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 the user signing out before the backend's initialization completes.
|
||||||
TEST_F(SyncServiceImplTest, EarlySignOut) {
|
TEST_F(SyncServiceImplTest, EarlySignOut) {
|
||||||
// Set up a fake sync engine that will not immediately finish initialization.
|
// 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()->IsSyncFeatureActive());
|
||||||
EXPECT_FALSE(service()->IsSyncFeatureEnabled());
|
EXPECT_FALSE(service()->IsSyncFeatureEnabled());
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// Certain SyncServiceImpl tests don't apply to Chrome OS, for example
|
// Certain SyncServiceImpl tests don't apply to Chrome OS, for example
|
||||||
// things that deal with concepts like "signing out".
|
// things that deal with concepts like "signing out".
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncServiceImplTest, SignOutDisablesSyncTransportAndSyncFeature) {
|
TEST_F(SyncServiceImplTest, SignOutDisablesSyncTransportAndSyncFeature) {
|
||||||
// Sign-in and enable sync.
|
// Sign-in and enable sync.
|
||||||
PopulatePrefsForInitialSyncFeatureSetupComplete();
|
PopulatePrefsForInitialSyncFeatureSetupComplete();
|
||||||
@ -644,7 +644,7 @@ TEST_F(SyncServiceImplTest,
|
|||||||
EXPECT_FALSE(
|
EXPECT_FALSE(
|
||||||
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(
|
TEST_F(
|
||||||
SyncServiceImplTest,
|
SyncServiceImplTest,
|
||||||
@ -664,7 +664,7 @@ TEST_F(
|
|||||||
params.emplace_back(CONTACT_INFO, /*enable_transport_mode=*/true);
|
params.emplace_back(CONTACT_INFO, /*enable_transport_mode=*/true);
|
||||||
InitializeService(std::move(params));
|
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
|
// Sync-the-feature is normally enabled in Ash. Triggering a dashboard reset
|
||||||
// is one way to achieve otherwise.
|
// is one way to achieve otherwise.
|
||||||
SyncProtocolError client_cmd;
|
SyncProtocolError client_cmd;
|
||||||
@ -703,7 +703,7 @@ TEST_F(
|
|||||||
UserSelectableType::kAutofill));
|
UserSelectableType::kAutofill));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(
|
TEST_F(
|
||||||
SyncServiceImplTest,
|
SyncServiceImplTest,
|
||||||
AddressesSyncValueShouldRemainUnchangedForCustomPassphraseUsersAfterTheirInitialSignin) {
|
AddressesSyncValueShouldRemainUnchangedForCustomPassphraseUsersAfterTheirInitialSignin) {
|
||||||
@ -768,7 +768,7 @@ TEST_F(
|
|||||||
EXPECT_TRUE(service()->GetUserSettings()->GetSelectedTypes().Has(
|
EXPECT_TRUE(service()->GetUserSettings()->GetSelectedTypes().Has(
|
||||||
UserSelectableType::kAutofill));
|
UserSelectableType::kAutofill));
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(
|
TEST_F(
|
||||||
SyncServiceImplTest,
|
SyncServiceImplTest,
|
||||||
@ -795,7 +795,7 @@ TEST_F(
|
|||||||
params.emplace_back(CONTACT_INFO, /*enable_transport_mode=*/true);
|
params.emplace_back(CONTACT_INFO, /*enable_transport_mode=*/true);
|
||||||
InitializeService(std::move(params));
|
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
|
// Sync-the-feature is normally enabled in Ash. Triggering a dashboard reset
|
||||||
// is one way to achieve otherwise.
|
// is one way to achieve otherwise.
|
||||||
SyncProtocolError client_cmd;
|
SyncProtocolError client_cmd;
|
||||||
@ -971,7 +971,7 @@ TEST_F(SyncServiceImplTest, CredentialsRejectedByClient_StopSync) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CrOS Ash does not support signout.
|
// CrOS Ash does not support signout.
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncServiceImplTest, SignOutRevokeAccessToken) {
|
TEST_F(SyncServiceImplTest, SignOutRevokeAccessToken) {
|
||||||
PopulatePrefsForInitialSyncFeatureSetupComplete();
|
PopulatePrefsForInitialSyncFeatureSetupComplete();
|
||||||
SignInWithSyncConsent();
|
SignInWithSyncConsent();
|
||||||
@ -1013,7 +1013,7 @@ TEST_F(SyncServiceImplTest, SignOutRevokeAccessToken) {
|
|||||||
// Verify that sync transport data is cleared when the service is initializing
|
// Verify that sync transport data is cleared when the service is initializing
|
||||||
// and account is signed out.
|
// and account is signed out.
|
||||||
// This code path doesn't exist on ChromeOS-Ash, since signout is not possible.
|
// 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) {
|
TEST_F(SyncServiceImplTest, ClearTransportDataOnInitializeWhenSignedOut) {
|
||||||
PopulatePrefsForInitialSyncFeatureSetupComplete();
|
PopulatePrefsForInitialSyncFeatureSetupComplete();
|
||||||
|
|
||||||
@ -1030,7 +1030,7 @@ TEST_F(SyncServiceImplTest, ClearTransportDataOnInitializeWhenSignedOut) {
|
|||||||
EXPECT_FALSE(
|
EXPECT_FALSE(
|
||||||
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(SyncServiceImplTest, DashboardResetTwiceDoesNotCrash) {
|
TEST_F(SyncServiceImplTest, DashboardResetTwiceDoesNotCrash) {
|
||||||
PopulatePrefsForInitialSyncFeatureSetupComplete();
|
PopulatePrefsForInitialSyncFeatureSetupComplete();
|
||||||
@ -1265,10 +1265,10 @@ TEST_F(SyncServiceImplTest, DisableSyncOnClient) {
|
|||||||
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
||||||
ASSERT_EQ(0, get_controller(BOOKMARKS)->model()->clear_metadata_count());
|
ASSERT_EQ(0, get_controller(BOOKMARKS)->model()->clear_metadata_count());
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ASSERT_FALSE(
|
ASSERT_FALSE(
|
||||||
service()->GetUserSettings()->IsSyncFeatureDisabledViaDashboard());
|
service()->GetUserSettings()->IsSyncFeatureDisabledViaDashboard());
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// TODO(crbug.com/40066949): Update once kSync becomes unreachable or is
|
// TODO(crbug.com/40066949): Update once kSync becomes unreachable or is
|
||||||
// deleted from the codebase. See ConsentLevel::kSync documentation for
|
// deleted from the codebase. See ConsentLevel::kSync documentation for
|
||||||
@ -1290,7 +1290,7 @@ TEST_F(SyncServiceImplTest, DisableSyncOnClient) {
|
|||||||
|
|
||||||
EXPECT_FALSE(
|
EXPECT_FALSE(
|
||||||
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
engine_factory()->HasTransportDataIncludingFirstSync(gaia_id_hash()));
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Ash does not support signout.
|
// Ash does not support signout.
|
||||||
// TODO(crbug.com/40066949): Remove once kSync becomes unreachable or is
|
// TODO(crbug.com/40066949): Remove once kSync becomes unreachable or is
|
||||||
// deleted from the codebase. See ConsentLevel::kSync documentation for
|
// deleted from the codebase. See ConsentLevel::kSync documentation for
|
||||||
@ -1330,7 +1330,7 @@ TEST_F(SyncServiceImplTest, DisableSyncOnClient) {
|
|||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
EXPECT_EQ(SyncService::TransportState::ACTIVE,
|
EXPECT_EQ(SyncService::TransportState::ACTIVE,
|
||||||
service()->GetTransportState());
|
service()->GetTransportState());
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// TrustedVault data should have been cleared.
|
// TrustedVault data should have been cleared.
|
||||||
EXPECT_THAT(trusted_vault_client()->GetStoredKeys(primary_account_gaia_id),
|
EXPECT_THAT(trusted_vault_client()->GetStoredKeys(primary_account_gaia_id),
|
||||||
@ -1606,7 +1606,7 @@ TEST_F(SyncServiceImplTest, ShouldSendDataTypesToSyncInvalidationsService) {
|
|||||||
EXPECT_TRUE(engine()->started_handling_invalidations());
|
EXPECT_TRUE(engine()->started_handling_invalidations());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncServiceImplTest,
|
TEST_F(SyncServiceImplTest,
|
||||||
ShouldSendDataTypesToSyncInvalidationsServiceInTransportMode) {
|
ShouldSendDataTypesToSyncInvalidationsServiceInTransportMode) {
|
||||||
SignInWithoutSyncConsent();
|
SignInWithoutSyncConsent();
|
||||||
@ -2072,7 +2072,7 @@ TEST_F(SyncServiceImplTest, ShouldRecordUserActionableErrorOnSyncPaused) {
|
|||||||
|
|
||||||
// These tests cover signing in after browser startup, which isn't supported on
|
// These tests cover signing in after browser startup, which isn't supported on
|
||||||
// ChromeOS-Ash (where there's always a signed-in user).
|
// ChromeOS-Ash (where there's always a signed-in user).
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(
|
TEST_F(
|
||||||
SyncServiceImplTest,
|
SyncServiceImplTest,
|
||||||
GetTypesWithPendingDownloadForInitialSyncDuringFirstSyncInTransportMode) {
|
GetTypesWithPendingDownloadForInitialSyncDuringFirstSyncInTransportMode) {
|
||||||
@ -2130,7 +2130,7 @@ TEST_F(SyncServiceImplTest,
|
|||||||
EXPECT_EQ(DataTypeSet(),
|
EXPECT_EQ(DataTypeSet(),
|
||||||
service()->GetTypesWithPendingDownloadForInitialSync());
|
service()->GetTypesWithPendingDownloadForInitialSync());
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(SyncServiceImplTest,
|
TEST_F(SyncServiceImplTest,
|
||||||
GetTypesWithPendingDownloadForInitialSyncDuringNthSync) {
|
GetTypesWithPendingDownloadForInitialSyncDuringNthSync) {
|
||||||
@ -2387,13 +2387,13 @@ TEST_F(SyncServiceImplTest, ShouldCacheTrustedVaultAutoUpgradeDebugInfo) {
|
|||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
SignInWithSyncConsent();
|
SignInWithSyncConsent();
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ASSERT_TRUE(
|
ASSERT_TRUE(
|
||||||
service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
service()->GetUserSettings()->IsInitialSyncFeatureSetupComplete());
|
||||||
#else // BUILDFLAG(IS_CHROMEOS_ASH)
|
#else // BUILDFLAG(IS_CHROMEOS)
|
||||||
service()->GetUserSettings()->SetInitialSyncFeatureSetupComplete(
|
service()->GetUserSettings()->SetInitialSyncFeatureSetupComplete(
|
||||||
syncer::SyncFirstSetupCompleteSource::BASIC_FLOW);
|
syncer::SyncFirstSetupCompleteSource::BASIC_FLOW);
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
base::RunLoop().RunUntilIdle();
|
base::RunLoop().RunUntilIdle();
|
||||||
|
|
||||||
@ -2466,7 +2466,7 @@ TEST_F(SyncServiceImplTest, ShouldCacheTrustedVaultAutoUpgradeDebugInfo) {
|
|||||||
.cohort());
|
.cohort());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(SyncServiceImplTest, ShouldRecordHistoryOptInStateOnSignin) {
|
TEST_F(SyncServiceImplTest, ShouldRecordHistoryOptInStateOnSignin) {
|
||||||
// Allow UserSelectableType::kHistory in transport mode.
|
// Allow UserSelectableType::kHistory in transport mode.
|
||||||
base::test::ScopedFeatureList features{kReplaceSyncPromosWithSignInPromos};
|
base::test::ScopedFeatureList features{kReplaceSyncPromosWithSignInPromos};
|
||||||
@ -2597,7 +2597,7 @@ TEST_F(SyncServiceImplTest, ShouldRecordHistoryOptInStateOnSync) {
|
|||||||
"Signin.HistoryAlreadyOptedInAccessPoint."),
|
"Signin.HistoryAlreadyOptedInAccessPoint."),
|
||||||
Contains(Pair("Signin.HistoryAlreadyOptedInAccessPoint.OnSync", 1)));
|
Contains(Pair("Signin.HistoryAlreadyOptedInAccessPoint.OnSync", 1)));
|
||||||
}
|
}
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace syncer
|
} // namespace syncer
|
||||||
|
@ -22,12 +22,12 @@ class SyncUserSettingsMock : public SyncUserSettings {
|
|||||||
SyncUserSettingsMock();
|
SyncUserSettingsMock();
|
||||||
~SyncUserSettingsMock() override;
|
~SyncUserSettingsMock() override;
|
||||||
MOCK_METHOD(bool, IsInitialSyncFeatureSetupComplete, (), (const override));
|
MOCK_METHOD(bool, IsInitialSyncFeatureSetupComplete, (), (const override));
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
SetInitialSyncFeatureSetupComplete,
|
SetInitialSyncFeatureSetupComplete,
|
||||||
(SyncFirstSetupCompleteSource),
|
(SyncFirstSetupCompleteSource),
|
||||||
(override));
|
(override));
|
||||||
#endif // !BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // !BUILDFLAG(IS_CHROMEOS)
|
||||||
MOCK_METHOD(bool, IsSyncEverythingEnabled, (), (const override));
|
MOCK_METHOD(bool, IsSyncEverythingEnabled, (), (const override));
|
||||||
MOCK_METHOD(UserSelectableTypeSet, GetSelectedTypes, (), (const override));
|
MOCK_METHOD(UserSelectableTypeSet, GetSelectedTypes, (), (const override));
|
||||||
MOCK_METHOD(bool,
|
MOCK_METHOD(bool,
|
||||||
@ -62,7 +62,7 @@ class SyncUserSettingsMock : public SyncUserSettings {
|
|||||||
(),
|
(),
|
||||||
(const override));
|
(const override));
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
MOCK_METHOD(bool, IsSyncFeatureDisabledViaDashboard, (), (const override));
|
MOCK_METHOD(bool, IsSyncFeatureDisabledViaDashboard, (), (const override));
|
||||||
MOCK_METHOD(bool, IsSyncAllOsTypesEnabled, (), (const override));
|
MOCK_METHOD(bool, IsSyncAllOsTypesEnabled, (), (const override));
|
||||||
MOCK_METHOD(UserSelectableOsTypeSet,
|
MOCK_METHOD(UserSelectableOsTypeSet,
|
||||||
|
@ -78,13 +78,13 @@ void TestSyncService::SetSignedOut() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TestSyncService::MimicDashboardClear() {
|
void TestSyncService::MimicDashboardClear() {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Clearing sync from the dashboard results in
|
// Clearing sync from the dashboard results in
|
||||||
// IsSyncFeatureDisabledViaDashboard() returning true.
|
// IsSyncFeatureDisabledViaDashboard() returning true.
|
||||||
user_settings_.SetSyncFeatureDisabledViaDashboard(true);
|
user_settings_.SetSyncFeatureDisabledViaDashboard(true);
|
||||||
#else
|
#else
|
||||||
SetSignedIn(signin::ConsentLevel::kSignin);
|
SetSignedIn(signin::ConsentLevel::kSignin);
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestSyncService::SetAllowedByEnterprisePolicy(bool allowed) {
|
void TestSyncService::SetAllowedByEnterprisePolicy(bool allowed) {
|
||||||
@ -197,9 +197,9 @@ base::android::ScopedJavaLocalRef<jobject> TestSyncService::GetJavaObject() {
|
|||||||
#endif // BUILDFLAG(IS_ANDROID)
|
#endif // BUILDFLAG(IS_ANDROID)
|
||||||
|
|
||||||
void TestSyncService::SetSyncFeatureRequested() {
|
void TestSyncService::SetSyncFeatureRequested() {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
user_settings_.SetSyncFeatureDisabledViaDashboard(false);
|
user_settings_.SetSyncFeatureDisabledViaDashboard(false);
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
TestSyncUserSettings* TestSyncService::GetUserSettings() {
|
TestSyncUserSettings* TestSyncService::GetUserSettings() {
|
||||||
@ -284,11 +284,11 @@ DataTypeSet TestSyncService::GetActiveDataTypes() const {
|
|||||||
if (GetTransportState() != TransportState::ACTIVE) {
|
if (GetTransportState() != TransportState::ACTIVE) {
|
||||||
return DataTypeSet();
|
return DataTypeSet();
|
||||||
}
|
}
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
if (user_settings_.IsSyncFeatureDisabledViaDashboard()) {
|
if (user_settings_.IsSyncFeatureDisabledViaDashboard()) {
|
||||||
return DataTypeSet();
|
return DataTypeSet();
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
return Difference(GetPreferredDataTypes(), failed_data_types_);
|
return Difference(GetPreferredDataTypes(), failed_data_types_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "testing/gmock/include/gmock/gmock.h"
|
#include "testing/gmock/include/gmock/gmock.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.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"
|
#include "chromeos/ash/components/system/fake_statistics_provider.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -515,7 +515,7 @@ class DeviceInfoSyncBridgeTest : public testing::Test,
|
|||||||
: store_(DataTypeStoreTestUtil::CreateInMemoryStoreForTest()) {
|
: store_(DataTypeStoreTestUtil::CreateInMemoryStoreForTest()) {
|
||||||
DeviceInfoPrefs::RegisterProfilePrefs(pref_service_.registry());
|
DeviceInfoPrefs::RegisterProfilePrefs(pref_service_.registry());
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
statistics_provider_ =
|
statistics_provider_ =
|
||||||
std::make_unique<ash::system::ScopedFakeStatisticsProvider>();
|
std::make_unique<ash::system::ScopedFakeStatisticsProvider>();
|
||||||
#endif
|
#endif
|
||||||
@ -616,7 +616,7 @@ class DeviceInfoSyncBridgeTest : public testing::Test,
|
|||||||
return local_device_info_provider_;
|
return local_device_info_provider_;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ash::system::ScopedFakeStatisticsProvider* statistics_provider() {
|
ash::system::ScopedFakeStatisticsProvider* statistics_provider() {
|
||||||
EXPECT_TRUE(statistics_provider_);
|
EXPECT_TRUE(statistics_provider_);
|
||||||
return statistics_provider_.get();
|
return statistics_provider_.get();
|
||||||
@ -751,7 +751,7 @@ class DeviceInfoSyncBridgeTest : public testing::Test,
|
|||||||
|
|
||||||
raw_ptr<TestLocalDeviceInfoProvider> local_device_info_provider_ = nullptr;
|
raw_ptr<TestLocalDeviceInfoProvider> local_device_info_provider_ = nullptr;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
std::unique_ptr<ash::system::ScopedFakeStatisticsProvider>
|
std::unique_ptr<ash::system::ScopedFakeStatisticsProvider>
|
||||||
statistics_provider_;
|
statistics_provider_;
|
||||||
#endif
|
#endif
|
||||||
|
@ -115,7 +115,7 @@ class LocalDeviceInfoProviderImplTest : public testing::Test {
|
|||||||
std::unique_ptr<LocalDeviceInfoProviderImpl> provider_;
|
std::unique_ptr<LocalDeviceInfoProviderImpl> provider_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(LocalDeviceInfoProviderImplTest, UmaToggleFullHardwareClass) {
|
TEST_F(LocalDeviceInfoProviderImplTest, UmaToggleFullHardwareClass) {
|
||||||
InitializeProvider(kLocalDeviceGuid);
|
InitializeProvider(kLocalDeviceGuid);
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ TEST_F(LocalDeviceInfoProviderImplTest, UmaToggleFullHardwareClass) {
|
|||||||
EXPECT_EQ(provider_->GetLocalDeviceInfo()->full_hardware_class(),
|
EXPECT_EQ(provider_->GetLocalDeviceInfo()->full_hardware_class(),
|
||||||
kLocalFullHardwareClass);
|
kLocalFullHardwareClass);
|
||||||
}
|
}
|
||||||
#else // NOT BUILDFLAG(IS_CHROMEOS_ASH)
|
#else // NOT BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(LocalDeviceInfoProviderImplTest,
|
TEST_F(LocalDeviceInfoProviderImplTest,
|
||||||
UmaEnabledNonChromeOSHardwareClassEmpty) {
|
UmaEnabledNonChromeOSHardwareClassEmpty) {
|
||||||
// Tests that the |full_hardware_class| doesn't get updated when on
|
// 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|
|
// |kLocalFullHardwareClass| is reset after retrieving |local_device_info|
|
||||||
EXPECT_EQ(local_device_info->full_hardware_class(), "");
|
EXPECT_EQ(local_device_info->full_hardware_class(), "");
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
TEST_F(LocalDeviceInfoProviderImplTest, GetLocalDeviceInfo) {
|
TEST_F(LocalDeviceInfoProviderImplTest, GetLocalDeviceInfo) {
|
||||||
ASSERT_EQ(nullptr, provider_->GetLocalDeviceInfo());
|
ASSERT_EQ(nullptr, provider_->GetLocalDeviceInfo());
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "components/sync/protocol/sync_enums.pb.h"
|
#include "components/sync/protocol/sync_enums.pb.h"
|
||||||
#include "ui/base/device_form_factor.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"
|
#include "chromeos/ash/components/system/statistics_provider.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ void OnPersonalizableDeviceNameReady(LocalDeviceNameInfo* name_info_ptr,
|
|||||||
|
|
||||||
void OnMachineStatisticsLoaded(LocalDeviceNameInfo* name_info_ptr,
|
void OnMachineStatisticsLoaded(LocalDeviceNameInfo* name_info_ptr,
|
||||||
base::ScopedClosureRunner done_closure) {
|
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
|
// |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.
|
// enabled. Otherwise |full_hardware_class| is set to an empty string.
|
||||||
if (const std::optional<std::string_view> full_hardware_class =
|
if (const std::optional<std::string_view> full_hardware_class =
|
||||||
@ -106,7 +106,7 @@ sync_pb::SyncEnums::DeviceType GetLocalDeviceType() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeviceInfo::OsType GetLocalDeviceOSType() {
|
DeviceInfo::OsType GetLocalDeviceOSType() {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
return DeviceInfo::OsType::kChromeOsAsh;
|
return DeviceInfo::OsType::kChromeOsAsh;
|
||||||
#elif BUILDFLAG(IS_LINUX)
|
#elif BUILDFLAG(IS_LINUX)
|
||||||
return DeviceInfo::OsType::kLinux;
|
return DeviceInfo::OsType::kLinux;
|
||||||
@ -167,7 +167,7 @@ void GetLocalDeviceNameInfo(
|
|||||||
base::BindOnce(&OnHardwareInfoReady, name_info_ptr,
|
base::BindOnce(&OnHardwareInfoReady, name_info_ptr,
|
||||||
base::ScopedClosureRunner(done_closure)));
|
base::ScopedClosureRunner(done_closure)));
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Bind hwclass once the statistics are available on ChromeOS devices.
|
// Bind hwclass once the statistics are available on ChromeOS devices.
|
||||||
ash::system::StatisticsProvider::GetInstance()
|
ash::system::StatisticsProvider::GetInstance()
|
||||||
->ScheduleOnMachineStatisticsLoaded(
|
->ScheduleOnMachineStatisticsLoaded(
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
#include "build/chromeos_buildflags.h"
|
#include "build/chromeos_buildflags.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/test/scoped_chromeos_version_info.h"
|
#include "base/test/scoped_chromeos_version_info.h"
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
namespace syncer {
|
namespace syncer {
|
||||||
namespace {
|
namespace {
|
||||||
@ -26,7 +26,7 @@ TEST(GetClientNameTest, GetPersonalizableDeviceNameBlocking) {
|
|||||||
EXPECT_FALSE(client_name.empty());
|
EXPECT_FALSE(client_name.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
// Call GetPersonalizableDeviceNameBlocking on ChromeOS where the
|
// Call GetPersonalizableDeviceNameBlocking on ChromeOS where the
|
||||||
// board type is CHROMEBOOK and make sure the return value is "Chromebook".
|
// board type is CHROMEBOOK and make sure the return value is "Chromebook".
|
||||||
@ -46,7 +46,7 @@ TEST(GetClientNameTest, GetPersonalizableDeviceNameBlockingChromebox) {
|
|||||||
EXPECT_EQ("Chromebox", client_name);
|
EXPECT_EQ("Chromebox", client_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace syncer
|
} // namespace syncer
|
||||||
|
@ -72,7 +72,7 @@ UkmConsentStateObserver::~UkmConsentStateObserver() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool UkmConsentStateObserver::ProfileState::IsUkmConsented() const {
|
bool UkmConsentStateObserver::ProfileState::IsUkmConsented() const {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
return consent_state.Has(MSBB) || consent_state.Has(APPS);
|
return consent_state.Has(MSBB) || consent_state.Has(APPS);
|
||||||
#else
|
#else
|
||||||
return consent_state.Has(MSBB);
|
return consent_state.Has(MSBB);
|
||||||
@ -104,7 +104,7 @@ UkmConsentStateObserver::ProfileState UkmConsentStateObserver::GetProfileState(
|
|||||||
state.SetConsentType(EXTENSIONS);
|
state.SetConsentType(EXTENSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
const bool app_sync_consent =
|
const bool app_sync_consent =
|
||||||
CanUploadUkmForType(sync_service, syncer::DataType::APPS, msbb_consent) ||
|
CanUploadUkmForType(sync_service, syncer::DataType::APPS, msbb_consent) ||
|
||||||
// Demo mode is a special managed guest session that doesn't support
|
// 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() {
|
bool UkmConsentStateObserver::IsUkmAllowedForAllProfiles() {
|
||||||
const UkmConsentState ukm_consent_state = GetUkmConsentState();
|
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);
|
return ukm_consent_state.Has(MSBB) || ukm_consent_state.Has(APPS);
|
||||||
#else
|
#else
|
||||||
return ukm_consent_state.Has(MSBB);
|
return ukm_consent_state.Has(MSBB);
|
||||||
@ -256,7 +256,7 @@ UkmConsentState UkmConsentStateObserver::GetUkmConsentState() {
|
|||||||
return ukm_consent_state_.value_or(UkmConsentState());
|
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) {
|
void UkmConsentStateObserver::SetIsDemoMode(bool is_device_in_demo_mode) {
|
||||||
is_device_in_demo_mode_ = is_device_in_demo_mode;
|
is_device_in_demo_mode_ = is_device_in_demo_mode;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ class UkmConsentStateObserver
|
|||||||
bool total_purge,
|
bool total_purge,
|
||||||
UkmConsentState previous_consent_state) = 0;
|
UkmConsentState previous_consent_state) = 0;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Used to set is_demo_mode_ field.
|
// Used to set is_demo_mode_ field.
|
||||||
void SetIsDemoMode(bool is_demo_mode);
|
void SetIsDemoMode(bool is_demo_mode);
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ class UkmConsentStateObserver
|
|||||||
// if constructed with UkmConsentStateObserver(NoInitialUkmConsentStateTag).
|
// if constructed with UkmConsentStateObserver(NoInitialUkmConsentStateTag).
|
||||||
std::optional<UkmConsentState> ukm_consent_state_;
|
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,
|
// Indicate whether the device is in demo mode. If it is true,
|
||||||
// set APPS consent to collect App usage data for active demo
|
// set APPS consent to collect App usage data for active demo
|
||||||
// session. Default to false.
|
// session. Default to false.
|
||||||
|
@ -18,12 +18,9 @@
|
|||||||
#if BUILDFLAG(IS_CHROMEOS)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
#include "chromeos/components/kiosk/kiosk_test_utils.h" // nogncheck
|
#include "chromeos/components/kiosk/kiosk_test_utils.h" // nogncheck
|
||||||
#include "chromeos/components/mgs/managed_guest_session_test_utils.h"
|
#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/fake_user_manager.h"
|
||||||
#include "components/user_manager/scoped_user_manager.h"
|
#include "components/user_manager/scoped_user_manager.h"
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
namespace ukm {
|
namespace ukm {
|
||||||
|
|
||||||
@ -35,7 +32,7 @@ class MockSyncService : public syncer::TestSyncService {
|
|||||||
SetMaxTransportState(TransportState::INITIALIZING);
|
SetMaxTransportState(TransportState::INITIALIZING);
|
||||||
SetLastCycleSnapshot(syncer::SyncCycleSnapshot());
|
SetLastCycleSnapshot(syncer::SyncCycleSnapshot());
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
SetAppSync(false);
|
SetAppSync(false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -75,7 +72,6 @@ class MockSyncService : public syncer::TestSyncService {
|
|||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
void SetAppSync(bool enabled) {
|
void SetAppSync(bool enabled) {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
||||||
auto selected_os_types = GetUserSettings()->GetSelectedOsTypes();
|
auto selected_os_types = GetUserSettings()->GetSelectedOsTypes();
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
@ -85,10 +81,6 @@ class MockSyncService : public syncer::TestSyncService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetUserSettings()->SetSelectedOsTypes(false, selected_os_types);
|
GetUserSettings()->SetSelectedOsTypes(false, selected_os_types);
|
||||||
#else
|
|
||||||
GetUserSettings()->SetAppsSyncEnabledByOs(enabled);
|
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
|
||||||
|
|
||||||
NotifyObserversOfStateChanged();
|
NotifyObserversOfStateChanged();
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
@ -171,11 +163,11 @@ class UkmConsentStateObserverTest : public testing::TestWithParam<bool> {
|
|||||||
|
|
||||||
void ExpectDwaAllowedForAllProfiles(TestUkmConsentStateObserver& observer,
|
void ExpectDwaAllowedForAllProfiles(TestUkmConsentStateObserver& observer,
|
||||||
bool expected_allowed) {
|
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
|
// being allowed for that particular test setup, however can be enabled for
|
||||||
// other platforms.
|
// other platforms.
|
||||||
// DWA and ChromeOS are tested further below.
|
// DWA and ChromeOS are tested further below.
|
||||||
#if !BUILDFLAG(IS_CHROMEOS_ASH)
|
#if !BUILDFLAG(IS_CHROMEOS)
|
||||||
EXPECT_EQ(expected_allowed, observer.IsDwaAllowedForAllProfiles());
|
EXPECT_EQ(expected_allowed, observer.IsDwaAllowedForAllProfiles());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -314,7 +306,7 @@ TEST_F(UkmConsentStateObserverTest, NoInitialUkmConsentState) {
|
|||||||
sync.Shutdown();
|
sync.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
TEST_F(UkmConsentStateObserverTest, VerifyConsentStates) {
|
TEST_F(UkmConsentStateObserverTest, VerifyConsentStates) {
|
||||||
sync_preferences::TestingPrefServiceSyncable prefs;
|
sync_preferences::TestingPrefServiceSyncable prefs;
|
||||||
RegisterUrlKeyedAnonymizedDataCollectionPref(prefs);
|
RegisterUrlKeyedAnonymizedDataCollectionPref(prefs);
|
||||||
@ -428,10 +420,6 @@ TEST_F(UkmConsentStateObserverTest, VerifyConflictingProfilesRevokesConsent) {
|
|||||||
EXPECT_FALSE(observer.ResetPurged());
|
EXPECT_FALSE(observer.ResetPurged());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS)
|
|
||||||
|
|
||||||
// Test consent state for kiosk.
|
// Test consent state for kiosk.
|
||||||
class KioskUkmConsentStateObserverTest : public UkmConsentStateObserverTest {
|
class KioskUkmConsentStateObserverTest : public UkmConsentStateObserverTest {
|
||||||
public:
|
public:
|
||||||
@ -440,10 +428,8 @@ class KioskUkmConsentStateObserverTest : public UkmConsentStateObserverTest {
|
|||||||
|
|
||||||
TEST_P(KioskUkmConsentStateObserverTest, VerifyDefaultConsent) {
|
TEST_P(KioskUkmConsentStateObserverTest, VerifyDefaultConsent) {
|
||||||
// Enter Kiosk session.
|
// Enter Kiosk session.
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
||||||
user_manager::ScopedUserManager user_manager(
|
user_manager::ScopedUserManager user_manager(
|
||||||
std::make_unique<user_manager::FakeUserManager>());
|
std::make_unique<user_manager::FakeUserManager>());
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
|
||||||
chromeos::SetUpFakeKioskSession();
|
chromeos::SetUpFakeKioskSession();
|
||||||
|
|
||||||
sync_preferences::TestingPrefServiceSyncable prefs;
|
sync_preferences::TestingPrefServiceSyncable prefs;
|
||||||
|
@ -2213,9 +2213,7 @@ TEST_F(UkmServiceTest, NotifyObserverOnShutdown) {
|
|||||||
ukm::UkmRecorder::Get()->AddObserver(&observer);
|
ukm::UkmRecorder::Get()->AddObserver(&observer);
|
||||||
EXPECT_CALL(observer, OnStartingShutdown()).Times(1);
|
EXPECT_CALL(observer, OnStartingShutdown()).Times(1);
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS)
|
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class UkmServiceTestWithIndependentAppKM
|
class UkmServiceTestWithIndependentAppKM
|
||||||
@ -2402,7 +2400,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
class MockUkmRecorder : public ukm::UkmRecorder {
|
class MockUkmRecorder : public ukm::UkmRecorder {
|
||||||
public:
|
public:
|
||||||
|
@ -48,7 +48,7 @@ Study::Platform ClientFilterableState::GetCurrentPlatform() {
|
|||||||
return Study::PLATFORM_IOS;
|
return Study::PLATFORM_IOS;
|
||||||
#elif BUILDFLAG(IS_MAC)
|
#elif BUILDFLAG(IS_MAC)
|
||||||
return Study::PLATFORM_MAC;
|
return Study::PLATFORM_MAC;
|
||||||
#elif BUILDFLAG(IS_CHROMEOS_ASH)
|
#elif BUILDFLAG(IS_CHROMEOS)
|
||||||
return Study::PLATFORM_CHROMEOS;
|
return Study::PLATFORM_CHROMEOS;
|
||||||
#elif BUILDFLAG(IS_ANDROID)
|
#elif BUILDFLAG(IS_ANDROID)
|
||||||
return Study::PLATFORM_ANDROID;
|
return Study::PLATFORM_ANDROID;
|
||||||
@ -85,7 +85,7 @@ base::Version ClientFilterableState::GetOSVersion() {
|
|||||||
|
|
||||||
std::string ClientFilterableState::GetHardwareClass() {
|
std::string ClientFilterableState::GetHardwareClass() {
|
||||||
// TODO(crbug.com/40708998): Expand to other platforms.
|
// 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();
|
return base::SysInfo::HardwareModelName();
|
||||||
#else
|
#else
|
||||||
return "";
|
return "";
|
||||||
|
@ -874,7 +874,7 @@ TEST_F(FieldTrialUtilTest, TestEscapeValue) {
|
|||||||
EXPECT_EQ(str, base::UnescapeValue(escaped_str));
|
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,
|
TEST_F(FieldTrialUtilTest,
|
||||||
AssociateParamsFromFieldTrialConfigWithHardwareClassMatch) {
|
AssociateParamsFromFieldTrialConfigWithHardwareClassMatch) {
|
||||||
std::string hardware_class = ClientFilterableState::GetHardwareClass();
|
std::string hardware_class = ClientFilterableState::GetHardwareClass();
|
||||||
@ -1004,6 +1004,6 @@ TEST_F(FieldTrialUtilTest,
|
|||||||
|
|
||||||
EXPECT_EQ("TestGroup", base::FieldTrialList::FindFullName("TestTrial"));
|
EXPECT_EQ("TestGroup", base::FieldTrialList::FindFullName("TestTrial"));
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_ANDROID)
|
#endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
|
||||||
|
|
||||||
} // namespace variations
|
} // namespace variations
|
||||||
|
@ -41,7 +41,7 @@ GoogleGroupsManager::GoogleGroupsManager(
|
|||||||
// Register for preference changes.
|
// Register for preference changes.
|
||||||
pref_change_registrar_.Init(&source_prefs_.get());
|
pref_change_registrar_.Init(&source_prefs_.get());
|
||||||
pref_change_registrar_.Add(
|
pref_change_registrar_.Add(
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
variations::kOsDogfoodGroupsSyncPrefName,
|
variations::kOsDogfoodGroupsSyncPrefName,
|
||||||
#else
|
#else
|
||||||
variations::kDogfoodGroupsSyncPrefName,
|
variations::kDogfoodGroupsSyncPrefName,
|
||||||
@ -59,7 +59,7 @@ GoogleGroupsManager::~GoogleGroupsManager() = default;
|
|||||||
void GoogleGroupsManager::RegisterProfilePrefs(
|
void GoogleGroupsManager::RegisterProfilePrefs(
|
||||||
user_prefs::PrefRegistrySyncable* registry) {
|
user_prefs::PrefRegistrySyncable* registry) {
|
||||||
registry->RegisterListPref(
|
registry->RegisterListPref(
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
variations::kOsDogfoodGroupsSyncPrefName,
|
variations::kOsDogfoodGroupsSyncPrefName,
|
||||||
user_prefs::PrefRegistrySyncable::SYNCABLE_OS_PRIORITY_PREF
|
user_prefs::PrefRegistrySyncable::SYNCABLE_OS_PRIORITY_PREF
|
||||||
#else
|
#else
|
||||||
@ -129,7 +129,7 @@ void GoogleGroupsManager::OnSyncShutdown(syncer::SyncService* sync) {
|
|||||||
|
|
||||||
void GoogleGroupsManager::ClearSigninScopedState() {
|
void GoogleGroupsManager::ClearSigninScopedState() {
|
||||||
source_prefs_->ClearPref(
|
source_prefs_->ClearPref(
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
variations::kOsDogfoodGroupsSyncPrefName
|
variations::kOsDogfoodGroupsSyncPrefName
|
||||||
#else
|
#else
|
||||||
variations::kDogfoodGroupsSyncPrefName
|
variations::kDogfoodGroupsSyncPrefName
|
||||||
@ -147,7 +147,7 @@ void GoogleGroupsManager::UpdateGoogleGroups() {
|
|||||||
base::Value::Dict& target_prefs_dict = target_prefs_update.Get();
|
base::Value::Dict& target_prefs_dict = target_prefs_update.Get();
|
||||||
|
|
||||||
const base::Value::List& source_list = source_prefs_->GetList(
|
const base::Value::List& source_list = source_prefs_->GetList(
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
variations::kOsDogfoodGroupsSyncPrefName
|
variations::kOsDogfoodGroupsSyncPrefName
|
||||||
#else
|
#else
|
||||||
variations::kDogfoodGroupsSyncPrefName
|
variations::kDogfoodGroupsSyncPrefName
|
||||||
|
@ -10,7 +10,7 @@ namespace variations {
|
|||||||
// gaia IDs for a given syncing user.
|
// gaia IDs for a given syncing user.
|
||||||
// The variables below are the pref name, and the key for the gaia ID within
|
// The variables below are the pref name, and the key for the gaia ID within
|
||||||
// the dictionary value.
|
// the dictionary value.
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
inline constexpr char kOsDogfoodGroupsSyncPrefName[] = "sync.os_dogfood_groups";
|
inline constexpr char kOsDogfoodGroupsSyncPrefName[] = "sync.os_dogfood_groups";
|
||||||
#else
|
#else
|
||||||
inline constexpr char kDogfoodGroupsSyncPrefName[] = "sync.dogfood_groups";
|
inline constexpr char kDogfoodGroupsSyncPrefName[] = "sync.dogfood_groups";
|
||||||
|
@ -36,7 +36,7 @@ class GoogleGroupsManagerTest : public ::testing::Test {
|
|||||||
pref_groups_list.Append(std::move(group_dict));
|
pref_groups_list.Append(std::move(group_dict));
|
||||||
}
|
}
|
||||||
source_prefs_.SetList(
|
source_prefs_.SetList(
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
variations::kOsDogfoodGroupsSyncPrefName,
|
variations::kOsDogfoodGroupsSyncPrefName,
|
||||||
#else
|
#else
|
||||||
variations::kDogfoodGroupsSyncPrefName,
|
variations::kDogfoodGroupsSyncPrefName,
|
||||||
@ -59,7 +59,7 @@ class GoogleGroupsManagerTest : public ::testing::Test {
|
|||||||
void CheckSourcePrefCleared() {
|
void CheckSourcePrefCleared() {
|
||||||
EXPECT_TRUE(source_prefs_
|
EXPECT_TRUE(source_prefs_
|
||||||
.GetList(
|
.GetList(
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
variations::kOsDogfoodGroupsSyncPrefName
|
variations::kOsDogfoodGroupsSyncPrefName
|
||||||
#else
|
#else
|
||||||
variations::kDogfoodGroupsSyncPrefName
|
variations::kDogfoodGroupsSyncPrefName
|
||||||
|
@ -94,7 +94,7 @@ std::string GetPlatformString() {
|
|||||||
return "ios";
|
return "ios";
|
||||||
#elif BUILDFLAG(IS_MAC)
|
#elif BUILDFLAG(IS_MAC)
|
||||||
return "mac";
|
return "mac";
|
||||||
#elif BUILDFLAG(IS_CHROMEOS_ASH)
|
#elif BUILDFLAG(IS_CHROMEOS)
|
||||||
return "chromeos";
|
return "chromeos";
|
||||||
#elif BUILDFLAG(IS_ANDROID)
|
#elif BUILDFLAG(IS_ANDROID)
|
||||||
return "android";
|
return "android";
|
||||||
@ -252,7 +252,7 @@ std::unique_ptr<SeedResponse> MaybeImportFirstRunSeed(
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// This is a utility which syncs the policy-managed value of
|
// This is a utility which syncs the policy-managed value of
|
||||||
// |prefs::kDeviceVariationsRestrictionsByPolicy| into
|
// |prefs::kDeviceVariationsRestrictionsByPolicy| into
|
||||||
// |prefs::kVariationsRestrictionsByPolicy|.
|
// |prefs::kVariationsRestrictionsByPolicy|.
|
||||||
@ -329,7 +329,7 @@ class DeviceVariationsRestrictionByPolicyApplicator {
|
|||||||
base::WeakPtrFactory<DeviceVariationsRestrictionByPolicyApplicator>
|
base::WeakPtrFactory<DeviceVariationsRestrictionByPolicyApplicator>
|
||||||
weak_ptr_factory_{this};
|
weak_ptr_factory_{this};
|
||||||
};
|
};
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
VariationsService::VariationsService(
|
VariationsService::VariationsService(
|
||||||
std::unique_ptr<VariationsServiceClient> client,
|
std::unique_ptr<VariationsServiceClient> client,
|
||||||
@ -372,7 +372,7 @@ VariationsService::VariationsService(
|
|||||||
DCHECK(client_);
|
DCHECK(client_);
|
||||||
DCHECK(resource_request_allowed_notifier_);
|
DCHECK(resource_request_allowed_notifier_);
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
device_variations_restrictions_by_policy_applicator_ =
|
device_variations_restrictions_by_policy_applicator_ =
|
||||||
std::make_unique<DeviceVariationsRestrictionByPolicyApplicator>(
|
std::make_unique<DeviceVariationsRestrictionByPolicyApplicator>(
|
||||||
policy_pref_service_);
|
policy_pref_service_);
|
||||||
@ -516,7 +516,7 @@ GURL VariationsService::GetVariationsServerURL(HttpOptions http_options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VariationsService::EnsureLocaleEquals(const std::string& locale) {
|
void VariationsService::EnsureLocaleEquals(const std::string& locale) {
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
// Chrome OS may switch language on the fly.
|
// Chrome OS may switch language on the fly.
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
|
@ -58,7 +58,7 @@ class VariationsSeed;
|
|||||||
|
|
||||||
namespace variations {
|
namespace variations {
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
class DeviceVariationsRestrictionByPolicyApplicator;
|
class DeviceVariationsRestrictionByPolicyApplicator;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ class VariationsService
|
|||||||
// server url.
|
// server url.
|
||||||
std::string osname_server_param_override_;
|
std::string osname_server_param_override_;
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
std::unique_ptr<DeviceVariationsRestrictionByPolicyApplicator>
|
std::unique_ptr<DeviceVariationsRestrictionByPolicyApplicator>
|
||||||
device_variations_restrictions_by_policy_applicator_;
|
device_variations_restrictions_by_policy_applicator_;
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "components/variations/synthetic_trials.h"
|
#include "components/variations/synthetic_trials.h"
|
||||||
#include "components/variations/variations_switches.h"
|
#include "components/variations/variations_switches.h"
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
#include "base/task/thread_pool.h"
|
#include "base/task/thread_pool.h"
|
||||||
#include "components/variations/variations_crash_keys_chromeos.h"
|
#include "components/variations/variations_crash_keys_chromeos.h"
|
||||||
#endif
|
#endif
|
||||||
@ -105,11 +105,11 @@ class VariationsCrashKeys final : public base::FieldTrialList::Observer {
|
|||||||
// observer calls that happen on a different thread.
|
// observer calls that happen on a different thread.
|
||||||
scoped_refptr<base::SequencedTaskRunner> ui_thread_task_runner_;
|
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
|
// Task runner corresponding to a background thread, used for tasks that may
|
||||||
// block.
|
// block.
|
||||||
scoped_refptr<base::SequencedTaskRunner> background_thread_task_runner_;
|
scoped_refptr<base::SequencedTaskRunner> background_thread_task_runner_;
|
||||||
#endif // IS_CHROMEOS_ASH
|
#endif // IS_CHROMEOS
|
||||||
|
|
||||||
// A serialized string containing the variations state.
|
// A serialized string containing the variations state.
|
||||||
std::string variations_string_;
|
std::string variations_string_;
|
||||||
@ -149,10 +149,10 @@ VariationsCrashKeys::VariationsCrashKeys() {
|
|||||||
for (const auto& entry : active_groups) {
|
for (const auto& entry : active_groups) {
|
||||||
AppendFieldTrial(entry.trial_name, entry.group_name, entry.is_overridden);
|
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(
|
background_thread_task_runner_ = base::ThreadPool::CreateSequencedTaskRunner(
|
||||||
{base::TaskPriority::BEST_EFFORT, base::MayBlock()});
|
{base::TaskPriority::BEST_EFFORT, base::MayBlock()});
|
||||||
#endif // IS_CHROMEOS_ASH
|
#endif // IS_CHROMEOS
|
||||||
|
|
||||||
UpdateCrashKeys();
|
UpdateCrashKeys();
|
||||||
}
|
}
|
||||||
@ -252,9 +252,9 @@ void VariationsCrashKeys::UpdateCrashKeys() {
|
|||||||
variations::switches::kVariationsSeedVersion));
|
variations::switches::kVariationsSeedVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
ReportVariationsToChromeOs(background_thread_task_runner_, info);
|
ReportVariationsToChromeOs(background_thread_task_runner_, info);
|
||||||
#endif // IS_CHROMEOS_ASH
|
#endif // IS_CHROMEOS
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariationsCrashKeys::OnSyntheticTrialsChanged(
|
void VariationsCrashKeys::OnSyntheticTrialsChanged(
|
||||||
|
@ -18,9 +18,9 @@ namespace variations {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Path where we put variations in cryptohome.
|
// Path where we put variations in cryptohome.
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
constexpr char kCrashVariationsFileName[] = ".variations-list.txt";
|
constexpr char kCrashVariationsFileName[] = ".variations-list.txt";
|
||||||
#endif // IS_CHROMEOS_ASH
|
#endif // IS_CHROMEOS
|
||||||
|
|
||||||
void WriteVariationsToFile(ExperimentListInfo info) {
|
void WriteVariationsToFile(ExperimentListInfo info) {
|
||||||
std::string combined_string = base::StrCat(
|
std::string combined_string = base::StrCat(
|
||||||
|
@ -38,11 +38,11 @@
|
|||||||
#include "components/variations/metrics.h"
|
#include "components/variations/metrics.h"
|
||||||
#endif // BUILDFLAG(IS_ANDROID)
|
#endif // BUILDFLAG(IS_ANDROID)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
#include "base/functional/callback.h"
|
#include "base/functional/callback.h"
|
||||||
#include "chromeos/ash/components/dbus/featured/featured.pb.h"
|
#include "chromeos/ash/components/dbus/featured/featured.pb.h"
|
||||||
#include "chromeos/ash/components/dbus/featured/featured_client.h"
|
#include "chromeos/ash/components/dbus/featured/featured_client.h"
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_IOS)
|
#if BUILDFLAG(IS_IOS)
|
||||||
#include "components/variations/metrics.h"
|
#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.
|
// The maximum size of an uncompressed seed at 50 MiB.
|
||||||
constexpr std::size_t kMaxUncompressedSeedSize = 50 * 1024 * 1024;
|
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
|
// Number of attempts to send the safe seed from Chrome to CrOS platforms before
|
||||||
// giving up.
|
// giving up.
|
||||||
constexpr int kSendPlatformSafeSeedMaxAttempts = 2;
|
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.
|
// The name of the seed file that stores the latest seed data.
|
||||||
const base::FilePath::CharType kSeedFilename[] =
|
const base::FilePath::CharType kSeedFilename[] =
|
||||||
@ -813,7 +813,7 @@ void VariationsSeedStore::StoreValidatedSafeSeed(
|
|||||||
}
|
}
|
||||||
safe_seed_store_->SetFetchTime(seed_fetch_time);
|
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
|
// `SendSafeSeedToPlatform` will send the safe seed at most twice and should
|
||||||
// only be called if the seed is successfully validated.
|
// only be called if the seed is successfully validated.
|
||||||
// This is a best effort attempt and it is possible that the safe seed for
|
// 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;
|
send_seed_to_platform_attempts_ = 0;
|
||||||
SendSafeSeedToPlatform(GetSafeSeedStateForPlatform(
|
SendSafeSeedToPlatform(GetSafeSeedStateForPlatform(
|
||||||
seed, seed_milestone, client_state, seed_fetch_time));
|
seed, seed_milestone, client_state, seed_fetch_time));
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@ -959,7 +959,7 @@ bool VariationsSeedStore::ApplyDeltaPatch(const std::string& existing_data,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
featured::SeedDetails VariationsSeedStore::GetSafeSeedStateForPlatform(
|
featured::SeedDetails VariationsSeedStore::GetSafeSeedStateForPlatform(
|
||||||
const ValidatedSeed& seed,
|
const ValidatedSeed& seed,
|
||||||
const int seed_milestone,
|
const int seed_milestone,
|
||||||
@ -1002,6 +1002,6 @@ void VariationsSeedStore::SendSafeSeedToPlatform(
|
|||||||
weak_ptr_factory_.GetWeakPtr(), safe_seed));
|
weak_ptr_factory_.GetWeakPtr(), safe_seed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
} // namespace variations
|
} // namespace variations
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
#include "components/variations/seed_response.h"
|
#include "components/variations/seed_response.h"
|
||||||
#include "components/variations/variations_safe_seed_store.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"
|
#include "chromeos/ash/components/dbus/featured/featured.pb.h"
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
class PrefService;
|
class PrefService;
|
||||||
class PrefRegistrySimple;
|
class PrefRegistrySimple;
|
||||||
@ -403,7 +403,7 @@ class COMPONENT_EXPORT(VARIATIONS) VariationsSeedStore {
|
|||||||
// Handles reads and writes to seed files.
|
// Handles reads and writes to seed files.
|
||||||
std::unique_ptr<SeedReaderWriter> seed_reader_writer_;
|
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
|
// Gets the combined server and client state used for early boot variations
|
||||||
// platform disaster recovery.
|
// platform disaster recovery.
|
||||||
featured::SeedDetails GetSafeSeedStateForPlatform(
|
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
|
// A counter that keeps track of how many times the current safe seed is sent
|
||||||
// to platform.
|
// to platform.
|
||||||
size_t send_seed_to_platform_attempts_ = 0;
|
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
|
// Note: This should remain the last member so it'll be destroyed and
|
||||||
// invalidate its weak pointers before any other members are destroyed.
|
// invalidate its weak pointers before any other members are destroyed.
|
||||||
|
@ -41,10 +41,10 @@
|
|||||||
#include "components/variations/android/variations_seed_bridge.h"
|
#include "components/variations/android/variations_seed_bridge.h"
|
||||||
#endif // BUILDFLAG(IS_ANDROID)
|
#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/fake_featured_client.h"
|
||||||
#include "chromeos/ash/components/dbus/featured/featured.pb.h"
|
#include "chromeos/ash/components/dbus/featured/featured.pb.h"
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
namespace variations {
|
namespace variations {
|
||||||
namespace {
|
namespace {
|
||||||
@ -2140,7 +2140,7 @@ TEST_P(VariationsSeedStoreFirstRunPrefsTest, FirstRunPrefsAllowed) {
|
|||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_ANDROID)
|
#endif // BUILDFLAG(IS_ANDROID)
|
||||||
|
|
||||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
#if BUILDFLAG(IS_CHROMEOS)
|
||||||
const featured::SeedDetails CreateDummySafeSeed(
|
const featured::SeedDetails CreateDummySafeSeed(
|
||||||
ClientFilterableState* client_state,
|
ClientFilterableState* client_state,
|
||||||
base::Time fetch_time_to_store) {
|
base::Time fetch_time_to_store) {
|
||||||
@ -2311,6 +2311,6 @@ TEST_P(StoreSafeSeedDataAllGroupsTest, SendSafeSeedToPlatform_FailTwoAttempts) {
|
|||||||
|
|
||||||
ash::featured::FeaturedClient::Shutdown();
|
ash::featured::FeaturedClient::Shutdown();
|
||||||
}
|
}
|
||||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||||
|
|
||||||
} // namespace variations
|
} // namespace variations
|
||||||
|
Reference in New Issue
Block a user