Commit 1e78e311 authored by Kush Sinha's avatar Kush Sinha Committed by Commit Bot

Enable crOS Account Manager by default

Chrome OS Account Manager has been enabled for 1% on Stable channel.
Enable it on ToT as preparation for 100% Stable ramp up.

TBR=droger@chromium.org

Bug: 816954
Change-Id: I6e0097237600e40c39a98e59af063deddd1da9a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761588Reviewed-by: default avatarKush Sinha <sinhak@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarAga Wronska <agawronska@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#689126}
parent 31bd0fdb
...@@ -43,7 +43,7 @@ TEST(AccountConsistencyModeManagerTest, DefaultValue) { ...@@ -43,7 +43,7 @@ TEST(AccountConsistencyModeManagerTest, DefaultValue) {
std::unique_ptr<TestingProfile> profile = std::unique_ptr<TestingProfile> profile =
BuildTestingProfile(/*is_new_profile=*/false); BuildTestingProfile(/*is_new_profile=*/false);
#if BUILDFLAG(ENABLE_MIRROR) #if BUILDFLAG(ENABLE_MIRROR) || defined(OS_CHROMEOS)
EXPECT_EQ(signin::AccountConsistencyMethod::kMirror, EXPECT_EQ(signin::AccountConsistencyMethod::kMirror,
AccountConsistencyModeManager::GetMethodForProfile(profile.get())); AccountConsistencyModeManager::GetMethodForProfile(profile.get()));
#elif BUILDFLAG(ENABLE_DICE_SUPPORT) #elif BUILDFLAG(ENABLE_DICE_SUPPORT)
...@@ -289,11 +289,26 @@ TEST(AccountConsistencyModeManagerTest, DiceOnlyForRegularProfile) { ...@@ -289,11 +289,26 @@ TEST(AccountConsistencyModeManagerTest, DiceOnlyForRegularProfile) {
#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) #endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
TEST(AccountConsistencyModeManagerTest, MirrorDisabledForNonUnicorn) { // Mirror is enabled by default on Chrome OS, unless specified otherwise.
TEST(AccountConsistencyModeManagerTest, MirrorEnabledByDefault) {
// Creation of this object sets the current thread's id as UI thread. // Creation of this object sets the current thread's id as UI thread.
content::BrowserTaskEnvironment task_environment; content::BrowserTaskEnvironment task_environment;
TestingProfile profile; TestingProfile profile;
EXPECT_TRUE(
AccountConsistencyModeManager::IsMirrorEnabledForProfile(&profile));
EXPECT_FALSE(
AccountConsistencyModeManager::IsDiceEnabledForProfile(&profile));
EXPECT_EQ(signin::AccountConsistencyMethod::kMirror,
AccountConsistencyModeManager::GetMethodForProfile(&profile));
}
TEST(AccountConsistencyModeManagerTest, MirrorDisabledForGuestSession) {
// Creation of this object sets the current thread's id as UI thread.
content::BrowserTaskEnvironment task_environment;
TestingProfile profile;
profile.SetGuestSession(true);
EXPECT_FALSE( EXPECT_FALSE(
AccountConsistencyModeManager::IsMirrorEnabledForProfile(&profile)); AccountConsistencyModeManager::IsMirrorEnabledForProfile(&profile));
EXPECT_FALSE( EXPECT_FALSE(
...@@ -302,6 +317,21 @@ TEST(AccountConsistencyModeManagerTest, MirrorDisabledForNonUnicorn) { ...@@ -302,6 +317,21 @@ TEST(AccountConsistencyModeManagerTest, MirrorDisabledForNonUnicorn) {
AccountConsistencyModeManager::GetMethodForProfile(&profile)); AccountConsistencyModeManager::GetMethodForProfile(&profile));
} }
TEST(AccountConsistencyModeManagerTest, MirrorDisabledForIncognitoProfile) {
// Creation of this object sets the current thread's id as UI thread.
content::BrowserTaskEnvironment task_environment;
TestingProfile profile;
Profile* incognito_profile = profile.GetOffTheRecordProfile();
EXPECT_FALSE(AccountConsistencyModeManager::IsMirrorEnabledForProfile(
incognito_profile));
EXPECT_FALSE(AccountConsistencyModeManager::IsDiceEnabledForProfile(
incognito_profile));
EXPECT_EQ(
signin::AccountConsistencyMethod::kDisabled,
AccountConsistencyModeManager::GetMethodForProfile(incognito_profile));
}
TEST(AccountConsistencyModeManagerTest, MirrorEnabledByPreference) { TEST(AccountConsistencyModeManagerTest, MirrorEnabledByPreference) {
// Creation of this object sets the current thread's id as UI thread. // Creation of this object sets the current thread's id as UI thread.
content::BrowserTaskEnvironment task_environment; content::BrowserTaskEnvironment task_environment;
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
namespace { namespace {
constexpr char kProfileSigninNotificationId[] = "chrome://settings/signin/"; constexpr char kProfileSigninNotificationId[] = "chrome://settings/signin/";
constexpr char kSecondaryAccountNotificationIdSuffix[] = "secondary-account"; constexpr char kSecondaryAccountNotificationIdSuffix[] = "/secondary-account";
void HandleDeviceAccountReauthNotificationClick( void HandleDeviceAccountReauthNotificationClick(
base::Optional<int> button_index) { base::Optional<int> button_index) {
...@@ -81,8 +81,7 @@ SigninErrorNotifier::SigninErrorNotifier(SigninErrorController* controller, ...@@ -81,8 +81,7 @@ SigninErrorNotifier::SigninErrorNotifier(SigninErrorController* controller,
device_account_notification_id_ = device_account_notification_id_ =
kProfileSigninNotificationId + profile->GetProfileUserName(); kProfileSigninNotificationId + profile->GetProfileUserName();
secondary_account_notification_id_ = secondary_account_notification_id_ =
std::string(kProfileSigninNotificationId) + device_account_notification_id_ + kSecondaryAccountNotificationIdSuffix;
kSecondaryAccountNotificationIdSuffix;
error_controller_->AddObserver(this); error_controller_->AddObserver(this);
OnErrorChanged(); OnErrorChanged();
......
...@@ -33,7 +33,10 @@ const char kTestEmail[] = "email@example.com"; ...@@ -33,7 +33,10 @@ const char kTestEmail[] = "email@example.com";
// Notification ID corresponding to kProfileSigninNotificationId + // Notification ID corresponding to kProfileSigninNotificationId +
// kTestAccountId. // kTestAccountId.
const char kNotificationId[] = "chrome://settings/signin/testing_profile"; const char kPrimaryAccountErrorNotificationId[] =
"chrome://settings/signin/testing_profile";
const char kSecondaryAccountErrorNotificationId[] =
"chrome://settings/signin/testing_profile/secondary-account";
class SigninErrorNotifierTest : public BrowserWithTestWindowTest { class SigninErrorNotifierTest : public BrowserWithTestWindowTest {
public: public:
...@@ -84,7 +87,10 @@ class SigninErrorNotifierTest : public BrowserWithTestWindowTest { ...@@ -84,7 +87,10 @@ class SigninErrorNotifierTest : public BrowserWithTestWindowTest {
}; };
TEST_F(SigninErrorNotifierTest, NoNotification) { TEST_F(SigninErrorNotifierTest, NoNotification) {
EXPECT_FALSE(display_service_->GetNotification(kNotificationId)); EXPECT_FALSE(
display_service_->GetNotification(kPrimaryAccountErrorNotificationId));
EXPECT_FALSE(
display_service_->GetNotification(kSecondaryAccountErrorNotificationId));
} }
// Verify that if Supervision has just been added for the current user // Verify that if Supervision has just been added for the current user
...@@ -105,32 +111,55 @@ TEST_F(SigninErrorNotifierTest, NoNotificationAfterAddSupervisionEnabled) { ...@@ -105,32 +111,55 @@ TEST_F(SigninErrorNotifierTest, NoNotificationAfterAddSupervisionEnabled) {
identity_test_env()->identity_manager()->GetPrimaryAccountId(), identity_test_env()->identity_manager()->GetPrimaryAccountId(),
GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
EXPECT_FALSE(display_service_->GetNotification(kNotificationId)); EXPECT_FALSE(
display_service_->GetNotification(kPrimaryAccountErrorNotificationId));
} }
TEST_F(SigninErrorNotifierTest, ErrorReset) { TEST_F(SigninErrorNotifierTest, ErrorResetForPrimaryAccount) {
EXPECT_FALSE(display_service_->GetNotification(kNotificationId)); EXPECT_FALSE(
display_service_->GetNotification(kPrimaryAccountErrorNotificationId));
std::string account_id = std::string account_id =
identity_test_env()->MakeAccountAvailable(kTestEmail).account_id; identity_test_env()->MakePrimaryAccountAvailable(kTestEmail).account_id;
SetAuthError( SetAuthError(
account_id, account_id,
GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
EXPECT_TRUE(display_service_->GetNotification(kNotificationId)); EXPECT_TRUE(
display_service_->GetNotification(kPrimaryAccountErrorNotificationId));
SetAuthError(account_id, GoogleServiceAuthError::AuthErrorNone()); SetAuthError(account_id, GoogleServiceAuthError::AuthErrorNone());
EXPECT_FALSE(display_service_->GetNotification(kNotificationId)); EXPECT_FALSE(
display_service_->GetNotification(kPrimaryAccountErrorNotificationId));
} }
TEST_F(SigninErrorNotifierTest, ErrorTransition) { TEST_F(SigninErrorNotifierTest, ErrorResetForSecondaryAccount) {
EXPECT_FALSE(
display_service_->GetNotification(kSecondaryAccountErrorNotificationId));
std::string account_id = std::string account_id =
identity_test_env()->MakeAccountAvailable(kTestEmail).account_id; identity_test_env()->MakeAccountAvailable(kTestEmail).account_id;
SetAuthError( SetAuthError(
account_id, account_id,
GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
// Uses the run loop from |BrowserTaskEnvironment|.
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(
display_service_->GetNotification(kSecondaryAccountErrorNotificationId));
SetAuthError(account_id, GoogleServiceAuthError::AuthErrorNone());
EXPECT_FALSE(
display_service_->GetNotification(kSecondaryAccountErrorNotificationId));
}
TEST_F(SigninErrorNotifierTest, ErrorTransitionForPrimaryAccount) {
std::string account_id =
identity_test_env()->MakePrimaryAccountAvailable(kTestEmail).account_id;
SetAuthError(
account_id,
GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
base::Optional<message_center::Notification> notification = base::Optional<message_center::Notification> notification =
display_service_->GetNotification(kNotificationId); display_service_->GetNotification(kPrimaryAccountErrorNotificationId);
ASSERT_TRUE(notification); ASSERT_TRUE(notification);
base::string16 message = notification->message(); base::string16 message = notification->message();
EXPECT_FALSE(message.empty()); EXPECT_FALSE(message.empty());
...@@ -140,7 +169,8 @@ TEST_F(SigninErrorNotifierTest, ErrorTransition) { ...@@ -140,7 +169,8 @@ TEST_F(SigninErrorNotifierTest, ErrorTransition) {
GoogleServiceAuthError( GoogleServiceAuthError(
GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE)); GoogleServiceAuthError::UNEXPECTED_SERVICE_RESPONSE));
notification = display_service_->GetNotification(kNotificationId); notification =
display_service_->GetNotification(kPrimaryAccountErrorNotificationId);
ASSERT_TRUE(notification); ASSERT_TRUE(notification);
base::string16 new_message = notification->message(); base::string16 new_message = notification->message();
EXPECT_FALSE(new_message.empty()); EXPECT_FALSE(new_message.empty());
...@@ -170,13 +200,13 @@ TEST_F(SigninErrorNotifierTest, AuthStatusEnumerateAllErrors) { ...@@ -170,13 +200,13 @@ TEST_F(SigninErrorNotifierTest, AuthStatusEnumerateAllErrors) {
GoogleServiceAuthError::kDeprecatedStateCount, GoogleServiceAuthError::kDeprecatedStateCount,
"table size should match number of auth error types"); "table size should match number of auth error types");
std::string account_id = std::string account_id =
identity_test_env()->MakeAccountAvailable(kTestEmail).account_id; identity_test_env()->MakePrimaryAccountAvailable(kTestEmail).account_id;
for (size_t i = 0; i < base::size(table); ++i) { for (size_t i = 0; i < base::size(table); ++i) {
SetAuthError(account_id, GoogleServiceAuthError(table[i].error_state)); SetAuthError(account_id, GoogleServiceAuthError(table[i].error_state));
base::Optional<message_center::Notification> notification = base::Optional<message_center::Notification> notification =
display_service_->GetNotification(kNotificationId); display_service_->GetNotification(kPrimaryAccountErrorNotificationId);
ASSERT_EQ(table[i].is_error, !!notification); ASSERT_EQ(table[i].is_error, !!notification) << "Failed case #" << i;
if (table[i].is_error) { if (table[i].is_error) {
EXPECT_FALSE(notification->title().empty()); EXPECT_FALSE(notification->title().empty());
EXPECT_FALSE(notification->message().empty()); EXPECT_FALSE(notification->message().empty());
......
...@@ -383,6 +383,10 @@ class SupervisedUserServiceExtensionTestBase ...@@ -383,6 +383,10 @@ class SupervisedUserServiceExtensionTestBase
CreateDefaultInitParams(); CreateDefaultInitParams();
params.profile_is_supervised = is_supervised_; params.profile_is_supervised = is_supervised_;
InitializeExtensionService(params); InitializeExtensionService(params);
// Flush the message loop, to ensure that credentials have been loaded in
// Identity Manager.
base::RunLoop().RunUntilIdle();
SupervisedUserService* service = SupervisedUserService* service =
SupervisedUserServiceFactory::GetForProfile(profile_.get()); SupervisedUserServiceFactory::GetForProfile(profile_.get());
service->Init(); service->Init();
......
...@@ -19,7 +19,7 @@ const base::Feature kInstantTetheringBackgroundAdvertisementSupport{ ...@@ -19,7 +19,7 @@ const base::Feature kInstantTetheringBackgroundAdvertisementSupport{
// Controls whether to enable Chrome OS Account Manager. // Controls whether to enable Chrome OS Account Manager.
// Rollout controlled by Finch. // Rollout controlled by Finch.
const base::Feature kAccountManager{"ChromeOSAccountManager", const base::Feature kAccountManager{"ChromeOSAccountManager",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether to enable Ambient mode feature. // Controls whether to enable Ambient mode feature.
const base::Feature kAmbientModeFeature{"ChromeOSAmbientMode", const base::Feature kAmbientModeFeature{"ChromeOSAmbientMode",
......
...@@ -2173,21 +2173,6 @@ ...@@ -2173,21 +2173,6 @@
] ]
} }
], ],
"EnableChromeOSAccountManager": [
{
"platforms": [
"chromeos"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"ChromeOSAccountManager"
]
}
]
}
],
"EnableCsrssLockdown": [ "EnableCsrssLockdown": [
{ {
"platforms": [ "platforms": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment