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 @@ ...@@ -86,6 +86,8 @@
<message name="IDS_SETTINGS_SIGNIN_ALLOWED_DESC" desc="The description of the preference to allow to sign-in to Chrome"> <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 By turning this off, you can sign in to Google sites like Gmail without signing in to Chromium
</message> </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.)"> <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 Chromium can help keep you safe from data breaches, bad extensions, and more
</message> </message>
...@@ -95,21 +97,9 @@ ...@@ -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."> <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> 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>
<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."> <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 Chromium can't check your passwords because you're not signed in
</message> </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."> <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. Safe Browsing is off. Chromium recommends turning it on.
</message> </message>
......
...@@ -86,6 +86,8 @@ ...@@ -86,6 +86,8 @@
<message name="IDS_SETTINGS_SIGNIN_ALLOWED_DESC" desc="The description of the preference to allow to sign-in to Chrome"> <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 By turning this off, you can sign in to Google sites like Gmail without signing in to Chrome
</message> </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.)"> <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 Chrome can help keep you safe from data breaches, bad extensions, and more
</message> </message>
...@@ -95,21 +97,9 @@ ...@@ -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."> <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> 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>
<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."> <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 Chrome can't check your passwords because you're not signed in
</message> </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."> <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. Safe Browsing is off. Chrome recommends turning it on.
</message> </message>
......
...@@ -1608,6 +1608,8 @@ ...@@ -1608,6 +1608,8 @@
<message name="IDS_SETTINGS_PRIVACY_MORE" desc="Label on the expansion button to show more privacy settings."> <message name="IDS_SETTINGS_PRIVACY_MORE" desc="Label on the expansion button to show more privacy settings.">
More More
</message> </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."> <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 Safety check
</message> </message>
...@@ -1677,20 +1679,6 @@ ...@@ -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."> <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 Passwords
</message> </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."> <message name="IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_BUTTON" desc="This button allows users to change their compromised passwords.">
{NUM_PASSWORDS, plural, {NUM_PASSWORDS, plural,
=1 {Change password} =1 {Change password}
......
...@@ -368,37 +368,39 @@ base::string16 SafetyCheckHandler::GetStringForPasswords( ...@@ -368,37 +368,39 @@ base::string16 SafetyCheckHandler::GetStringForPasswords(
Compromised compromised, Compromised compromised,
Done done, Done done,
Total total) { Total total) {
const base::string16 short_product_name =
l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
switch (status) { switch (status) {
case PasswordsStatus::kChecking: { case PasswordsStatus::kChecking: {
// Unable to get progress for some reason. // Unable to get progress for some reason.
if (total.value() == 0) { if (total.value() == 0) {
return l10n_util::GetStringUTF16(IDS_SETTINGS_SAFETY_CHECK_RUNNING); return l10n_util::GetStringUTF16(IDS_SETTINGS_SAFETY_CHECK_RUNNING);
} }
return l10n_util::GetStringFUTF16( return l10n_util::GetStringFUTF16(IDS_SETTINGS_CHECK_PASSWORDS_PROGRESS,
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_PROGRESS, base::FormatNumber(done.value()),
base::FormatNumber(done.value()), base::FormatNumber(total.value())); base::FormatNumber(total.value()));
} }
case PasswordsStatus::kSafe: case PasswordsStatus::kSafe:
return l10n_util::GetStringUTF16( return l10n_util::GetPluralStringFUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SAFE); IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT, 0);
case PasswordsStatus::kCompromisedExist: case PasswordsStatus::kCompromisedExist:
return l10n_util::GetPluralStringFUTF16( return l10n_util::GetPluralStringFUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_COMPROMISED, compromised.value()); IDS_SETTINGS_COMPROMISED_PASSWORDS_COUNT, compromised.value());
case PasswordsStatus::kOffline: case PasswordsStatus::kOffline:
return l10n_util::GetStringUTF16( return l10n_util::GetStringFUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_OFFLINE); IDS_SETTINGS_CHECK_PASSWORDS_ERROR_OFFLINE, short_product_name);
case PasswordsStatus::kNoPasswords: case PasswordsStatus::kNoPasswords:
return l10n_util::GetStringUTF16( return l10n_util::GetStringFUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_NO_PASSWORDS); IDS_SETTINGS_CHECK_PASSWORDS_ERROR_NO_PASSWORDS, short_product_name);
case PasswordsStatus::kSignedOut: case PasswordsStatus::kSignedOut:
return l10n_util::GetStringUTF16( return l10n_util::GetStringUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SIGNED_OUT); IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_SIGNED_OUT);
case PasswordsStatus::kQuotaLimit: case PasswordsStatus::kQuotaLimit:
return l10n_util::GetStringUTF16( return l10n_util::GetStringFUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_QUOTA_LIMIT); IDS_SETTINGS_CHECK_PASSWORDS_ERROR_QUOTA_LIMIT, short_product_name);
case PasswordsStatus::kError: case PasswordsStatus::kError:
return l10n_util::GetStringUTF16( return l10n_util::GetStringFUTF16(
IDS_SETTINGS_SAFETY_CHECK_PASSWORDS_ERROR); IDS_SETTINGS_CHECK_PASSWORDS_ERROR_GENERIC, short_product_name);
} }
} }
......
...@@ -615,9 +615,9 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_InterruptedAndRefreshed) { ...@@ -615,9 +615,9 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_InterruptedAndRefreshed) {
kPasswords, kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kSignedOut)); static_cast<int>(SafetyCheckHandler::PasswordsStatus::kSignedOut));
ASSERT_TRUE(event3); ASSERT_TRUE(event3);
VerifyDisplayString( VerifyDisplayString(event3,
event3, "Browser can't check your passwords because you're not "
"Browser can't check your passwords because you're not signed in"); "signed in");
histogram_tester_.ExpectBucketCount( histogram_tester_.ExpectBucketCount(
"Settings.SafetyCheck.PasswordsResult", "Settings.SafetyCheck.PasswordsResult",
SafetyCheckHandler::PasswordsStatus::kSignedOut, 1); SafetyCheckHandler::PasswordsStatus::kSignedOut, 1);
...@@ -730,8 +730,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Error) { ...@@ -730,8 +730,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Error) {
kPasswords, kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kError)); static_cast<int>(SafetyCheckHandler::PasswordsStatus::kError));
ASSERT_TRUE(event); ASSERT_TRUE(event);
VerifyDisplayString(event, VerifyDisplayString(event, "Browser can't check your passwords.");
"Browser can't check your passwords. Try again later.");
histogram_tester_.ExpectBucketCount( histogram_tester_.ExpectBucketCount(
"Settings.SafetyCheck.PasswordsResult", "Settings.SafetyCheck.PasswordsResult",
SafetyCheckHandler::PasswordsStatus::kError, 1); SafetyCheckHandler::PasswordsStatus::kError, 1);
...@@ -767,7 +766,9 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_NoPasswords) { ...@@ -767,7 +766,9 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_NoPasswords) {
kPasswords, kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kNoPasswords)); static_cast<int>(SafetyCheckHandler::PasswordsStatus::kNoPasswords));
EXPECT_TRUE(event); 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( histogram_tester_.ExpectBucketCount(
"Settings.SafetyCheck.PasswordsResult", "Settings.SafetyCheck.PasswordsResult",
SafetyCheckHandler::PasswordsStatus::kNoPasswords, 1); SafetyCheckHandler::PasswordsStatus::kNoPasswords, 1);
...@@ -789,7 +790,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) { ...@@ -789,7 +790,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) {
kPasswords, kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kChecking)); static_cast<int>(SafetyCheckHandler::PasswordsStatus::kChecking));
EXPECT_TRUE(event); 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); test_passwords_delegate_.SetProgress(2, 3);
static_cast<password_manager::BulkLeakCheckService::Observer*>( static_cast<password_manager::BulkLeakCheckService::Observer*>(
...@@ -800,7 +801,8 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) { ...@@ -800,7 +801,8 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) {
kPasswords, kPasswords,
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kChecking)); static_cast<int>(SafetyCheckHandler::PasswordsStatus::kChecking));
EXPECT_TRUE(event2); 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 // Final update comes after status change, so no new progress message should
// be present. // be present.
...@@ -816,7 +818,8 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) { ...@@ -816,7 +818,8 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) {
static_cast<int>(SafetyCheckHandler::PasswordsStatus::kChecking)); static_cast<int>(SafetyCheckHandler::PasswordsStatus::kChecking));
EXPECT_TRUE(event3); EXPECT_TRUE(event3);
// Still 2/3 event. // 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) { 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