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 "components/password_manager/core/browser/password_manager.h" | 5 #include "components/password_manager/core/browser/password_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); | 272 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); |
273 | 273 |
274 // Simulate saving the form, as if the info bar was accepted. | 274 // Simulate saving the form, as if the info bar was accepted. |
275 form_to_save->Save(); | 275 form_to_save->Save(); |
276 } | 276 } |
277 | 277 |
278 TEST_F(PasswordManagerTest, FormSubmitWithOnlyNewPasswordField) { | 278 TEST_F(PasswordManagerTest, FormSubmitWithOnlyNewPasswordField) { |
279 // This test is the same as FormSubmitEmptyStore, except that it simulates the | 279 // This test is the same as FormSubmitEmptyStore, except that it simulates the |
280 // user entering credentials into a sign-up form that only has a new password | 280 // user entering credentials into a sign-up form that only has a new password |
281 // field. | 281 // field. |
282 std::vector<PasswordForm*> result; // Empty password store. | |
vabr (Chromium)
2015/02/10 18:54:57
Please revert the added lines 282 and 284-285, the
Pritam Nikam
2015/02/19 11:18:49
Done.
| |
282 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 283 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
284 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | |
285 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | |
283 std::vector<PasswordForm> observed; | 286 std::vector<PasswordForm> observed; |
284 PasswordForm form(MakeFormWithOnlyNewPasswordField()); | 287 PasswordForm form(MakeFormWithOnlyNewPasswordField()); |
285 observed.push_back(form); | 288 observed.push_back(form); |
286 manager()->OnPasswordFormsParsed(&driver_, observed); | 289 manager()->OnPasswordFormsParsed(&driver_, observed); |
287 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 290 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
288 | 291 |
289 // And the form submit contract is to call ProvisionallySavePassword. | 292 // And the form submit contract is to call ProvisionallySavePassword. |
290 manager()->ProvisionallySavePassword(form); | 293 manager()->ProvisionallySavePassword(form); |
291 | 294 |
292 scoped_ptr<PasswordFormManager> form_to_save; | 295 scoped_ptr<PasswordFormManager> form_to_save; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
929 manager()->ProvisionallySavePassword(form); | 932 manager()->ProvisionallySavePassword(form); |
930 | 933 |
931 scoped_ptr<PasswordFormManager> form_to_save; | 934 scoped_ptr<PasswordFormManager> form_to_save; |
932 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) | 935 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
933 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); | 936 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
934 | 937 |
935 manager()->OnInPageNavigation(&driver_, form); | 938 manager()->OnInPageNavigation(&driver_, form); |
936 } | 939 } |
937 | 940 |
938 } // namespace password_manager | 941 } // namespace password_manager |
OLD | NEW |