Commit 42f9cdd4 authored by Rainhard Findling's avatar Rainhard Findling Committed by Commit Bot

Safety check UI: reuse password check strings

* Safety check password check reuses the newly introducted strings
  for password check, instead of introducing separate strings.

Bug: 1015841
Change-Id: I7ad111f1ef7b57b8e5df1073e8c84221e60f5be9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132455Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Rainhard Findling <rainhard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756293}
parent 066c86f5
......@@ -86,6 +86,8 @@
<message name="IDS_SETTINGS_SIGNIN_ALLOWED_DESC" desc="The description of the preference to allow to sign-in to Chrome">
By turning this off, you can sign in to Google sites like Gmail without signing in to Chromium
</message>
<!-- Safety check -->
<message name="IDS_SETTINGS_SAFETY_CHECK_PARENT_PRIMARY_LABEL_BEFORE" desc="This text describes what the safety check is. (It's an area of the Settings page where users can quickly check whether their safety-related settings are fully protecting them.)">
Chromium can help keep you safe from data breaches, bad extensions, and more
</message>
......@@ -95,21 +97,9 @@
<message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED" desc="This text describes that Chromium cannot update due to an unknown error.">
Chromium didn't update, something went wrong. <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1"&gt;</ph>Fix Chromium update problems and failed updates.<ph name="END_LINK">&lt;/a&gt;</ph>
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_OFFLINE" desc="This text points out that the password check cannot run due to not having internet connection.">
Chromium can't check your passwords. Try checking your internet connection.
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SIGNED_OUT" desc="This text points out that the password check can only run when the user is signed in.">
Chromium can't check your passwords because you're not signed in
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_QUOTA_LIMIT" desc="This text points out that the password check cannot run and that the user should try again tomorrow.">
Chromium can't check all your passwords. Try again after 24 hours.
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_TOO_MANY_PASSWORDS" desc="This text points out that the password check cannot run due to the user having too many saved passwords.">
Chromium can't check your passwords because there are too many
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_ERROR" desc="This text points out that the password check encountered an unknown error.">
Chromium can't check your passwords. Try again later.
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_SAFE_BROWSING_DISABLED" desc="This text points out that Safe Browsing is disabled and that the user is not protected.">
Safe Browsing is off. Chromium recommends turning it on.
</message>
......
......@@ -86,6 +86,8 @@
<message name="IDS_SETTINGS_SIGNIN_ALLOWED_DESC" desc="The description of the preference to allow to sign-in to Chrome">
By turning this off, you can sign in to Google sites like Gmail without signing in to Chrome
</message>
<!-- Safety check -->
<message name="IDS_SETTINGS_SAFETY_CHECK_PARENT_PRIMARY_LABEL_BEFORE" desc="This text describes what the safety check is. (It's an area of the Settings page where users can quickly check whether their safety-related settings are fully protecting them.)">
Chrome can help keep you safe from data breaches, bad extensions, and more
</message>
......@@ -95,21 +97,9 @@
<message name="IDS_SETTINGS_SAFETY_CHECK_UPDATES_FAILED" desc="This text describes that Chrome cannot update due to an unknown error.">
Chrome didn't update, something went wrong. <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1"&gt;</ph>Fix Chrome update problems and failed updates.<ph name="END_LINK">&lt;/a&gt;</ph>
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_OFFLINE" desc="This text points out that the password check cannot run due to not having internet connection.">
Chrome can't check your passwords. Try checking your internet connection.
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SIGNED_OUT" desc="This text points out that the password check can only run when the user is signed in.">
Chrome can't check your passwords because you're not signed in
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_QUOTA_LIMIT" desc="This text points out that the password check cannot run and that the user should try again tomorrow.">
Chrome can't check all your passwords. Try again after 24 hours.
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_TOO_MANY_PASSWORDS" desc="This text points out that the password check cannot run due to the user having too many saved passwords.">
Chrome can't check your passwords because there are too many
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_ERROR" desc="This text points out that the password check encountered an unknown error.">
Chrome can't check your passwords. Try again later.
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_SAFE_BROWSING_DISABLED" desc="This text points out that Safe Browsing is disabled and that the user is not protected.">
Safe Browsing is off. Chrome recommends turning it on.
</message>
......
......@@ -1608,6 +1608,8 @@
<message name="IDS_SETTINGS_PRIVACY_MORE" desc="Label on the expansion button to show more privacy settings.">
More
</message>
<!-- Safety check -->
<message name="IDS_SETTINGS_SAFETY_CHECK_SECTION_TITLE" desc="'Safety check' is a noun phrase (sentence case). 'Safety check' refers to an area of the Settings page where users can quickly check whether their safety-related settings are fully protecting them.">
Safety check
</message>
......@@ -1677,20 +1679,6 @@
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_PRIMARY_LABEL" desc="'Passwords' is an element in safety check that allows users to check for their passwords being compromised.">
Passwords
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_PROGRESS" desc="This text describes the progress of the safety check password check.">
<ph name="DONE">$1<ex>3</ex></ph>/<ph name="TOTAL">$2<ex>20</ex></ph> passwords checked...
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SAFE" desc="This text points out that the safety check password check has not found any compromised passwords.">
No compromised passwords found
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_COMPROMISED" desc="This text points out that the safety check password check has found compromised passwords. The placeholder will be a numeral.">
{NUM_PASSWORDS, plural,
=1 {1 compromised password}
other {{NUM_PASSWORDS} compromised passwords}}
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_NO_PASSWORDS" desc="This text points out that password check cannot run due to the user not having saved passwords.">
No saved passwords
</message>
<message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_BUTTON" desc="This button allows users to change their compromised passwords.">
{NUM_PASSWORDS, plural,
=1 {Change password}
......
......@@ -368,37 +368,39 @@ base::string16 SafetyCheckHandler::GetStringForPasswords(
Compromised compromised,
Done done,
Total total) {
const base::string16 short_product_name =
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
switch (status) {
case PasswordsStatus::kChecking: {
// Unable to get progress for some reason.
if (total.value() == 0) {
return l10n_util::GetStringUTF16(IDS_SETTINGS_SAFETY_CHECK_RUNNING);
}
return l10n_util::GetStringFUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_PROGRESS,
base::FormatNumber(done.value()), base::FormatNumber(total.value()));
return l10n_util::GetStringFUTF16(IDS_SETTINGS_CHECK_PASSWORDS_PROGRESS,
base::FormatNumber(done.value()),
base::FormatNumber(total.value()));
}
case PasswordsStatus::kSafe:
return l10n_util::GetStringUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SAFE);
return l10n_util::GetPluralStringFUTF16(
IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT, 0);
case PasswordsStatus::kCompromisedExist:
return l10n_util::GetPluralStringFUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_COMPROMISED, compromised.value());
IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT, compromised.value());
case PasswordsStatus::kOffline:
return l10n_util::GetStringUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_OFFLINE);
return l10n_util::GetStringFUTF16(
IDS_SETTINGS_CHECK_PASSWORDS_ERROR_OFFLINE, short_product_name);
case PasswordsStatus::kNoPasswords:
return l10n_util::GetStringUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_NO_PASSWORDS);
return l10n_util::GetStringFUTF16(
IDS_SETTINGS_CHECK_PASSWORDS_ERROR_NO_PASSWORDS, short_product_name);
case PasswordsStatus::kSignedOut:
return l10n_util::GetStringUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SIGNED_OUT);
case PasswordsStatus::kQuotaLimit:
return l10n_util::GetStringUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_QUOTA_LIMIT);
return l10n_util::GetStringFUTF16(
IDS_SETTINGS_CHECK_PASSWORDS_ERROR_QUOTA_LIMIT, short_product_name);
case PasswordsStatus::kError:
return l10n_util::GetStringUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_ERROR);
return l10n_util::GetStringFUTF16(
IDS_SETTINGS_CHECK_PASSWORDS_ERROR_GENERIC, short_product_name);
}
}
......
......@@ -615,9 +615,9 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_InterruptedAndRefreshed) {
kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kSignedOut));
ASSERT_TRUE(event3);
VerifyDisplayString(
event3,
"Browser can't check your passwords because you're not signed in");
VerifyDisplayString(event3,
"Browser can't check your passwords because you're not "
"signed in");
histogram_tester_.ExpectBucketCount(
"Settings.SafetyCheck.PasswordsResult",
SafetyCheckHandler::PasswordsStatus::kSignedOut, 1);
......@@ -730,8 +730,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Error) {
kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kError));
ASSERT_TRUE(event);
VerifyDisplayString(event,
"Browser can't check your passwords. Try again later.");
VerifyDisplayString(event, "Browser can't check your passwords.");
histogram_tester_.ExpectBucketCount(
"Settings.SafetyCheck.PasswordsResult",
SafetyCheckHandler::PasswordsStatus::kError, 1);
......@@ -767,7 +766,9 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_NoPasswords) {
kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kNoPasswords));
EXPECT_TRUE(event);
VerifyDisplayString(event, "No saved passwords");
VerifyDisplayString(event,
"No saved passwords. Chrome can check your passwords "
"when you save them.");
histogram_tester_.ExpectBucketCount(
"Settings.SafetyCheck.PasswordsResult",
SafetyCheckHandler::PasswordsStatus::kNoPasswords, 1);
......@@ -789,7 +790,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) {
kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kChecking));
EXPECT_TRUE(event);
VerifyDisplayString(event, base::UTF8ToUTF16("1/3 passwords checked…"));
VerifyDisplayString(event, base::UTF8ToUTF16("Checking passwords (1 of 3)…"));
test_passwords_delegate_.SetProgress(2, 3);
static_cast<password_manager::BulkLeakCheckService::Observer*>(
......@@ -800,7 +801,8 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) {
kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kChecking));
EXPECT_TRUE(event2);
VerifyDisplayString(event2, base::UTF8ToUTF16("2/3 passwords checked…"));
VerifyDisplayString(event2,
base::UTF8ToUTF16("Checking passwords (2 of 3)…"));
// Final update comes after status change, so no new progress message should
// be present.
......@@ -816,7 +818,8 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) {
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kChecking));
EXPECT_TRUE(event3);
// Still 2/3 event.
VerifyDisplayString(event3, base::UTF8ToUTF16("2/3 passwords checked…"));
VerifyDisplayString(event3,
base::UTF8ToUTF16("Checking passwords (2 of 3)…"));
}
TEST_F(SafetyCheckHandlerTest, CheckExtensions_NoExtensions) {
......
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