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

Side by Side Diff: chrome/renderer/autofill/password_generation_agent_browsertest.cc

Issue 2917933002: [PasswordGeneration] Improve change/confirm password field detection. (Closed)
Patch Set: Address comments from dvadym@. Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string.h> 5 #include <string.h>
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 601
602 TEST_F(PasswordGenerationAgentTest, AutocompleteAttributesTest) { 602 TEST_F(PasswordGenerationAgentTest, AutocompleteAttributesTest) {
603 // Verify that autocomplete attributes can override Autofill to enable 603 // Verify that autocomplete attributes can override Autofill to enable
604 // generation 604 // generation
605 LoadHTMLWithUserGesture(kBothAutocompleteAttributesFormHTML); 605 LoadHTMLWithUserGesture(kBothAutocompleteAttributesFormHTML);
606 SetNotBlacklistedMessage(password_generation_, 606 SetNotBlacklistedMessage(password_generation_,
607 kBothAutocompleteAttributesFormHTML); 607 kBothAutocompleteAttributesFormHTML);
608 608
609 ExpectGenerationAvailable("first_password", true); 609 ExpectGenerationAvailable("first_password", true);
610 610
611 // Only setting one of the two attributes doesn't trigger generation. 611 // Only setting one of the two attributes doesn't trigger generation.
dvadym 2017/06/08 14:56:59 This comment doesn't true anymore
pkalinnikov 2017/06/09 08:02:42 Fixed.
612 LoadHTMLWithUserGesture(kUsernameAutocompleteAttributeFormHTML); 612 LoadHTMLWithUserGesture(kUsernameAutocompleteAttributeFormHTML);
613 SetNotBlacklistedMessage(password_generation_, 613 SetNotBlacklistedMessage(password_generation_,
614 kUsernameAutocompleteAttributeFormHTML); 614 kUsernameAutocompleteAttributeFormHTML);
615 615
616 ExpectGenerationAvailable("first_password", false); 616 ExpectGenerationAvailable("first_password", false);
617 617
618 LoadHTMLWithUserGesture(kNewPasswordAutocompleteAttributeFormHTML); 618 LoadHTMLWithUserGesture(kNewPasswordAutocompleteAttributeFormHTML);
619 SetNotBlacklistedMessage(password_generation_, 619 SetNotBlacklistedMessage(password_generation_,
620 kNewPasswordAutocompleteAttributeFormHTML); 620 kNewPasswordAutocompleteAttributeFormHTML);
621 621
622 ExpectGenerationAvailable("first_password", false); 622 ExpectGenerationAvailable("first_password", true);
dvadym 2017/06/08 14:56:59 Could you please add here the checking form withou
pkalinnikov 2017/06/09 08:02:42 Done.
623 } 623 }
624 624
625 TEST_F(PasswordGenerationAgentTest, ChangePasswordFormDetectionTest) { 625 TEST_F(PasswordGenerationAgentTest, ChangePasswordFormDetectionTest) {
626 // Verify that generation is shown on correct field after message receiving. 626 // Verify that generation is shown on correct field after message receiving.
627 LoadHTMLWithUserGesture(kPasswordChangeFormHTML); 627 LoadHTMLWithUserGesture(kPasswordChangeFormHTML);
628 SetNotBlacklistedMessage(password_generation_, kPasswordChangeFormHTML); 628 SetNotBlacklistedMessage(password_generation_, kPasswordChangeFormHTML);
629 ExpectGenerationAvailable("password", false); 629 ExpectGenerationAvailable("password", false);
630 ExpectGenerationAvailable("newpassword", false); 630 ExpectGenerationAvailable("newpassword", false);
631 ExpectGenerationAvailable("confirmpassword", false); 631 ExpectGenerationAvailable("confirmpassword", false);
632 632
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 ExpectGenerationAvailable(kGenerationElementId, true); 806 ExpectGenerationAvailable(kGenerationElementId, true);
807 password_generation_->GeneratedPasswordAccepted(base::ASCIIToUTF16("pwd")); 807 password_generation_->GeneratedPasswordAccepted(base::ASCIIToUTF16("pwd"));
808 ExecuteJavaScriptForTests( 808 ExecuteJavaScriptForTests(
809 "document.getElementById('first_password').value = '';"); 809 "document.getElementById('first_password').value = '';");
810 FocusField(kGenerationElementId); 810 FocusField(kGenerationElementId);
811 base::RunLoop().RunUntilIdle(); 811 base::RunLoop().RunUntilIdle();
812 EXPECT_TRUE(fake_driver_.called_password_no_longer_generated()); 812 EXPECT_TRUE(fake_driver_.called_password_no_longer_generated());
813 } 813 }
814 814
815 } // namespace autofill 815 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698