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

Unified Diff: components/password_manager/core/browser/password_form_manager_unittest.cc

Issue 1286593003: [Password Manager] Store forms with field name and id attributes missing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed mac bot failure. 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/password_manager/core/browser/password_form_manager_unittest.cc
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc
index e70e813f0ff577bbcc0f3b827f19e44dc8f1062b..c912e91e7a992f62d6eee38b5884374519db3bd6 100644
--- a/components/password_manager/core/browser/password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -882,105 +882,6 @@ TEST_F(PasswordFormManagerTest, TestAlternateUsername_OtherUsername) {
EXPECT_TRUE(saved_result.other_possible_usernames.empty());
}
-TEST_F(PasswordFormManagerTest, TestValidForms) {
- // User submits credentials for the observed form.
- PasswordForm credentials = *observed_form();
- credentials.scheme = PasswordForm::SCHEME_HTML;
- credentials.username_value = saved_match()->username_value;
- credentials.password_value = saved_match()->password_value;
-
- // An alternate version of the form that also has a new_password_element.
- PasswordForm new_credentials(*observed_form());
- new_credentials.new_password_element = ASCIIToUTF16("NewPasswd");
- new_credentials.new_password_value = ASCIIToUTF16("test1new");
-
- // Form with both username_element and password_element.
- PasswordFormManager manager1(password_manager(), client(), kNoDriver,
- credentials, false);
- SimulateMatchingPhase(&manager1, RESULT_NO_MATCH);
- EXPECT_TRUE(manager1.HasValidPasswordForm());
-
- // Form with username_element, password_element, and new_password_element.
- PasswordFormManager manager2(password_manager(), client(), kNoDriver,
- new_credentials, false);
- SimulateMatchingPhase(&manager2, RESULT_NO_MATCH);
- EXPECT_TRUE(manager2.HasValidPasswordForm());
-
- // Form with username_element and only new_password_element.
- new_credentials.password_element.clear();
- PasswordFormManager manager3(password_manager(), client(), kNoDriver,
- new_credentials, false);
- SimulateMatchingPhase(&manager3, RESULT_NO_MATCH);
- EXPECT_TRUE(manager3.HasValidPasswordForm());
-
- // Form without a username_element but with a password_element.
- credentials.username_element.clear();
- PasswordFormManager manager4(password_manager(), client(), kNoDriver,
- credentials, false);
- SimulateMatchingPhase(&manager4, RESULT_NO_MATCH);
- EXPECT_TRUE(manager4.HasValidPasswordForm());
-
- // Form without a username_element but with a new_password_element.
- new_credentials.username_element.clear();
- PasswordFormManager manager5(password_manager(), client(), kNoDriver,
- new_credentials, false);
- SimulateMatchingPhase(&manager5, RESULT_NO_MATCH);
- EXPECT_TRUE(manager5.HasValidPasswordForm());
-
- // Form without a password_element but with a username_element.
- credentials.username_element = saved_match()->username_element;
- credentials.password_element.clear();
- PasswordFormManager manager6(password_manager(), client(), kNoDriver,
- credentials, false);
- SimulateMatchingPhase(&manager6, RESULT_NO_MATCH);
- EXPECT_FALSE(manager6.HasValidPasswordForm());
-
- // Form with neither a password_element nor a username_element.
- credentials.username_element.clear();
- credentials.password_element.clear();
- PasswordFormManager manager7(password_manager(), client(), kNoDriver,
- credentials, false);
- SimulateMatchingPhase(&manager7, RESULT_NO_MATCH);
- EXPECT_FALSE(manager7.HasValidPasswordForm());
-}
-
-TEST_F(PasswordFormManagerTest, TestValidFormsBasic) {
- // User submits credentials for the observed form.
- PasswordForm credentials = *observed_form();
- credentials.scheme = PasswordForm::SCHEME_BASIC;
- credentials.username_value = saved_match()->username_value;
- credentials.password_value = saved_match()->password_value;
-
- // Form with both username_element and password_element.
- PasswordFormManager manager1(password_manager(), client(), kNoDriver,
- credentials, false);
- SimulateMatchingPhase(&manager1, RESULT_NO_MATCH);
- EXPECT_TRUE(manager1.HasValidPasswordForm());
-
- // Form without a username_element but with a password_element.
- credentials.username_element.clear();
- PasswordFormManager manager2(password_manager(), client(), kNoDriver,
- credentials, false);
- SimulateMatchingPhase(&manager2, RESULT_NO_MATCH);
- EXPECT_TRUE(manager2.HasValidPasswordForm());
-
- // Form without a password_element but with a username_element.
- credentials.username_element = saved_match()->username_element;
- credentials.password_element.clear();
- PasswordFormManager manager3(password_manager(), client(), kNoDriver,
- credentials, false);
- SimulateMatchingPhase(&manager3, RESULT_NO_MATCH);
- EXPECT_TRUE(manager3.HasValidPasswordForm());
-
- // Form with neither a password_element nor a username_element.
- credentials.username_element.clear();
- credentials.password_element.clear();
- PasswordFormManager manager4(password_manager(), client(), kNoDriver,
- credentials, false);
- SimulateMatchingPhase(&manager4, RESULT_NO_MATCH);
- EXPECT_TRUE(manager4.HasValidPasswordForm());
-}
-
TEST_F(PasswordFormManagerTest, TestSendNotBlacklistedMessage_NoCredentials) {
// First time sign-up attempt. Password store does not contain matching
// credentials. AllowPasswordGenerationForForm should be called to send the

Powered by Google App Engine
This is Rietveld 408576698