Commit 4b0aff59 authored by Ioana Pandele's avatar Ioana Pandele Committed by Commit Bot

[PwdCheckAndroid] Remove is_android_credential from UI struct

This is not needed. The Java code checks to see if the package string is
not empty to determine whether the credential is an app credential or not.

Bug: 1102025
Change-Id: I38dbdc771a4bcce6eed2a4e18d3ee38d21b5e73a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359139Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Ioana Pandele <ioanap@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799169}
parent a1d50a60
......@@ -200,7 +200,6 @@ CompromisedCredentialForUI PasswordCheckManager::MakeUICredential(
const PasswordForm& android_form =
compromised_credentials_manager_.GetSavedPasswordsFor(credential)[0];
ui_credential.is_android_credential = true;
ui_credential.package_name = facet.android_package_name();
if (android_form.app_display_name.empty()) {
......@@ -214,7 +213,6 @@ CompromisedCredentialForUI PasswordCheckManager::MakeUICredential(
base::UTF8ToUTF16(android_form.app_display_name);
}
} else {
ui_credential.is_android_credential = false;
ui_credential.display_origin = url_formatter::FormatUrl(
credential.url.GetOrigin(),
url_formatter::kFormatUrlOmitDefaults |
......
......@@ -46,7 +46,6 @@ class PasswordCheckManager
base::string16 display_origin;
std::string package_name;
std::string change_password_url;
bool is_android_credential = false;
bool has_script = false;
};
......
......@@ -143,7 +143,6 @@ auto ExpectCompromisedCredentialForUI(
const base::string16& display_origin,
const base::Optional<std::string>& package_name,
const base::Optional<std::string>& change_password_url,
bool is_android_credential,
bool has_script) {
auto package_name_field_matcher =
package_name.has_value()
......@@ -159,8 +158,6 @@ auto ExpectCompromisedCredentialForUI(
Field(&CompromisedCredentialForUI::display_username, display_username),
Field(&CompromisedCredentialForUI::display_origin, display_origin),
package_name_field_matcher, change_password_url_field_matcher,
Field(&CompromisedCredentialForUI::is_android_credential,
is_android_credential),
Field(&CompromisedCredentialForUI::has_script, has_script));
}
......@@ -239,8 +236,7 @@ TEST_F(PasswordCheckManagerTest, CorrectlyCreatesUIStructForSiteCredential) {
manager_->GetCompromisedCredentials(),
ElementsAre(ExpectCompromisedCredentialForUI(
base::ASCIIToUTF16(kUsername1), base::ASCIIToUTF16("example.com"),
base::nullopt, "https://example.com/",
/*is_android_credential=*/false, /*has_script=*/false)));
base::nullopt, "https://example.com/", /*has_script=*/false)));
}
TEST_F(PasswordCheckManagerTest, CorrectlyCreatesUIStructForAppCredentials) {
......@@ -257,18 +253,17 @@ TEST_F(PasswordCheckManagerTest, CorrectlyCreatesUIStructForAppCredentials) {
RunUntilIdle();
EXPECT_THAT(
manager_->GetCompromisedCredentials(),
ElementsAre(
ExpectCompromisedCredentialForUI(
base::ASCIIToUTF16(kUsername1),
base::ASCIIToUTF16("App (com.example.app)"), "com.example.app",
base::nullopt, /*is_android_credential=*/true,
/*has_script=*/false),
ExpectCompromisedCredentialForUI(
base::ASCIIToUTF16(kUsername2), base::ASCIIToUTF16("Example App"),
"com.example.app", base::nullopt, /*is_android_credential=*/true,
/*has_script=*/false)));
EXPECT_THAT(manager_->GetCompromisedCredentials(),
ElementsAre(ExpectCompromisedCredentialForUI(
base::ASCIIToUTF16(kUsername1),
base::ASCIIToUTF16("App (com.example.app)"),
"com.example.app", base::nullopt,
/*has_script=*/false),
ExpectCompromisedCredentialForUI(
base::ASCIIToUTF16(kUsername2),
base::ASCIIToUTF16("Example App"),
"com.example.app", base::nullopt,
/*has_script=*/false)));
}
TEST_F(PasswordCheckManagerTest, SetsTimestampOnSuccessfulCheck) {
......
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