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

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: Incorporatd review comments and added unit-tests Created 6 years, 4 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 (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 // Verify that the form submission resulting into concent-server pushing
vabr (Chromium) 2014/08/26 09:42:59 nit: Although generally correct, the sentence is a
Pritam Nikam 2014/08/26 12:41:34 Done.
762 // seperate form where actions differing only in their schemes shall not prompt
763 // password save popup dialog.
764 TEST_F(PasswordManagerTest,
765 FormSubmitWithNavigateToNewFormDifferingActionsOnlyBySchemes) {
vabr (Chromium) 2014/08/26 09:42:59 nit: The test name does not state what is tested,
Pritam Nikam 2014/08/26 12:41:34 Done.
766 std::vector<PasswordForm*> result; // Empty password store.
767 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0));
768 EXPECT_CALL(*store_.get(), GetLogins(_, _, _))
769 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return()));
770 PasswordForm first_form(MakeSimpleForm());
771 first_form.origin = GURL("http://www.xda-developers.com/");
772 first_form.action = GURL("http://forum.xda-developers.com/login.php");
773 first_form.signon_realm = "http://www.xda-developers.com/";
774 PasswordForm second_form(MakeSimpleForm());
vabr (Chromium) 2014/08/26 09:42:59 nit: Create this form from the previous, to emphas
Pritam Nikam 2014/08/26 12:41:34 Done.
775 second_form.origin = GURL("http://forum.xda-developers.com/login.php");
vabr (Chromium) 2014/08/26 09:42:59 The origin is not related to the tested change, so
Pritam Nikam 2014/08/26 12:41:34 Done.
776 second_form.action = GURL("https://forum.xda-developers.com/login.php");
vabr (Chromium) 2014/08/26 09:42:59 nit: Please add a comment emphasising that the cha
Pritam Nikam 2014/08/26 12:41:34 Done.
777 second_form.signon_realm = "http://www.xda-developers.com/";
vabr (Chromium) 2014/08/26 09:42:59 You can drop this if you create second_form based
Pritam Nikam 2014/08/26 12:41:34 Done.
778
779 std::vector<PasswordForm> observed;
780 observed.push_back(first_form);
781 manager()->OnPasswordFormsParsed(observed);
782 observed.clear();
783 manager()->OnPasswordFormsRendered(observed, true);
vabr (Chromium) 2014/08/26 09:42:59 Why do you clear |observed| before calling OnPassw
Pritam Nikam 2014/08/26 12:41:34 Done.
784
785 // Now submit the first form.
786 OnPasswordFormSubmitted(first_form);
787
788 // This page contains a form with the same action, but on a different scheme,
vabr (Chromium) 2014/08/26 09:42:59 nit: No need to comment on the difference, it shou
Pritam Nikam 2014/08/26 12:41:34 Done.
789 // i.e. "http://" to "https://".
790 observed.push_back(second_form);
791
792 // Verify that not to prompt with password save popup dialog.
vabr (Chromium) 2014/08/26 09:42:59 grammar nit: "Verify that no prompt to save the pa
Pritam Nikam 2014/08/26 12:41:34 Done.
793 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0));
794 manager()->OnPasswordFormsParsed(observed);
795 manager()->OnPasswordFormsRendered(observed, true);
796 observed.clear();
797 }
798
761 } // namespace password_manager 799 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698