| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/testing_pref_service.h" | 9 #include "base/prefs/testing_pref_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // Necessary for callbacks, and for TestAutofillDriver. | 293 // Necessary for callbacks, and for TestAutofillDriver. |
| 294 base::MessageLoop message_loop; | 294 base::MessageLoop message_loop; |
| 295 | 295 |
| 296 PasswordForm observed_form_; | 296 PasswordForm observed_form_; |
| 297 PasswordForm saved_match_; | 297 PasswordForm saved_match_; |
| 298 scoped_refptr<NiceMock<MockPasswordStore>> mock_store_; | 298 scoped_refptr<NiceMock<MockPasswordStore>> mock_store_; |
| 299 scoped_ptr<TestPasswordManagerClient> client_; | 299 scoped_ptr<TestPasswordManagerClient> client_; |
| 300 }; | 300 }; |
| 301 | 301 |
| 302 TEST_F(PasswordFormManagerTest, TestNewLogin) { | 302 TEST_F(PasswordFormManagerTest, TestNewLogin) { |
| 303 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 303 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 304 false); | 304 false); |
| 305 SimulateMatchingPhase(&manager, RESULT_NO_MATCH); | 305 SimulateMatchingPhase(&manager, RESULT_NO_MATCH); |
| 306 | 306 |
| 307 // User submits credentials for the observed form. | 307 // User submits credentials for the observed form. |
| 308 PasswordForm credentials = *observed_form(); | 308 PasswordForm credentials = *observed_form(); |
| 309 credentials.username_value = saved_match()->username_value; | 309 credentials.username_value = saved_match()->username_value; |
| 310 credentials.password_value = saved_match()->password_value; | 310 credentials.password_value = saved_match()->password_value; |
| 311 credentials.preferred = true; | 311 credentials.preferred = true; |
| 312 manager.ProvisionallySave( | 312 manager.ProvisionallySave( |
| 313 credentials, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); | 313 credentials, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 EXPECT_TRUE(GetPendingCredentials(&manager)->new_password_element.empty()); | 355 EXPECT_TRUE(GetPendingCredentials(&manager)->new_password_element.empty()); |
| 356 EXPECT_TRUE(GetPendingCredentials(&manager)->new_password_value.empty()); | 356 EXPECT_TRUE(GetPendingCredentials(&manager)->new_password_value.empty()); |
| 357 } | 357 } |
| 358 | 358 |
| 359 // If PSL-matched credentials had been suggested, but the user has overwritten | 359 // If PSL-matched credentials had been suggested, but the user has overwritten |
| 360 // the password, the provisionally saved credentials should no longer be | 360 // the password, the provisionally saved credentials should no longer be |
| 361 // considered as PSL-matched, so that the exception for not prompting before | 361 // considered as PSL-matched, so that the exception for not prompting before |
| 362 // saving PSL-matched credentials should no longer apply. | 362 // saving PSL-matched credentials should no longer apply. |
| 363 TEST_F(PasswordFormManagerTest, | 363 TEST_F(PasswordFormManagerTest, |
| 364 OverriddenPSLMatchedCredentialsNotMarkedAsPSLMatched) { | 364 OverriddenPSLMatchedCredentialsNotMarkedAsPSLMatched) { |
| 365 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 365 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 366 false); | 366 false); |
| 367 | 367 |
| 368 // The suggestion needs to be PSL-matched. | 368 // The suggestion needs to be PSL-matched. |
| 369 saved_match()->original_signon_realm = "www.example.org"; | 369 saved_match()->original_signon_realm = "www.example.org"; |
| 370 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); | 370 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); |
| 371 | 371 |
| 372 // User modifies the suggested password and submits the form. | 372 // User modifies the suggested password and submits the form. |
| 373 PasswordForm credentials(*observed_form()); | 373 PasswordForm credentials(*observed_form()); |
| 374 credentials.username_value = saved_match()->username_value; | 374 credentials.username_value = saved_match()->username_value; |
| 375 credentials.password_value = | 375 credentials.password_value = |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 actual_saved_form.date_created = base::Time(); | 418 actual_saved_form.date_created = base::Time(); |
| 419 EXPECT_EQ(expected_saved_form, actual_saved_form); | 419 EXPECT_EQ(expected_saved_form, actual_saved_form); |
| 420 } | 420 } |
| 421 | 421 |
| 422 TEST_F(PasswordFormManagerTest, TestNewLoginFromNewPasswordElement) { | 422 TEST_F(PasswordFormManagerTest, TestNewLoginFromNewPasswordElement) { |
| 423 // Add a new password field to the test form. The PasswordFormManager should | 423 // Add a new password field to the test form. The PasswordFormManager should |
| 424 // save the password from this field, instead of the current password field. | 424 // save the password from this field, instead of the current password field. |
| 425 observed_form()->new_password_element = ASCIIToUTF16("NewPasswd"); | 425 observed_form()->new_password_element = ASCIIToUTF16("NewPasswd"); |
| 426 observed_form()->username_marked_by_site = true; | 426 observed_form()->username_marked_by_site = true; |
| 427 | 427 |
| 428 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 428 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 429 false); | 429 false); |
| 430 SimulateMatchingPhase(&manager, RESULT_NO_MATCH); | 430 SimulateMatchingPhase(&manager, RESULT_NO_MATCH); |
| 431 | 431 |
| 432 // User enters current and new credentials to the observed form. | 432 // User enters current and new credentials to the observed form. |
| 433 PasswordForm credentials(*observed_form()); | 433 PasswordForm credentials(*observed_form()); |
| 434 credentials.username_value = saved_match()->username_value; | 434 credentials.username_value = saved_match()->username_value; |
| 435 credentials.password_value = saved_match()->password_value; | 435 credentials.password_value = saved_match()->password_value; |
| 436 credentials.new_password_value = ASCIIToUTF16("newpassword"); | 436 credentials.new_password_value = ASCIIToUTF16("newpassword"); |
| 437 credentials.preferred = true; | 437 credentials.preferred = true; |
| 438 manager.ProvisionallySave( | 438 manager.ProvisionallySave( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 456 EXPECT_EQ(credentials.new_password_value, | 456 EXPECT_EQ(credentials.new_password_value, |
| 457 GetPendingCredentials(&manager)->password_value); | 457 GetPendingCredentials(&manager)->password_value); |
| 458 EXPECT_TRUE(GetPendingCredentials(&manager)->password_element.empty()); | 458 EXPECT_TRUE(GetPendingCredentials(&manager)->password_element.empty()); |
| 459 EXPECT_TRUE(GetPendingCredentials(&manager)->new_password_element.empty()); | 459 EXPECT_TRUE(GetPendingCredentials(&manager)->new_password_element.empty()); |
| 460 EXPECT_TRUE(GetPendingCredentials(&manager)->new_password_value.empty()); | 460 EXPECT_TRUE(GetPendingCredentials(&manager)->new_password_value.empty()); |
| 461 } | 461 } |
| 462 | 462 |
| 463 TEST_F(PasswordFormManagerTest, TestUpdatePassword) { | 463 TEST_F(PasswordFormManagerTest, TestUpdatePassword) { |
| 464 // Create a PasswordFormManager with observed_form, as if we just | 464 // Create a PasswordFormManager with observed_form, as if we just |
| 465 // saw this form and need to find matching logins. | 465 // saw this form and need to find matching logins. |
| 466 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 466 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 467 false); | 467 false); |
| 468 | 468 |
| 469 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); | 469 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); |
| 470 | 470 |
| 471 // User submits credentials for the observed form using a username previously | 471 // User submits credentials for the observed form using a username previously |
| 472 // stored, but a new password. Note that the observed form may have different | 472 // stored, but a new password. Note that the observed form may have different |
| 473 // origin URL (as it does in this case) than the saved_match, but we want to | 473 // origin URL (as it does in this case) than the saved_match, but we want to |
| 474 // make sure the updated password is reflected in saved_match, because that is | 474 // make sure the updated password is reflected in saved_match, because that is |
| 475 // what we autofilled. | 475 // what we autofilled. |
| 476 base::string16 new_pass = ASCIIToUTF16("test2"); | 476 base::string16 new_pass = ASCIIToUTF16("test2"); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 505 // Given that |observed_form| was most likely a change password form, it | 505 // Given that |observed_form| was most likely a change password form, it |
| 506 // should not serve as a source for updating meta-information stored with the | 506 // should not serve as a source for updating meta-information stored with the |
| 507 // old credentials, such as element names, as they are likely going to be | 507 // old credentials, such as element names, as they are likely going to be |
| 508 // different between change password and login forms. To test this in depth, | 508 // different between change password and login forms. To test this in depth, |
| 509 // forcibly wipe |submit_element|, which should normally trigger updating this | 509 // forcibly wipe |submit_element|, which should normally trigger updating this |
| 510 // field from |observed_form| in the UpdateLogin() step as a special case. We | 510 // field from |observed_form| in the UpdateLogin() step as a special case. We |
| 511 // will verify in the end that this did not happen. | 511 // will verify in the end that this did not happen. |
| 512 saved_match()->submit_element.clear(); | 512 saved_match()->submit_element.clear(); |
| 513 | 513 |
| 514 TestPasswordManagerClient client_with_store(mock_store()); | 514 TestPasswordManagerClient client_with_store(mock_store()); |
| 515 PasswordFormManager manager(NULL, &client_with_store, | 515 PasswordFormManager manager(nullptr, &client_with_store, |
| 516 client_with_store.driver(), *observed_form(), | 516 client_with_store.driver(), *observed_form(), |
| 517 false); | 517 false); |
| 518 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); | 518 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); |
| 519 | 519 |
| 520 // User submits current and new credentials to the observed form. | 520 // User submits current and new credentials to the observed form. |
| 521 PasswordForm credentials(*observed_form()); | 521 PasswordForm credentials(*observed_form()); |
| 522 credentials.username_value = saved_match()->username_value; | 522 credentials.username_value = saved_match()->username_value; |
| 523 credentials.password_value = saved_match()->password_value; | 523 credentials.password_value = saved_match()->password_value; |
| 524 credentials.new_password_value = ASCIIToUTF16("test2"); | 524 credentials.new_password_value = ASCIIToUTF16("test2"); |
| 525 credentials.preferred = true; | 525 credentials.preferred = true; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 547 Mock::VerifyAndClearExpectations(mock_store()); | 547 Mock::VerifyAndClearExpectations(mock_store()); |
| 548 | 548 |
| 549 // No meta-information should be updated, only the password. | 549 // No meta-information should be updated, only the password. |
| 550 EXPECT_EQ(credentials.new_password_value, new_credentials.password_value); | 550 EXPECT_EQ(credentials.new_password_value, new_credentials.password_value); |
| 551 EXPECT_EQ(saved_match()->username_element, new_credentials.username_element); | 551 EXPECT_EQ(saved_match()->username_element, new_credentials.username_element); |
| 552 EXPECT_EQ(saved_match()->password_element, new_credentials.password_element); | 552 EXPECT_EQ(saved_match()->password_element, new_credentials.password_element); |
| 553 EXPECT_EQ(saved_match()->submit_element, new_credentials.submit_element); | 553 EXPECT_EQ(saved_match()->submit_element, new_credentials.submit_element); |
| 554 } | 554 } |
| 555 | 555 |
| 556 TEST_F(PasswordFormManagerTest, TestIgnoreResult) { | 556 TEST_F(PasswordFormManagerTest, TestIgnoreResult) { |
| 557 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 557 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 558 false); | 558 false); |
| 559 | 559 |
| 560 // Make sure we don't match a PasswordForm if it was originally saved on | 560 // Make sure we don't match a PasswordForm if it was originally saved on |
| 561 // an SSL-valid page and we are now on a page with invalid certificate. | 561 // an SSL-valid page and we are now on a page with invalid certificate. |
| 562 saved_match()->ssl_valid = true; | 562 saved_match()->ssl_valid = true; |
| 563 EXPECT_TRUE(IgnoredResult(&manager, saved_match())); | 563 EXPECT_TRUE(IgnoredResult(&manager, saved_match())); |
| 564 | 564 |
| 565 saved_match()->ssl_valid = false; | 565 saved_match()->ssl_valid = false; |
| 566 // Different paths for action / origin are okay. | 566 // Different paths for action / origin are okay. |
| 567 saved_match()->action = GURL("http://www.google.com/b/Login"); | 567 saved_match()->action = GURL("http://www.google.com/b/Login"); |
| 568 saved_match()->origin = GURL("http://www.google.com/foo"); | 568 saved_match()->origin = GURL("http://www.google.com/foo"); |
| 569 EXPECT_FALSE(IgnoredResult(&manager, saved_match())); | 569 EXPECT_FALSE(IgnoredResult(&manager, saved_match())); |
| 570 | 570 |
| 571 // Results should be ignored if the client requests it. | 571 // Results should be ignored if the client requests it. |
| 572 client()->SetFormToFilter(*saved_match()); | 572 client()->SetFormToFilter(*saved_match()); |
| 573 EXPECT_TRUE(IgnoredResult(&manager, saved_match())); | 573 EXPECT_TRUE(IgnoredResult(&manager, saved_match())); |
| 574 } | 574 } |
| 575 | 575 |
| 576 TEST_F(PasswordFormManagerTest, TestEmptyAction) { | 576 TEST_F(PasswordFormManagerTest, TestEmptyAction) { |
| 577 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 577 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 578 false); | 578 false); |
| 579 | 579 |
| 580 saved_match()->action = GURL(); | 580 saved_match()->action = GURL(); |
| 581 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); | 581 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); |
| 582 // User logs in with the autofilled username / password from saved_match. | 582 // User logs in with the autofilled username / password from saved_match. |
| 583 PasswordForm login = *observed_form(); | 583 PasswordForm login = *observed_form(); |
| 584 login.username_value = saved_match()->username_value; | 584 login.username_value = saved_match()->username_value; |
| 585 login.password_value = saved_match()->password_value; | 585 login.password_value = saved_match()->password_value; |
| 586 manager.ProvisionallySave( | 586 manager.ProvisionallySave( |
| 587 login, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); | 587 login, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); |
| 588 EXPECT_FALSE(manager.IsNewLogin()); | 588 EXPECT_FALSE(manager.IsNewLogin()); |
| 589 // We bless our saved PasswordForm entry with the action URL of the | 589 // We bless our saved PasswordForm entry with the action URL of the |
| 590 // observed form. | 590 // observed form. |
| 591 EXPECT_EQ(observed_form()->action, GetPendingCredentials(&manager)->action); | 591 EXPECT_EQ(observed_form()->action, GetPendingCredentials(&manager)->action); |
| 592 } | 592 } |
| 593 | 593 |
| 594 TEST_F(PasswordFormManagerTest, TestUpdateAction) { | 594 TEST_F(PasswordFormManagerTest, TestUpdateAction) { |
| 595 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 595 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 596 false); | 596 false); |
| 597 | 597 |
| 598 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); | 598 SimulateMatchingPhase(&manager, RESULT_MATCH_FOUND); |
| 599 // User logs in with the autofilled username / password from saved_match. | 599 // User logs in with the autofilled username / password from saved_match. |
| 600 PasswordForm login = *observed_form(); | 600 PasswordForm login = *observed_form(); |
| 601 login.username_value = saved_match()->username_value; | 601 login.username_value = saved_match()->username_value; |
| 602 login.password_value = saved_match()->password_value; | 602 login.password_value = saved_match()->password_value; |
| 603 | 603 |
| 604 manager.ProvisionallySave( | 604 manager.ProvisionallySave( |
| 605 login, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); | 605 login, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); |
| 606 EXPECT_FALSE(manager.IsNewLogin()); | 606 EXPECT_FALSE(manager.IsNewLogin()); |
| 607 // The observed action URL is different from the previously saved one, and | 607 // The observed action URL is different from the previously saved one, and |
| 608 // is the same as the one that would be submitted on successful login. | 608 // is the same as the one that would be submitted on successful login. |
| 609 EXPECT_NE(observed_form()->action, saved_match()->action); | 609 EXPECT_NE(observed_form()->action, saved_match()->action); |
| 610 EXPECT_EQ(observed_form()->action, GetPendingCredentials(&manager)->action); | 610 EXPECT_EQ(observed_form()->action, GetPendingCredentials(&manager)->action); |
| 611 } | 611 } |
| 612 | 612 |
| 613 TEST_F(PasswordFormManagerTest, TestDynamicAction) { | 613 TEST_F(PasswordFormManagerTest, TestDynamicAction) { |
| 614 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 614 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 615 false); | 615 false); |
| 616 | 616 |
| 617 SimulateMatchingPhase(&manager, RESULT_NO_MATCH); | 617 SimulateMatchingPhase(&manager, RESULT_NO_MATCH); |
| 618 PasswordForm login(*observed_form()); | 618 PasswordForm login(*observed_form()); |
| 619 // The submitted action URL is different from the one observed on page load. | 619 // The submitted action URL is different from the one observed on page load. |
| 620 GURL new_action = GURL("http://www.google.com/new_action"); | 620 GURL new_action = GURL("http://www.google.com/new_action"); |
| 621 login.action = new_action; | 621 login.action = new_action; |
| 622 | 622 |
| 623 manager.ProvisionallySave( | 623 manager.ProvisionallySave( |
| 624 login, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); | 624 login, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 credentials.scheme = PasswordForm::SCHEME_HTML; | 704 credentials.scheme = PasswordForm::SCHEME_HTML; |
| 705 credentials.username_value = saved_match()->username_value; | 705 credentials.username_value = saved_match()->username_value; |
| 706 credentials.password_value = saved_match()->password_value; | 706 credentials.password_value = saved_match()->password_value; |
| 707 | 707 |
| 708 // An alternate version of the form that also has a new_password_element. | 708 // An alternate version of the form that also has a new_password_element. |
| 709 PasswordForm new_credentials(*observed_form()); | 709 PasswordForm new_credentials(*observed_form()); |
| 710 new_credentials.new_password_element = ASCIIToUTF16("NewPasswd"); | 710 new_credentials.new_password_element = ASCIIToUTF16("NewPasswd"); |
| 711 new_credentials.new_password_value = ASCIIToUTF16("test1new"); | 711 new_credentials.new_password_value = ASCIIToUTF16("test1new"); |
| 712 | 712 |
| 713 // Form with both username_element and password_element. | 713 // Form with both username_element and password_element. |
| 714 PasswordFormManager manager1(NULL, NULL, kNoDriver, credentials, false); | 714 PasswordFormManager manager1(nullptr, nullptr, kNoDriver, credentials, false); |
| 715 SimulateMatchingPhase(&manager1, RESULT_NO_MATCH); | 715 SimulateMatchingPhase(&manager1, RESULT_NO_MATCH); |
| 716 EXPECT_TRUE(manager1.HasValidPasswordForm()); | 716 EXPECT_TRUE(manager1.HasValidPasswordForm()); |
| 717 | 717 |
| 718 // Form with username_element, password_element, and new_password_element. | 718 // Form with username_element, password_element, and new_password_element. |
| 719 PasswordFormManager manager2(NULL, NULL, kNoDriver, new_credentials, false); | 719 PasswordFormManager manager2(nullptr, nullptr, kNoDriver, new_credentials, |
| 720 false); |
| 720 SimulateMatchingPhase(&manager2, RESULT_NO_MATCH); | 721 SimulateMatchingPhase(&manager2, RESULT_NO_MATCH); |
| 721 EXPECT_TRUE(manager2.HasValidPasswordForm()); | 722 EXPECT_TRUE(manager2.HasValidPasswordForm()); |
| 722 | 723 |
| 723 // Form with username_element and only new_password_element. | 724 // Form with username_element and only new_password_element. |
| 724 new_credentials.password_element.clear(); | 725 new_credentials.password_element.clear(); |
| 725 PasswordFormManager manager3(NULL, NULL, kNoDriver, new_credentials, false); | 726 PasswordFormManager manager3(nullptr, nullptr, kNoDriver, new_credentials, |
| 727 false); |
| 726 SimulateMatchingPhase(&manager3, RESULT_NO_MATCH); | 728 SimulateMatchingPhase(&manager3, RESULT_NO_MATCH); |
| 727 EXPECT_TRUE(manager3.HasValidPasswordForm()); | 729 EXPECT_TRUE(manager3.HasValidPasswordForm()); |
| 728 | 730 |
| 729 // Form without a username_element but with a password_element. | 731 // Form without a username_element but with a password_element. |
| 730 credentials.username_element.clear(); | 732 credentials.username_element.clear(); |
| 731 PasswordFormManager manager4(NULL, NULL, kNoDriver, credentials, false); | 733 PasswordFormManager manager4(nullptr, nullptr, kNoDriver, credentials, false); |
| 732 SimulateMatchingPhase(&manager4, RESULT_NO_MATCH); | 734 SimulateMatchingPhase(&manager4, RESULT_NO_MATCH); |
| 733 EXPECT_TRUE(manager4.HasValidPasswordForm()); | 735 EXPECT_TRUE(manager4.HasValidPasswordForm()); |
| 734 | 736 |
| 735 // Form without a username_element but with a new_password_element. | 737 // Form without a username_element but with a new_password_element. |
| 736 new_credentials.username_element.clear(); | 738 new_credentials.username_element.clear(); |
| 737 PasswordFormManager manager5(NULL, NULL, kNoDriver, new_credentials, false); | 739 PasswordFormManager manager5(nullptr, nullptr, kNoDriver, new_credentials, |
| 740 false); |
| 738 SimulateMatchingPhase(&manager5, RESULT_NO_MATCH); | 741 SimulateMatchingPhase(&manager5, RESULT_NO_MATCH); |
| 739 EXPECT_TRUE(manager5.HasValidPasswordForm()); | 742 EXPECT_TRUE(manager5.HasValidPasswordForm()); |
| 740 | 743 |
| 741 // Form without a password_element but with a username_element. | 744 // Form without a password_element but with a username_element. |
| 742 credentials.username_element = saved_match()->username_element; | 745 credentials.username_element = saved_match()->username_element; |
| 743 credentials.password_element.clear(); | 746 credentials.password_element.clear(); |
| 744 PasswordFormManager manager6(NULL, NULL, kNoDriver, credentials, false); | 747 PasswordFormManager manager6(nullptr, nullptr, kNoDriver, credentials, false); |
| 745 SimulateMatchingPhase(&manager6, RESULT_NO_MATCH); | 748 SimulateMatchingPhase(&manager6, RESULT_NO_MATCH); |
| 746 EXPECT_FALSE(manager6.HasValidPasswordForm()); | 749 EXPECT_FALSE(manager6.HasValidPasswordForm()); |
| 747 | 750 |
| 748 // Form with neither a password_element nor a username_element. | 751 // Form with neither a password_element nor a username_element. |
| 749 credentials.username_element.clear(); | 752 credentials.username_element.clear(); |
| 750 credentials.password_element.clear(); | 753 credentials.password_element.clear(); |
| 751 PasswordFormManager manager7(NULL, NULL, kNoDriver, credentials, false); | 754 PasswordFormManager manager7(nullptr, nullptr, kNoDriver, credentials, false); |
| 752 SimulateMatchingPhase(&manager7, RESULT_NO_MATCH); | 755 SimulateMatchingPhase(&manager7, RESULT_NO_MATCH); |
| 753 EXPECT_FALSE(manager7.HasValidPasswordForm()); | 756 EXPECT_FALSE(manager7.HasValidPasswordForm()); |
| 754 } | 757 } |
| 755 | 758 |
| 756 TEST_F(PasswordFormManagerTest, TestValidFormsBasic) { | 759 TEST_F(PasswordFormManagerTest, TestValidFormsBasic) { |
| 757 // User submits credentials for the observed form. | 760 // User submits credentials for the observed form. |
| 758 PasswordForm credentials = *observed_form(); | 761 PasswordForm credentials = *observed_form(); |
| 759 credentials.scheme = PasswordForm::SCHEME_BASIC; | 762 credentials.scheme = PasswordForm::SCHEME_BASIC; |
| 760 credentials.username_value = saved_match()->username_value; | 763 credentials.username_value = saved_match()->username_value; |
| 761 credentials.password_value = saved_match()->password_value; | 764 credentials.password_value = saved_match()->password_value; |
| 762 | 765 |
| 763 // Form with both username_element and password_element. | 766 // Form with both username_element and password_element. |
| 764 PasswordFormManager manager1(NULL, NULL, kNoDriver, credentials, false); | 767 PasswordFormManager manager1(nullptr, nullptr, kNoDriver, credentials, false); |
| 765 SimulateMatchingPhase(&manager1, RESULT_NO_MATCH); | 768 SimulateMatchingPhase(&manager1, RESULT_NO_MATCH); |
| 766 EXPECT_TRUE(manager1.HasValidPasswordForm()); | 769 EXPECT_TRUE(manager1.HasValidPasswordForm()); |
| 767 | 770 |
| 768 // Form without a username_element but with a password_element. | 771 // Form without a username_element but with a password_element. |
| 769 credentials.username_element.clear(); | 772 credentials.username_element.clear(); |
| 770 PasswordFormManager manager2(NULL, NULL, kNoDriver, credentials, false); | 773 PasswordFormManager manager2(nullptr, nullptr, kNoDriver, credentials, false); |
| 771 SimulateMatchingPhase(&manager2, RESULT_NO_MATCH); | 774 SimulateMatchingPhase(&manager2, RESULT_NO_MATCH); |
| 772 EXPECT_TRUE(manager2.HasValidPasswordForm()); | 775 EXPECT_TRUE(manager2.HasValidPasswordForm()); |
| 773 | 776 |
| 774 // Form without a password_element but with a username_element. | 777 // Form without a password_element but with a username_element. |
| 775 credentials.username_element = saved_match()->username_element; | 778 credentials.username_element = saved_match()->username_element; |
| 776 credentials.password_element.clear(); | 779 credentials.password_element.clear(); |
| 777 PasswordFormManager manager3(NULL, NULL, kNoDriver, credentials, false); | 780 PasswordFormManager manager3(nullptr, nullptr, kNoDriver, credentials, false); |
| 778 SimulateMatchingPhase(&manager3, RESULT_NO_MATCH); | 781 SimulateMatchingPhase(&manager3, RESULT_NO_MATCH); |
| 779 EXPECT_TRUE(manager3.HasValidPasswordForm()); | 782 EXPECT_TRUE(manager3.HasValidPasswordForm()); |
| 780 | 783 |
| 781 // Form with neither a password_element nor a username_element. | 784 // Form with neither a password_element nor a username_element. |
| 782 credentials.username_element.clear(); | 785 credentials.username_element.clear(); |
| 783 credentials.password_element.clear(); | 786 credentials.password_element.clear(); |
| 784 PasswordFormManager manager4(NULL, NULL, kNoDriver, credentials, false); | 787 PasswordFormManager manager4(nullptr, nullptr, kNoDriver, credentials, false); |
| 785 SimulateMatchingPhase(&manager4, RESULT_NO_MATCH); | 788 SimulateMatchingPhase(&manager4, RESULT_NO_MATCH); |
| 786 EXPECT_TRUE(manager4.HasValidPasswordForm()); | 789 EXPECT_TRUE(manager4.HasValidPasswordForm()); |
| 787 } | 790 } |
| 788 | 791 |
| 789 TEST_F(PasswordFormManagerTest, TestSendNotBlacklistedMessage) { | 792 TEST_F(PasswordFormManagerTest, TestSendNotBlacklistedMessage) { |
| 790 TestPasswordManager password_manager(client()); | 793 TestPasswordManager password_manager(client()); |
| 791 PasswordFormManager manager_no_creds( | 794 PasswordFormManager manager_no_creds( |
| 792 &password_manager, client(), client()->driver(), *observed_form(), false); | 795 &password_manager, client(), client()->driver(), *observed_form(), false); |
| 793 | 796 |
| 794 // First time sign-up attempt. Password store does not contain matching | 797 // First time sign-up attempt. Password store does not contain matching |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 simulated_results[1]->username_value = ASCIIToUTF16("other@gmail.com"); | 876 simulated_results[1]->username_value = ASCIIToUTF16("other@gmail.com"); |
| 874 simulated_results[1]->password_element = ASCIIToUTF16("signup_password"); | 877 simulated_results[1]->password_element = ASCIIToUTF16("signup_password"); |
| 875 simulated_results[1]->username_element = ASCIIToUTF16("signup_username"); | 878 simulated_results[1]->username_element = ASCIIToUTF16("signup_username"); |
| 876 simulated_results[1]->type = PasswordForm::TYPE_GENERATED; | 879 simulated_results[1]->type = PasswordForm::TYPE_GENERATED; |
| 877 SimulateFetchMatchingLoginsFromPasswordStore(&manager_no_match); | 880 SimulateFetchMatchingLoginsFromPasswordStore(&manager_no_match); |
| 878 manager_no_match.OnGetPasswordStoreResults(simulated_results.Pass()); | 881 manager_no_match.OnGetPasswordStoreResults(simulated_results.Pass()); |
| 879 EXPECT_EQ(2u, password_manager.GetLatestBestMatches().size()); | 882 EXPECT_EQ(2u, password_manager.GetLatestBestMatches().size()); |
| 880 } | 883 } |
| 881 | 884 |
| 882 TEST_F(PasswordFormManagerTest, TestSanitizePossibleUsernames) { | 885 TEST_F(PasswordFormManagerTest, TestSanitizePossibleUsernames) { |
| 883 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 886 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 884 false); | 887 false); |
| 885 PasswordForm credentials(*observed_form()); | 888 PasswordForm credentials(*observed_form()); |
| 886 credentials.other_possible_usernames.push_back(ASCIIToUTF16("543-43-1234")); | 889 credentials.other_possible_usernames.push_back(ASCIIToUTF16("543-43-1234")); |
| 887 credentials.other_possible_usernames.push_back( | 890 credentials.other_possible_usernames.push_back( |
| 888 ASCIIToUTF16("378282246310005")); | 891 ASCIIToUTF16("378282246310005")); |
| 889 credentials.other_possible_usernames.push_back( | 892 credentials.other_possible_usernames.push_back( |
| 890 ASCIIToUTF16("other username")); | 893 ASCIIToUTF16("other username")); |
| 891 credentials.username_value = ASCIIToUTF16("test@gmail.com"); | 894 credentials.username_value = ASCIIToUTF16("test@gmail.com"); |
| 892 | 895 |
| 893 SanitizePossibleUsernames(&manager, &credentials); | 896 SanitizePossibleUsernames(&manager, &credentials); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 GURL("http://accounts.google.com/a/ServiceLogin2"); | 1005 GURL("http://accounts.google.com/a/ServiceLogin2"); |
| 1003 SimulateFetchMatchingLoginsFromPasswordStore(&manager); | 1006 SimulateFetchMatchingLoginsFromPasswordStore(&manager); |
| 1004 manager.OnGetPasswordStoreResults(simulated_results.Pass()); | 1007 manager.OnGetPasswordStoreResults(simulated_results.Pass()); |
| 1005 EXPECT_EQ(1u, password_manager.GetLatestBestMatches().size()); | 1008 EXPECT_EQ(1u, password_manager.GetLatestBestMatches().size()); |
| 1006 EXPECT_EQ("", password_manager.GetLatestBestMatches() | 1009 EXPECT_EQ("", password_manager.GetLatestBestMatches() |
| 1007 .begin() | 1010 .begin() |
| 1008 ->second->original_signon_realm); | 1011 ->second->original_signon_realm); |
| 1009 } | 1012 } |
| 1010 | 1013 |
| 1011 TEST_F(PasswordFormManagerTest, InvalidActionURLsDoNotMatch) { | 1014 TEST_F(PasswordFormManagerTest, InvalidActionURLsDoNotMatch) { |
| 1012 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 1015 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 1013 false); | 1016 false); |
| 1014 | 1017 |
| 1015 PasswordForm invalid_action_form(*observed_form()); | 1018 PasswordForm invalid_action_form(*observed_form()); |
| 1016 invalid_action_form.action = GURL("http://"); | 1019 invalid_action_form.action = GURL("http://"); |
| 1017 ASSERT_FALSE(invalid_action_form.action.is_valid()); | 1020 ASSERT_FALSE(invalid_action_form.action.is_valid()); |
| 1018 ASSERT_FALSE(invalid_action_form.action.is_empty()); | 1021 ASSERT_FALSE(invalid_action_form.action.is_empty()); |
| 1019 // Non-empty invalid action URLs should not match other actions. | 1022 // Non-empty invalid action URLs should not match other actions. |
| 1020 // First when the compared form has an invalid URL: | 1023 // First when the compared form has an invalid URL: |
| 1021 EXPECT_EQ(0, | 1024 EXPECT_EQ(0, |
| 1022 manager.DoesManage(invalid_action_form) & | 1025 manager.DoesManage(invalid_action_form) & |
| 1023 PasswordFormManager::RESULT_ACTION_MATCH); | 1026 PasswordFormManager::RESULT_ACTION_MATCH); |
| 1024 // Then when the observed form has an invalid URL: | 1027 // Then when the observed form has an invalid URL: |
| 1025 PasswordForm valid_action_form(*observed_form()); | 1028 PasswordForm valid_action_form(*observed_form()); |
| 1026 PasswordFormManager invalid_manager(NULL, client(), kNoDriver, | 1029 PasswordFormManager invalid_manager(nullptr, client(), kNoDriver, |
| 1027 invalid_action_form, false); | 1030 invalid_action_form, false); |
| 1028 EXPECT_EQ(0, | 1031 EXPECT_EQ(0, |
| 1029 invalid_manager.DoesManage(valid_action_form) & | 1032 invalid_manager.DoesManage(valid_action_form) & |
| 1030 PasswordFormManager::RESULT_ACTION_MATCH); | 1033 PasswordFormManager::RESULT_ACTION_MATCH); |
| 1031 } | 1034 } |
| 1032 | 1035 |
| 1033 TEST_F(PasswordFormManagerTest, EmptyActionURLsDoNotMatchNonEmpty) { | 1036 TEST_F(PasswordFormManagerTest, EmptyActionURLsDoNotMatchNonEmpty) { |
| 1034 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 1037 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 1035 false); | 1038 false); |
| 1036 | 1039 |
| 1037 PasswordForm empty_action_form(*observed_form()); | 1040 PasswordForm empty_action_form(*observed_form()); |
| 1038 empty_action_form.action = GURL(); | 1041 empty_action_form.action = GURL(); |
| 1039 ASSERT_FALSE(empty_action_form.action.is_valid()); | 1042 ASSERT_FALSE(empty_action_form.action.is_valid()); |
| 1040 ASSERT_TRUE(empty_action_form.action.is_empty()); | 1043 ASSERT_TRUE(empty_action_form.action.is_empty()); |
| 1041 // First when the compared form has an empty URL: | 1044 // First when the compared form has an empty URL: |
| 1042 EXPECT_EQ(0, | 1045 EXPECT_EQ(0, |
| 1043 manager.DoesManage(empty_action_form) & | 1046 manager.DoesManage(empty_action_form) & |
| 1044 PasswordFormManager::RESULT_ACTION_MATCH); | 1047 PasswordFormManager::RESULT_ACTION_MATCH); |
| 1045 // Then when the observed form has an empty URL: | 1048 // Then when the observed form has an empty URL: |
| 1046 PasswordForm valid_action_form(*observed_form()); | 1049 PasswordForm valid_action_form(*observed_form()); |
| 1047 PasswordFormManager empty_action_manager(NULL, client(), kNoDriver, | 1050 PasswordFormManager empty_action_manager(nullptr, client(), kNoDriver, |
| 1048 empty_action_form, false); | 1051 empty_action_form, false); |
| 1049 EXPECT_EQ(0, | 1052 EXPECT_EQ(0, |
| 1050 empty_action_manager.DoesManage(valid_action_form) & | 1053 empty_action_manager.DoesManage(valid_action_form) & |
| 1051 PasswordFormManager::RESULT_ACTION_MATCH); | 1054 PasswordFormManager::RESULT_ACTION_MATCH); |
| 1052 } | 1055 } |
| 1053 | 1056 |
| 1054 TEST_F(PasswordFormManagerTest, NonHTMLFormsDoNotMatchHTMLForms) { | 1057 TEST_F(PasswordFormManagerTest, NonHTMLFormsDoNotMatchHTMLForms) { |
| 1055 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 1058 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 1056 false); | 1059 false); |
| 1057 | 1060 |
| 1058 ASSERT_EQ(PasswordForm::SCHEME_HTML, observed_form()->scheme); | 1061 ASSERT_EQ(PasswordForm::SCHEME_HTML, observed_form()->scheme); |
| 1059 PasswordForm non_html_form(*observed_form()); | 1062 PasswordForm non_html_form(*observed_form()); |
| 1060 non_html_form.scheme = PasswordForm::SCHEME_DIGEST; | 1063 non_html_form.scheme = PasswordForm::SCHEME_DIGEST; |
| 1061 EXPECT_EQ(0, | 1064 EXPECT_EQ(0, |
| 1062 manager.DoesManage(non_html_form) & | 1065 manager.DoesManage(non_html_form) & |
| 1063 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); | 1066 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); |
| 1064 | 1067 |
| 1065 // The other way round: observing a non-HTML form, don't match a HTML form. | 1068 // The other way round: observing a non-HTML form, don't match a HTML form. |
| 1066 PasswordForm html_form(*observed_form()); | 1069 PasswordForm html_form(*observed_form()); |
| 1067 PasswordFormManager non_html_manager(NULL, client(), kNoDriver, non_html_form, | 1070 PasswordFormManager non_html_manager(nullptr, client(), kNoDriver, |
| 1068 false); | 1071 non_html_form, false); |
| 1069 EXPECT_EQ(0, | 1072 EXPECT_EQ(0, |
| 1070 non_html_manager.DoesManage(html_form) & | 1073 non_html_manager.DoesManage(html_form) & |
| 1071 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); | 1074 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); |
| 1072 } | 1075 } |
| 1073 | 1076 |
| 1074 TEST_F(PasswordFormManagerTest, OriginCheck_HostsMatchExactly) { | 1077 TEST_F(PasswordFormManagerTest, OriginCheck_HostsMatchExactly) { |
| 1075 // Host part of origins must match exactly, not just by prefix. | 1078 // Host part of origins must match exactly, not just by prefix. |
| 1076 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 1079 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 1077 false); | 1080 false); |
| 1078 | 1081 |
| 1079 PasswordForm form_longer_host(*observed_form()); | 1082 PasswordForm form_longer_host(*observed_form()); |
| 1080 form_longer_host.origin = GURL("http://accounts.google.com.au/a/LoginAuth"); | 1083 form_longer_host.origin = GURL("http://accounts.google.com.au/a/LoginAuth"); |
| 1081 // Check that accounts.google.com does not match accounts.google.com.au. | 1084 // Check that accounts.google.com does not match accounts.google.com.au. |
| 1082 EXPECT_EQ(0, | 1085 EXPECT_EQ(0, |
| 1083 manager.DoesManage(form_longer_host) & | 1086 manager.DoesManage(form_longer_host) & |
| 1084 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); | 1087 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); |
| 1085 } | 1088 } |
| 1086 | 1089 |
| 1087 TEST_F(PasswordFormManagerTest, OriginCheck_MoreSecureSchemePathsMatchPrefix) { | 1090 TEST_F(PasswordFormManagerTest, OriginCheck_MoreSecureSchemePathsMatchPrefix) { |
| 1088 // If the URL scheme of the observed form is HTTP, and the compared form is | 1091 // If the URL scheme of the observed form is HTTP, and the compared form is |
| 1089 // HTTPS, then the compared form can extend the path. | 1092 // HTTPS, then the compared form can extend the path. |
| 1090 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 1093 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 1091 false); | 1094 false); |
| 1092 | 1095 |
| 1093 PasswordForm form_longer_path(*observed_form()); | 1096 PasswordForm form_longer_path(*observed_form()); |
| 1094 form_longer_path.origin = GURL("https://accounts.google.com/a/LoginAuth/sec"); | 1097 form_longer_path.origin = GURL("https://accounts.google.com/a/LoginAuth/sec"); |
| 1095 EXPECT_NE(0, | 1098 EXPECT_NE(0, |
| 1096 manager.DoesManage(form_longer_path) & | 1099 manager.DoesManage(form_longer_path) & |
| 1097 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); | 1100 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); |
| 1098 } | 1101 } |
| 1099 | 1102 |
| 1100 TEST_F(PasswordFormManagerTest, | 1103 TEST_F(PasswordFormManagerTest, |
| 1101 OriginCheck_NotMoreSecureSchemePathsMatchExactly) { | 1104 OriginCheck_NotMoreSecureSchemePathsMatchExactly) { |
| 1102 // If the origin URL scheme of the compared form is not more secure than that | 1105 // If the origin URL scheme of the compared form is not more secure than that |
| 1103 // of the observed form, then the paths must match exactly. | 1106 // of the observed form, then the paths must match exactly. |
| 1104 PasswordFormManager manager(NULL, client(), kNoDriver, *observed_form(), | 1107 PasswordFormManager manager(nullptr, client(), kNoDriver, *observed_form(), |
| 1105 false); | 1108 false); |
| 1106 | 1109 |
| 1107 PasswordForm form_longer_path(*observed_form()); | 1110 PasswordForm form_longer_path(*observed_form()); |
| 1108 form_longer_path.origin = GURL("http://accounts.google.com/a/LoginAuth/sec"); | 1111 form_longer_path.origin = GURL("http://accounts.google.com/a/LoginAuth/sec"); |
| 1109 // Check that /a/LoginAuth does not match /a/LoginAuth/more. | 1112 // Check that /a/LoginAuth does not match /a/LoginAuth/more. |
| 1110 EXPECT_EQ(0, | 1113 EXPECT_EQ(0, |
| 1111 manager.DoesManage(form_longer_path) & | 1114 manager.DoesManage(form_longer_path) & |
| 1112 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); | 1115 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); |
| 1113 | 1116 |
| 1114 PasswordForm secure_observed_form(*observed_form()); | 1117 PasswordForm secure_observed_form(*observed_form()); |
| 1115 secure_observed_form.origin = GURL("https://accounts.google.com/a/LoginAuth"); | 1118 secure_observed_form.origin = GURL("https://accounts.google.com/a/LoginAuth"); |
| 1116 PasswordFormManager secure_manager(NULL, client(), kNoDriver, | 1119 PasswordFormManager secure_manager(nullptr, client(), kNoDriver, |
| 1117 secure_observed_form, true); | 1120 secure_observed_form, true); |
| 1118 // Also for HTTPS in the observed form, and HTTP in the compared form, an | 1121 // Also for HTTPS in the observed form, and HTTP in the compared form, an |
| 1119 // exact path match is expected. | 1122 // exact path match is expected. |
| 1120 EXPECT_EQ(0, | 1123 EXPECT_EQ(0, |
| 1121 secure_manager.DoesManage(form_longer_path) & | 1124 secure_manager.DoesManage(form_longer_path) & |
| 1122 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); | 1125 PasswordFormManager::RESULT_MANDATORY_ATTRIBUTES_MATCH); |
| 1123 // Not even upgrade to HTTPS in the compared form should help. | 1126 // Not even upgrade to HTTPS in the compared form should help. |
| 1124 form_longer_path.origin = GURL("https://accounts.google.com/a/LoginAuth/sec"); | 1127 form_longer_path.origin = GURL("https://accounts.google.com/a/LoginAuth/sec"); |
| 1125 EXPECT_EQ(0, | 1128 EXPECT_EQ(0, |
| 1126 secure_manager.DoesManage(form_longer_path) & | 1129 secure_manager.DoesManage(form_longer_path) & |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 // The user submits a password on a change-password form, which does not use | 1435 // The user submits a password on a change-password form, which does not use |
| 1433 // the "autocomplete=username" mark-up (therefore Chrome had to guess what is | 1436 // the "autocomplete=username" mark-up (therefore Chrome had to guess what is |
| 1434 // the username), and the user-typed username does not match anything already | 1437 // the username), and the user-typed username does not match anything already |
| 1435 // stored. There is not much confidence in the guess being right, so the | 1438 // stored. There is not much confidence in the guess being right, so the |
| 1436 // password should not be stored. | 1439 // password should not be stored. |
| 1437 EXPECT_TRUE(manager.IsIgnorableChangePasswordForm( | 1440 EXPECT_TRUE(manager.IsIgnorableChangePasswordForm( |
| 1438 ASCIIToUTF16("DifferentUsername"), saved_match()->password_value)); | 1441 ASCIIToUTF16("DifferentUsername"), saved_match()->password_value)); |
| 1439 } | 1442 } |
| 1440 | 1443 |
| 1441 } // namespace password_manager | 1444 } // namespace password_manager |
| OLD | NEW |