Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: components/autofill/core/common/password_form_fill_data_unittest.cc

Issue 1314903003: Updating of all entries in PasswordManager of the same credentials on password update (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Vasilii comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/common/password_form_fill_data_unittest.cc
diff --git a/components/autofill/core/common/password_form_fill_data_unittest.cc b/components/autofill/core/common/password_form_fill_data_unittest.cc
index aafb4732d446803a7d1696ef752e5818476b6b5b..a1d9302c404e6e6ea709437b24861e2d077db96b 100644
--- a/components/autofill/core/common/password_form_fill_data_unittest.cc
+++ b/components/autofill/core/common/password_form_fill_data_unittest.cc
@@ -60,7 +60,7 @@ TEST(PasswordFormFillDataTest, TestSinglePreferredMatch) {
EXPECT_TRUE(result.wait_for_username);
// The preferred realm should be empty since it's the same as the realm of
// the form.
- EXPECT_EQ(result.preferred_realm, "");
+ EXPECT_EQ(std::string(), result.preferred_realm);
PasswordFormFillData result2;
InitPasswordFormFillData(form_on_page,
@@ -103,13 +103,14 @@ TEST(PasswordFormFillDataTest, TestPublicSuffixDomainMatching) {
preferred_match.password_element = ASCIIToUTF16("password");
preferred_match.password_value = ASCIIToUTF16("test");
preferred_match.submit_element = ASCIIToUTF16("");
- preferred_match.signon_realm = "https://mobile.foo.com/";
- preferred_match.original_signon_realm = "https://foo.com/";
+ preferred_match.signon_realm = "https://foo.com/";
+ preferred_match.is_public_suffix_match = true;
preferred_match.ssl_valid = true;
preferred_match.preferred = true;
preferred_match.scheme = PasswordForm::SCHEME_HTML;
- // Create a match that matches exactly, so |original_signon_realm| is not set.
+ // Create a match that matches exactly, so |is_public_suffix_match| has a
+ // default value false.
scoped_ptr<PasswordForm> scoped_exact_match(new PasswordForm);
PasswordForm& exact_match = *scoped_exact_match;
exact_match.origin = GURL("https://foo.com/");
@@ -125,7 +126,7 @@ TEST(PasswordFormFillDataTest, TestPublicSuffixDomainMatching) {
exact_match.scheme = PasswordForm::SCHEME_HTML;
// Create a match that was matched using public suffix, so
- // |original_signon_realm| is set to where the result came from.
+ // |is_public_suffix_match| == true.
scoped_ptr<PasswordForm> scoped_public_suffix_match(new PasswordForm);
PasswordForm& public_suffix_match = *scoped_public_suffix_match;
public_suffix_match.origin = GURL("https://foo.com/");
@@ -135,7 +136,7 @@ TEST(PasswordFormFillDataTest, TestPublicSuffixDomainMatching) {
public_suffix_match.password_element = ASCIIToUTF16("password");
public_suffix_match.password_value = ASCIIToUTF16("test");
public_suffix_match.submit_element = ASCIIToUTF16("");
- public_suffix_match.original_signon_realm = "https://subdomain.foo.com/";
+ public_suffix_match.is_public_suffix_match = true;
public_suffix_match.signon_realm = "https://foo.com/";
public_suffix_match.ssl_valid = true;
public_suffix_match.preferred = false;
@@ -155,20 +156,20 @@ TEST(PasswordFormFillDataTest, TestPublicSuffixDomainMatching) {
false,
&result);
EXPECT_TRUE(result.wait_for_username);
- // The preferred realm should match the original signon realm from the
+ // The preferred realm should match the signon realm from the
// preferred match so the user can see where the result came from.
- EXPECT_EQ(result.preferred_realm,
- preferred_match.original_signon_realm);
+ EXPECT_EQ(result.preferred_realm, preferred_match.signon_realm);
engedy 2015/09/29 16:20:45 nit: Swap the order of arguments, so that the expe
dvadym 2015/09/29 18:29:36 Done.
// The realm of the exact match should be empty.
PasswordFormFillData::LoginCollection::const_iterator iter =
result.additional_logins.find(exact_match.username_value);
- EXPECT_EQ(iter->second.realm, "");
+ EXPECT_EQ("", iter->second.realm);
engedy 2015/09/29 16:20:45 nit: Empty string literals are discouraged as they
dvadym 2015/09/29 18:29:36 Done.
// The realm of the public suffix match should be set to the original signon
// realm so the user can see where the result came from.
iter = result.additional_logins.find(public_suffix_match.username_value);
- EXPECT_EQ(iter->second.realm, public_suffix_match.original_signon_realm);
+ EXPECT_EQ(public_suffix_match.signon_realm, iter->second.realm);
engedy 2015/09/29 16:20:45 nit: Swap.
dvadym 2015/09/29 18:29:36 Done.
+ EXPECT_TRUE(public_suffix_match.is_public_suffix_match);
engedy 2015/09/29 16:20:45 This should be iter->second.is_public_suffix_match
dvadym 2015/09/29 18:29:36 Thanks for pointing this. iter->second contains in
engedy 2015/09/29 19:11:04 Ah, right, I was getting confused about the types.
}
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698