Commit f8065c2e authored by A Olsen's avatar A Olsen Committed by Commit Bot

Update strings for password expiry notification in line with mocks

Bug: 930109
Change-Id: I82f98f11719978ba7944351383c456bc5e60f9b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1692750Reviewed-by: default avatarAchuith Bhandarkar <achuith@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: A Olsen <olsen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#675711}
parent 29c89bf2
......@@ -78,7 +78,7 @@ const base::NoDestructor<GURL> kEmptyOriginUrl;
const int kCriticalWarningDays = 3;
base::string16 GetTitleText(int less_than_n_days) {
return l10n_util::GetPluralStringFUTF16(IDS_PASSWORD_EXPIRY_DAYS_BODY,
return l10n_util::GetPluralStringFUTF16(IDS_PASSWORD_EXPIRY_DAYS_TITLE,
less_than_n_days);
}
......
......@@ -104,10 +104,8 @@ TEST_F(SamlPasswordExpiryNotificationTest, ShowAlreadyExpired) {
ShowSamlPasswordExpiryNotification(profile_, 0);
ASSERT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password has expired!"),
Notification()->title());
EXPECT_EQ(utf16("Please choose a new password immediately"),
Notification()->message());
EXPECT_EQ(utf16("Password is expired"), Notification()->title());
EXPECT_EQ(utf16("Choose a new one immediately"), Notification()->message());
DismissSamlPasswordExpiryNotification(profile_);
EXPECT_FALSE(Notification().has_value());
......@@ -117,10 +115,9 @@ TEST_F(SamlPasswordExpiryNotificationTest, ShowWillSoonExpire) {
ShowSamlPasswordExpiryNotification(profile_, 14);
ASSERT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password will expire in less than 14 days!"),
EXPECT_EQ(utf16("Password expires in less than 14 days"),
Notification()->title());
EXPECT_EQ(utf16("Please choose a new password now"),
Notification()->message());
EXPECT_EQ(utf16("Choose a new one now"), Notification()->message());
DismissSamlPasswordExpiryNotification(profile_);
EXPECT_FALSE(Notification().has_value());
......@@ -151,8 +148,7 @@ TEST_F(SamlPasswordExpiryNotificationTest, MaybeShow_AlreadyExpired) {
// Notification is shown immediately since password has expired.
EXPECT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password has expired!"),
Notification()->title());
EXPECT_EQ(utf16("Password is expired"), Notification()->title());
}
TEST_F(SamlPasswordExpiryNotificationTest, MaybeShow_WillSoonExpire) {
......@@ -161,7 +157,7 @@ TEST_F(SamlPasswordExpiryNotificationTest, MaybeShow_WillSoonExpire) {
// Notification is shown immediately since password will soon expire.
EXPECT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password will expire in less than 7 days!"),
EXPECT_EQ(utf16("Password expires in less than 7 days"),
Notification()->title());
}
......@@ -175,7 +171,7 @@ TEST_F(SamlPasswordExpiryNotificationTest, MaybeShow_WillEventuallyExpire) {
// But, it will be shown once we are in the advance warning window:
test_environment_.FastForwardBy(kOneYear + kOneHour);
EXPECT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password will expire in less than 14 days!"),
EXPECT_EQ(utf16("Password expires in less than 14 days"),
Notification()->title());
}
......@@ -198,7 +194,7 @@ TEST_F(SamlPasswordExpiryNotificationTest, MaybeShow_PasswordChanged) {
// Notification is shown immediately since password will soon expire.
EXPECT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password will expire in less than 7 days!"),
EXPECT_EQ(utf16("Password expires in less than 7 days"),
Notification()->title());
// Password is changed and notification is dismissed.
......@@ -243,32 +239,26 @@ TEST_F(SamlPasswordExpiryNotificationTest, TimePasses_NoUserActionTaken) {
// But the next day, the notification is shown.
test_environment_.FastForwardBy(kOneDay);
EXPECT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password will expire in less than 14 days!"),
EXPECT_EQ(utf16("Password expires in less than 14 days"),
Notification()->title());
EXPECT_EQ(utf16("Please choose a new password now"),
Notification()->message());
EXPECT_EQ(utf16("Choose a new one now"), Notification()->message());
// As time passes, the notification updates each day.
test_environment_.FastForwardBy(kAdvanceWarningTime / 2);
EXPECT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password will expire in less than 7 days!"),
EXPECT_EQ(utf16("Password expires in less than 7 days"),
Notification()->title());
EXPECT_EQ(utf16("Please choose a new password now"),
Notification()->message());
EXPECT_EQ(utf16("Choose a new one now"), Notification()->message());
test_environment_.FastForwardBy(kAdvanceWarningTime / 2);
EXPECT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password has expired!"),
Notification()->title());
EXPECT_EQ(utf16("Please choose a new password immediately"),
Notification()->message());
EXPECT_EQ(utf16("Password is expired"), Notification()->title());
EXPECT_EQ(utf16("Choose a new one immediately"), Notification()->message());
test_environment_.FastForwardBy(kOneYear);
EXPECT_TRUE(Notification().has_value());
EXPECT_EQ(utf16("Your current password has expired!"),
Notification()->title());
EXPECT_EQ(utf16("Please choose a new password immediately"),
Notification()->message());
EXPECT_EQ(utf16("Password is expired"), Notification()->title());
EXPECT_EQ(utf16("Choose a new one immediately"), Notification()->message());
}
TEST_F(SamlPasswordExpiryNotificationTest, TimePasses_NotificationDismissed) {
......
......@@ -306,7 +306,7 @@ UrgentPasswordExpiryNotificationUI::UrgentPasswordExpiryNotificationUI(
base::StringToInt(url_suffix, &less_than_n_days);
less_than_n_days = std::max(less_than_n_days, 0);
const base::string16 title = l10n_util::GetPluralStringFUTF16(
IDS_PASSWORD_EXPIRY_DAYS_BODY, less_than_n_days);
IDS_PASSWORD_EXPIRY_DAYS_TITLE, less_than_n_days);
source->AddString("title", title);
static constexpr LocalizedString kLocalizedStrings[] = {
......
......@@ -186,17 +186,17 @@ Try tapping the mic to ask me anything.
</message>
<!-- Password expiry notifications -->
<message name="IDS_PASSWORD_EXPIRY_DAYS_BODY" desc="Message body for a notification that tells the user their password will expire in less than some number of days (where 0 days means it has expired).">
<message name="IDS_PASSWORD_EXPIRY_DAYS_TITLE" desc="Message title for a notification that tells the user their password will expire in less than some number of days (where 0 days means it has expired).">
{NUM_DAYS, plural,
=0 {Your current password has expired!}
=1 {Your current password will expire in less than one day!}
other {Your current password will expire in less than # days!}}
=0 {Password is expired}
=1 {Password expires in less than one day}
other {Password expires in less than # days}}
</message>
<message name="IDS_PASSWORD_EXPIRY_CALL_TO_ACTION" desc="Message body on a notification that politely requests the user to choose a new password since their old password is expiring soon">
Please choose a new password now
<message name="IDS_PASSWORD_EXPIRY_CALL_TO_ACTION" desc="Message body on a notification that politely requests the user to choose a new password since their old password is expiring soon. (The title makes clear that the password is expiring.)">
Choose a new one now
</message>
<message name="IDS_PASSWORD_EXPIRY_CALL_TO_ACTION_CRITICAL" desc="Message body on a notification that *URGENTLY* requests the user to choose a new password since their old password is expiring *VERY* soon">
Please choose a new password immediately
<message name="IDS_PASSWORD_EXPIRY_CALL_TO_ACTION_CRITICAL" desc="Message body on a notification that *URGENTLY* requests the user to choose a new password since their old password is expiring *VERY* soon. (The title makes clear that the password is expiring.)">
Choose a new one immediately
</message>
<message name="IDS_PASSWORD_EXPIRY_CHANGE_PASSWORD_BUTTON" desc="Text on a button that takes the user to page to change their password">
Change password
......
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