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

Side by Side Diff: components/password_manager/core/browser/password_manager_unittest.cc

Issue 488083002: [Password Manager] Fix to recognise failed login attempt for sites where content server pushes new … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@branch_autofill_todo_20140813
Patch Set: Updated as per review comments. Created 6 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 unified diff | Download patch
« no previous file with comments | « components/password_manager/core/browser/password_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 5 #include <vector>
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); 751 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0));
752 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))).Times(Exactly(0)); 752 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))).Times(Exactly(0));
753 753
754 // Submit form and finish navigation. 754 // Submit form and finish navigation.
755 manager()->ProvisionallySavePassword(form); 755 manager()->ProvisionallySavePassword(form);
756 observed.clear(); 756 observed.clear();
757 manager()->OnPasswordFormsParsed(observed); 757 manager()->OnPasswordFormsParsed(observed);
758 manager()->OnPasswordFormsRendered(observed, true); 758 manager()->OnPasswordFormsRendered(observed, true);
759 } 759 }
760 760
761 // On failed login attempts, the retry-form can have action scheme changed from
762 // HTTP to HTTPS (see http://crbug.com/400769). Check that such retry-form is
763 // considered equal to the original login form, and the attempt recognised as a
764 // failure.
765 TEST_F(PasswordManagerTest,
766 SeeingFormActionWithOnlyHttpHttpsChangeIsLoginFailure) {
767 std::vector<PasswordForm*> result; // Empty password store.
768 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0));
769 EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
770 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return()));
771
772 PasswordForm first_form(MakeSimpleForm());
773 first_form.origin = GURL("http://www.xda-developers.com/");
774 first_form.action = GURL("http://forum.xda-developers.com/login.php");
775
776 // |second_form|'s action differs only with it's scheme i.e. *https://*.
777 PasswordForm second_form(first_form);
778 second_form.action = GURL("https://forum.xda-developers.com/login.php");
779
780 std::vector<PasswordForm> observed;
781 observed.push_back(first_form);
782 manager()->OnPasswordFormsParsed(observed);
783 manager()->OnPasswordFormsRendered(observed, true);
784 observed.clear();
785
786 // Now submit the |first_form|.
787 OnPasswordFormSubmitted(first_form);
788
789 // Simulate loading a page, which contains |second_form| instead of
790 // |first_form|.
791 observed.push_back(second_form);
792
793 // Verify that no prompt to save the password is shown.
794 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0));
795 manager()->OnPasswordFormsParsed(observed);
796 manager()->OnPasswordFormsRendered(observed, true);
797 observed.clear();
798 }
799
761 } // namespace password_manager 800 } // namespace password_manager
OLDNEW
« no previous file with comments | « components/password_manager/core/browser/password_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698