Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 } | 60 } |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 class MockPasswordManagerDriver : public StubPasswordManagerDriver { | 63 class MockPasswordManagerDriver : public StubPasswordManagerDriver { |
| 64 public: | 64 public: |
| 65 MOCK_METHOD1(FillPasswordForm, void(const autofill::PasswordFormFillData&)); | 65 MOCK_METHOD1(FillPasswordForm, void(const autofill::PasswordFormFillData&)); |
| 66 MOCK_METHOD0(GetPasswordManager, PasswordManager*()); | 66 MOCK_METHOD0(GetPasswordManager, PasswordManager*()); |
| 67 MOCK_METHOD0(GetPasswordAutofillManager, PasswordAutofillManager*()); | 67 MOCK_METHOD0(GetPasswordAutofillManager, PasswordAutofillManager*()); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 ACTION_P(InvokeConsumer, forms) { arg0->OnGetPasswordStoreResults(forms); } | 70 ACTION_P(InvokeConsumer, forms) { |
| 71 arg0->OnGetPasswordStoreResults(forms->Pass()); | |
| 72 } | |
| 71 | 73 |
| 72 ACTION_P(SaveToScopedPtr, scoped) { scoped->reset(arg0); } | 74 ACTION_P(SaveToScopedPtr, scoped) { scoped->reset(arg0); } |
| 73 | 75 |
| 74 class TestPasswordManager : public PasswordManager { | 76 class TestPasswordManager : public PasswordManager { |
| 75 public: | 77 public: |
| 76 explicit TestPasswordManager(PasswordManagerClient* client) | 78 explicit TestPasswordManager(PasswordManagerClient* client) |
| 77 : PasswordManager(client) {} | 79 : PasswordManager(client) {} |
| 78 ~TestPasswordManager() override {} | 80 ~TestPasswordManager() override {} |
| 79 | 81 |
| 80 private: | 82 private: |
| 81 DISALLOW_COPY_AND_ASSIGN(TestPasswordManager); | 83 DISALLOW_COPY_AND_ASSIGN(TestPasswordManager); |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 } // namespace | 86 } // namespace |
| 85 | 87 |
| 86 class PasswordManagerTest : public testing::Test { | 88 class PasswordManagerTest : public testing::Test { |
| 87 protected: | 89 protected: |
| 88 void SetUp() override { | 90 void SetUp() override { |
| 89 prefs_.registry()->RegisterBooleanPref(prefs::kPasswordManagerSavingEnabled, | 91 prefs_.registry()->RegisterBooleanPref(prefs::kPasswordManagerSavingEnabled, |
| 90 true); | 92 true); |
| 91 | 93 |
| 92 store_ = new MockPasswordStore; | 94 store_ = new MockPasswordStore; |
| 93 EXPECT_CALL(*store_.get(), ReportMetrics(_, _)).Times(AnyNumber()); | 95 EXPECT_CALL(*store_, ReportMetrics(_, _)).Times(AnyNumber()); |
| 94 CHECK(store_->Init(syncer::SyncableService::StartSyncFlare())); | 96 CHECK(store_->Init(syncer::SyncableService::StartSyncFlare())); |
| 95 | 97 |
| 96 EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage()) | 98 EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage()) |
| 97 .WillRepeatedly(Return(true)); | 99 .WillRepeatedly(Return(true)); |
| 98 EXPECT_CALL(client_, IsSyncAccountCredential(_, _)) | 100 EXPECT_CALL(client_, IsSyncAccountCredential(_, _)) |
| 99 .WillRepeatedly(Return(false)); | 101 .WillRepeatedly(Return(false)); |
| 100 EXPECT_CALL(client_, GetPasswordStore()) | 102 EXPECT_CALL(client_, GetPasswordStore()) |
| 101 .WillRepeatedly(Return(store_.get())); | 103 .WillRepeatedly(Return(store_.get())); |
| 102 EXPECT_CALL(client_, GetPrefs()).WillRepeatedly(Return(&prefs_)); | 104 EXPECT_CALL(client_, GetPrefs()).WillRepeatedly(Return(&prefs_)); |
| 103 EXPECT_CALL(client_, GetDriver()).WillRepeatedly(Return(&driver_)); | 105 EXPECT_CALL(client_, GetDriver()).WillRepeatedly(Return(&driver_)); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 form.action == arg.action && | 237 form.action == arg.action && |
| 236 form.username_element == arg.username_element && | 238 form.username_element == arg.username_element && |
| 237 form.password_element == arg.password_element && | 239 form.password_element == arg.password_element && |
| 238 form.new_password_element == arg.new_password_element && | 240 form.new_password_element == arg.new_password_element && |
| 239 form.password_autocomplete_set == arg.password_autocomplete_set && | 241 form.password_autocomplete_set == arg.password_autocomplete_set && |
| 240 form.submit_element == arg.submit_element; | 242 form.submit_element == arg.submit_element; |
| 241 } | 243 } |
| 242 | 244 |
| 243 TEST_F(PasswordManagerTest, FormSubmitEmptyStore) { | 245 TEST_F(PasswordManagerTest, FormSubmitEmptyStore) { |
| 244 // Test that observing a newly submitted form shows the save password bar. | 246 // Test that observing a newly submitted form shows the save password bar. |
| 245 std::vector<PasswordForm*> result; // Empty password store. | 247 ScopedVector<PasswordForm> result; // Empty password store. |
| 246 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 248 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 247 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 249 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 248 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 250 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
|
vasilii
2015/02/05 19:23:27
Do you really need Return() here and below?
vabr (Chromium)
2015/02/06 14:16:05
No. :) Done.
| |
| 249 std::vector<PasswordForm> observed; | 251 std::vector<PasswordForm> observed; |
| 250 PasswordForm form(MakeSimpleForm()); | 252 PasswordForm form(MakeSimpleForm()); |
| 251 observed.push_back(form); | 253 observed.push_back(form); |
| 252 // The initial load. | 254 // The initial load. |
| 253 manager()->OnPasswordFormsParsed(&driver_, observed); | 255 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 254 // The initial layout. | 256 // The initial layout. |
| 255 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 257 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| 256 | 258 |
| 257 // And the form submit contract is to call ProvisionallySavePassword. | 259 // And the form submit contract is to call ProvisionallySavePassword. |
| 258 manager()->ProvisionallySavePassword(form); | 260 manager()->ProvisionallySavePassword(form); |
| 259 | 261 |
| 260 scoped_ptr<PasswordFormManager> form_to_save; | 262 scoped_ptr<PasswordFormManager> form_to_save; |
| 261 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) | 263 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
| 262 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); | 264 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
| 263 | 265 |
| 264 // Now the password manager waits for the navigation to complete. | 266 // Now the password manager waits for the navigation to complete. |
| 265 observed.clear(); | 267 observed.clear(); |
| 266 // The post-navigation load. | 268 // The post-navigation load. |
| 267 manager()->OnPasswordFormsParsed(&driver_, observed); | 269 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 268 // The post-navigation layout. | 270 // The post-navigation layout. |
| 269 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 271 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| 270 | 272 |
| 271 ASSERT_TRUE(form_to_save.get()); | 273 ASSERT_TRUE(form_to_save.get()); |
| 272 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); | 274 EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| 273 | 275 |
| 274 // Simulate saving the form, as if the info bar was accepted. | 276 // Simulate saving the form, as if the info bar was accepted. |
| 275 form_to_save->Save(); | 277 form_to_save->Save(); |
| 276 } | 278 } |
| 277 | 279 |
| 278 TEST_F(PasswordManagerTest, FormSubmitWithOnlyNewPasswordField) { | 280 TEST_F(PasswordManagerTest, FormSubmitWithOnlyNewPasswordField) { |
| 279 // This test is the same as FormSubmitEmptyStore, except that it simulates the | 281 // 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 | 282 // user entering credentials into a sign-up form that only has a new password |
| 281 // field. | 283 // field. |
| 282 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 284 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 295 | 297 |
| 296 // Now the password manager waits for the navigation to complete. | 298 // Now the password manager waits for the navigation to complete. |
| 297 observed.clear(); | 299 observed.clear(); |
| 298 manager()->OnPasswordFormsParsed(&driver_, observed); | 300 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 299 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 301 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| 300 | 302 |
| 301 ASSERT_TRUE(form_to_save.get()); | 303 ASSERT_TRUE(form_to_save.get()); |
| 302 | 304 |
| 303 // Simulate saving the form, as if the info bar was accepted. | 305 // Simulate saving the form, as if the info bar was accepted. |
| 304 PasswordForm saved_form; | 306 PasswordForm saved_form; |
| 305 EXPECT_CALL(*store_.get(), AddLogin(_)) | 307 EXPECT_CALL(*store_, AddLogin(_)).WillOnce(testing::SaveArg<0>(&saved_form)); |
| 306 .WillOnce(testing::SaveArg<0>(&saved_form)); | |
| 307 form_to_save->Save(); | 308 form_to_save->Save(); |
| 308 | 309 |
| 309 // The value of the new password field should have been promoted to, and saved | 310 // The value of the new password field should have been promoted to, and saved |
| 310 // to the password store as the current password, and no password element name | 311 // to the password store as the current password, and no password element name |
| 311 // should have been saved. | 312 // should have been saved. |
| 312 PasswordForm expected_form(form); | 313 PasswordForm expected_form(form); |
| 313 expected_form.password_value.swap(expected_form.new_password_value); | 314 expected_form.password_value.swap(expected_form.new_password_value); |
| 314 expected_form.new_password_element.clear(); | 315 expected_form.new_password_element.clear(); |
| 315 EXPECT_THAT(saved_form, FormMatches(expected_form)); | 316 EXPECT_THAT(saved_form, FormMatches(expected_form)); |
| 316 EXPECT_EQ(expected_form.password_value, saved_form.password_value); | 317 EXPECT_EQ(expected_form.password_value, saved_form.password_value); |
| 317 EXPECT_EQ(expected_form.new_password_value, saved_form.new_password_value); | 318 EXPECT_EQ(expected_form.new_password_value, saved_form.new_password_value); |
| 318 } | 319 } |
| 319 | 320 |
| 320 TEST_F(PasswordManagerTest, GeneratedPasswordFormSubmitEmptyStore) { | 321 TEST_F(PasswordManagerTest, GeneratedPasswordFormSubmitEmptyStore) { |
| 321 // This test is the same as FormSubmitEmptyStore, except that it simulates the | 322 // This test is the same as FormSubmitEmptyStore, except that it simulates the |
| 322 // user generating the password through the browser. | 323 // user generating the password through the browser. |
| 323 std::vector<PasswordForm*> result; // Empty password store. | 324 ScopedVector<PasswordForm> result; // Empty password store. |
| 324 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 325 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 325 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 326 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 326 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 327 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 327 std::vector<PasswordForm> observed; | 328 std::vector<PasswordForm> observed; |
| 328 PasswordForm form(MakeSimpleForm()); | 329 PasswordForm form(MakeSimpleForm()); |
| 329 observed.push_back(form); | 330 observed.push_back(form); |
| 330 // The initial load. | 331 // The initial load. |
| 331 manager()->OnPasswordFormsParsed(&driver_, observed); | 332 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 332 // The initial layout. | 333 // The initial layout. |
| 333 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 334 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| 334 | 335 |
| 335 // Simulate the user generating the password and submitting the form. | 336 // Simulate the user generating the password and submitting the form. |
| 336 manager()->SetFormHasGeneratedPassword(&driver_, form); | 337 manager()->SetFormHasGeneratedPassword(&driver_, form); |
| 337 manager()->ProvisionallySavePassword(form); | 338 manager()->ProvisionallySavePassword(form); |
| 338 | 339 |
| 339 // The user should not be presented with an infobar as they have already given | 340 // The user should not be presented with an infobar as they have already given |
| 340 // consent by using the generated password. The form should be saved once | 341 // consent by using the generated password. The form should be saved once |
| 341 // navigation occurs. The client will be informed that automatic saving has | 342 // navigation occurs. The client will be informed that automatic saving has |
| 342 // occured. | 343 // occured. |
| 343 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); | 344 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); |
| 344 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); | 345 EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| 345 scoped_ptr<PasswordFormManager> saved_form_manager; | 346 scoped_ptr<PasswordFormManager> saved_form_manager; |
| 346 EXPECT_CALL(client_, AutomaticPasswordSavePtr(_)) | 347 EXPECT_CALL(client_, AutomaticPasswordSavePtr(_)) |
| 347 .Times(Exactly(1)) | 348 .Times(Exactly(1)) |
| 348 .WillOnce(WithArg<0>(SaveToScopedPtr(&saved_form_manager))); | 349 .WillOnce(WithArg<0>(SaveToScopedPtr(&saved_form_manager))); |
| 349 | 350 |
| 350 // Now the password manager waits for the navigation to complete. | 351 // Now the password manager waits for the navigation to complete. |
| 351 observed.clear(); | 352 observed.clear(); |
| 352 manager()->OnPasswordFormsParsed(&driver_, | 353 manager()->OnPasswordFormsParsed(&driver_, |
| 353 observed); // The post-navigation load. | 354 observed); // The post-navigation load. |
| 354 manager()->OnPasswordFormsRendered(&driver_, observed, | 355 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 355 true); // The post-navigation layout. | 356 true); // The post-navigation layout. |
| 356 } | 357 } |
| 357 | 358 |
| 358 TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) { | 359 TEST_F(PasswordManagerTest, FormSubmitNoGoodMatch) { |
| 359 // Same as above, except with an existing form for the same signon realm, | 360 // Same as above, except with an existing form for the same signon realm, |
| 360 // but different origin. Detailed cases like this are covered by | 361 // but different origin. Detailed cases like this are covered by |
| 361 // PasswordFormManagerTest. | 362 // PasswordFormManagerTest. |
| 362 std::vector<PasswordForm*> result; | 363 ScopedVector<PasswordForm> result; |
| 363 PasswordForm* existing_different = new PasswordForm(MakeSimpleForm()); | 364 scoped_ptr<PasswordForm> existing_different( |
| 365 new PasswordForm(MakeSimpleForm())); | |
| 364 existing_different->username_value = ASCIIToUTF16("google2"); | 366 existing_different->username_value = ASCIIToUTF16("google2"); |
| 365 result.push_back(existing_different); | 367 result.push_back(existing_different.release()); |
| 366 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(2); | 368 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(2); |
| 367 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 369 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 368 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 370 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 369 | 371 |
| 370 std::vector<PasswordForm> observed; | 372 std::vector<PasswordForm> observed; |
| 371 PasswordForm form(MakeSimpleForm()); | 373 PasswordForm form(MakeSimpleForm()); |
| 372 observed.push_back(form); | 374 observed.push_back(form); |
| 373 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 375 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 374 manager()->OnPasswordFormsRendered(&driver_, observed, | 376 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 375 true); // The initial layout. | 377 true); // The initial layout. |
| 376 manager()->ProvisionallySavePassword(form); | 378 manager()->ProvisionallySavePassword(form); |
| 377 | 379 |
| 378 // We still expect an add, since we didn't have a good match. | 380 // We still expect an add, since we didn't have a good match. |
| 379 scoped_ptr<PasswordFormManager> form_to_save; | 381 scoped_ptr<PasswordFormManager> form_to_save; |
| 380 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) | 382 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
| 381 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); | 383 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
| 382 | 384 |
| 383 // Now the password manager waits for the navigation to complete. | 385 // Now the password manager waits for the navigation to complete. |
| 384 observed.clear(); | 386 observed.clear(); |
| 385 manager()->OnPasswordFormsParsed(&driver_, | 387 manager()->OnPasswordFormsParsed(&driver_, |
| 386 observed); // The post-navigation load. | 388 observed); // The post-navigation load. |
| 387 manager()->OnPasswordFormsRendered(&driver_, observed, | 389 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 388 true); // The post-navigation layout. | 390 true); // The post-navigation layout. |
| 389 | 391 |
| 390 ASSERT_TRUE(form_to_save.get()); | 392 ASSERT_TRUE(form_to_save.get()); |
| 391 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); | 393 EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| 392 | 394 |
| 393 // Simulate saving the form. | 395 // Simulate saving the form. |
| 394 form_to_save->Save(); | 396 form_to_save->Save(); |
| 395 } | 397 } |
| 396 | 398 |
| 397 TEST_F(PasswordManagerTest, FormSeenThenLeftPage) { | 399 TEST_F(PasswordManagerTest, FormSeenThenLeftPage) { |
| 398 std::vector<PasswordForm*> result; // Empty password store. | 400 ScopedVector<PasswordForm> result; // Empty password store. |
| 399 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 401 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 400 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 402 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 401 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 403 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 402 std::vector<PasswordForm> observed; | 404 std::vector<PasswordForm> observed; |
| 403 PasswordForm form(MakeSimpleForm()); | 405 PasswordForm form(MakeSimpleForm()); |
| 404 observed.push_back(form); | 406 observed.push_back(form); |
| 405 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 407 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 406 manager()->OnPasswordFormsRendered(&driver_, observed, | 408 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 407 true); // The initial layout. | 409 true); // The initial layout. |
| 408 | 410 |
| 409 // No message from the renderer that a password was submitted. No | 411 // No message from the renderer that a password was submitted. No |
| 410 // expected calls. | 412 // expected calls. |
| 411 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(0); | 413 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(0); |
| 412 observed.clear(); | 414 observed.clear(); |
| 413 manager()->OnPasswordFormsParsed(&driver_, | 415 manager()->OnPasswordFormsParsed(&driver_, |
| 414 observed); // The post-navigation load. | 416 observed); // The post-navigation load. |
| 415 manager()->OnPasswordFormsRendered(&driver_, observed, | 417 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 416 true); // The post-navigation layout. | 418 true); // The post-navigation layout. |
| 417 } | 419 } |
| 418 | 420 |
| 419 TEST_F(PasswordManagerTest, FormSubmitAfterNavigateInPage) { | 421 TEST_F(PasswordManagerTest, FormSubmitAfterNavigateInPage) { |
| 420 // Test that navigating in the page does not prevent us from showing the save | 422 // Test that navigating in the page does not prevent us from showing the save |
| 421 // password infobar. | 423 // password infobar. |
| 422 std::vector<PasswordForm*> result; // Empty password store. | 424 ScopedVector<PasswordForm> result; // Empty password store. |
| 423 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 425 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 424 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 426 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 425 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 427 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 426 std::vector<PasswordForm> observed; | 428 std::vector<PasswordForm> observed; |
| 427 PasswordForm form(MakeSimpleForm()); | 429 PasswordForm form(MakeSimpleForm()); |
| 428 observed.push_back(form); | 430 observed.push_back(form); |
| 429 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 431 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 430 manager()->OnPasswordFormsRendered(&driver_, observed, | 432 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 431 true); // The initial layout. | 433 true); // The initial layout. |
| 432 | 434 |
| 433 // Simulate submitting the password. | 435 // Simulate submitting the password. |
| 434 OnPasswordFormSubmitted(form); | 436 OnPasswordFormSubmitted(form); |
| 435 | 437 |
| 436 // Now the password manager waits for the navigation to complete. | 438 // Now the password manager waits for the navigation to complete. |
| 437 scoped_ptr<PasswordFormManager> form_to_save; | 439 scoped_ptr<PasswordFormManager> form_to_save; |
| 438 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) | 440 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
| 439 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); | 441 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
| 440 | 442 |
| 441 observed.clear(); | 443 observed.clear(); |
| 442 manager()->OnPasswordFormsParsed(&driver_, | 444 manager()->OnPasswordFormsParsed(&driver_, |
| 443 observed); // The post-navigation load. | 445 observed); // The post-navigation load. |
| 444 manager()->OnPasswordFormsRendered(&driver_, observed, | 446 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 445 true); // The post-navigation layout. | 447 true); // The post-navigation layout. |
| 446 | 448 |
| 447 ASSERT_FALSE(NULL == form_to_save.get()); | 449 ASSERT_FALSE(NULL == form_to_save.get()); |
| 448 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); | 450 EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| 449 | 451 |
| 450 // Simulate saving the form, as if the info bar was accepted. | 452 // Simulate saving the form, as if the info bar was accepted. |
| 451 form_to_save->Save(); | 453 form_to_save->Save(); |
| 452 } | 454 } |
| 453 | 455 |
| 454 // This test verifies a fix for http://crbug.com/236673 | 456 // This test verifies a fix for http://crbug.com/236673 |
| 455 TEST_F(PasswordManagerTest, FormSubmitWithFormOnPreviousPage) { | 457 TEST_F(PasswordManagerTest, FormSubmitWithFormOnPreviousPage) { |
| 456 std::vector<PasswordForm*> result; // Empty password store. | 458 ScopedVector<PasswordForm> result; // Empty password store. |
| 457 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 459 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 458 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 460 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 459 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 461 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 460 PasswordForm first_form(MakeSimpleForm()); | 462 PasswordForm first_form(MakeSimpleForm()); |
| 461 first_form.origin = GURL("http://www.nytimes.com/"); | 463 first_form.origin = GURL("http://www.nytimes.com/"); |
| 462 first_form.action = GURL("https://myaccount.nytimes.com/auth/login"); | 464 first_form.action = GURL("https://myaccount.nytimes.com/auth/login"); |
| 463 first_form.signon_realm = "http://www.nytimes.com/"; | 465 first_form.signon_realm = "http://www.nytimes.com/"; |
| 464 PasswordForm second_form(MakeSimpleForm()); | 466 PasswordForm second_form(MakeSimpleForm()); |
| 465 second_form.origin = GURL("https://myaccount.nytimes.com/auth/login"); | 467 second_form.origin = GURL("https://myaccount.nytimes.com/auth/login"); |
| 466 second_form.action = GURL("https://myaccount.nytimes.com/auth/login"); | 468 second_form.action = GURL("https://myaccount.nytimes.com/auth/login"); |
| 467 second_form.signon_realm = "https://myaccount.nytimes.com/"; | 469 second_form.signon_realm = "https://myaccount.nytimes.com/"; |
| 468 | 470 |
| 469 // Pretend that the form is hidden on the first page. | 471 // Pretend that the form is hidden on the first page. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 488 // Navigation after form submit. | 490 // Navigation after form submit. |
| 489 scoped_ptr<PasswordFormManager> form_to_save; | 491 scoped_ptr<PasswordFormManager> form_to_save; |
| 490 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) | 492 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
| 491 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); | 493 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
| 492 observed.clear(); | 494 observed.clear(); |
| 493 manager()->OnPasswordFormsParsed(&driver_, observed); | 495 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 494 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 496 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| 495 | 497 |
| 496 // Make sure that the saved form matches the second form, not the first. | 498 // Make sure that the saved form matches the second form, not the first. |
| 497 ASSERT_TRUE(form_to_save.get()); | 499 ASSERT_TRUE(form_to_save.get()); |
| 498 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(second_form))); | 500 EXPECT_CALL(*store_, AddLogin(FormMatches(second_form))); |
| 499 | 501 |
| 500 // Simulate saving the form, as if the info bar was accepted. | 502 // Simulate saving the form, as if the info bar was accepted. |
| 501 form_to_save->Save(); | 503 form_to_save->Save(); |
| 502 } | 504 } |
| 503 | 505 |
| 504 TEST_F(PasswordManagerTest, FormSubmitFailedLogin) { | 506 TEST_F(PasswordManagerTest, FormSubmitFailedLogin) { |
| 505 std::vector<PasswordForm*> result; // Empty password store. | 507 ScopedVector<PasswordForm> result; // Empty password store. |
| 506 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 508 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 507 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 509 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 508 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 510 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 509 std::vector<PasswordForm> observed; | 511 std::vector<PasswordForm> observed; |
| 510 PasswordForm form(MakeSimpleForm()); | 512 PasswordForm form(MakeSimpleForm()); |
| 511 observed.push_back(form); | 513 observed.push_back(form); |
| 512 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 514 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 513 manager()->OnPasswordFormsRendered(&driver_, observed, | 515 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 514 true); // The initial layout. | 516 true); // The initial layout. |
| 515 | 517 |
| 516 manager()->ProvisionallySavePassword(form); | 518 manager()->ProvisionallySavePassword(form); |
| 517 | 519 |
| 518 // The form reappears, and is visible in the layout: | 520 // The form reappears, and is visible in the layout: |
| 519 // No expected calls to the PasswordStore... | 521 // No expected calls to the PasswordStore... |
| 520 manager()->OnPasswordFormsParsed(&driver_, observed); | 522 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 521 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 523 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| 522 } | 524 } |
| 523 | 525 |
| 524 TEST_F(PasswordManagerTest, FormSubmitInvisibleLogin) { | 526 TEST_F(PasswordManagerTest, FormSubmitInvisibleLogin) { |
| 525 // Tests fix of issue 28911: if the login form reappears on the subsequent | 527 // Tests fix of issue 28911: if the login form reappears on the subsequent |
| 526 // page, but is invisible, it shouldn't count as a failed login. | 528 // page, but is invisible, it shouldn't count as a failed login. |
| 527 std::vector<PasswordForm*> result; // Empty password store. | 529 ScopedVector<PasswordForm> result; // Empty password store. |
| 528 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 530 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 529 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 531 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 530 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 532 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 531 std::vector<PasswordForm> observed; | 533 std::vector<PasswordForm> observed; |
| 532 PasswordForm form(MakeSimpleForm()); | 534 PasswordForm form(MakeSimpleForm()); |
| 533 observed.push_back(form); | 535 observed.push_back(form); |
| 534 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 536 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 535 manager()->OnPasswordFormsRendered(&driver_, observed, | 537 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 536 true); // The initial layout. | 538 true); // The initial layout. |
| 537 | 539 |
| 538 manager()->ProvisionallySavePassword(form); | 540 manager()->ProvisionallySavePassword(form); |
| 539 | 541 |
| 540 // Expect info bar to appear: | 542 // Expect info bar to appear: |
| 541 scoped_ptr<PasswordFormManager> form_to_save; | 543 scoped_ptr<PasswordFormManager> form_to_save; |
| 542 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) | 544 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
| 543 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); | 545 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
| 544 | 546 |
| 545 // The form reappears, but is not visible in the layout: | 547 // The form reappears, but is not visible in the layout: |
| 546 manager()->OnPasswordFormsParsed(&driver_, observed); | 548 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 547 observed.clear(); | 549 observed.clear(); |
| 548 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 550 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| 549 | 551 |
| 550 ASSERT_TRUE(form_to_save.get()); | 552 ASSERT_TRUE(form_to_save.get()); |
| 551 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); | 553 EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| 552 | 554 |
| 553 // Simulate saving the form. | 555 // Simulate saving the form. |
| 554 form_to_save->Save(); | 556 form_to_save->Save(); |
| 555 } | 557 } |
| 556 | 558 |
| 557 TEST_F(PasswordManagerTest, InitiallyInvisibleForm) { | 559 TEST_F(PasswordManagerTest, InitiallyInvisibleForm) { |
| 558 // Make sure an invisible login form still gets autofilled. | 560 // Make sure an invisible login form still gets autofilled. |
| 559 std::vector<PasswordForm*> result; | 561 ScopedVector<PasswordForm> result; |
| 560 PasswordForm* existing = new PasswordForm(MakeSimpleForm()); | 562 result.push_back(new PasswordForm(MakeSimpleForm())); |
| 561 result.push_back(existing); | |
| 562 EXPECT_CALL(driver_, FillPasswordForm(_)); | 563 EXPECT_CALL(driver_, FillPasswordForm(_)); |
| 563 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 564 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 564 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 565 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 565 std::vector<PasswordForm> observed; | 566 std::vector<PasswordForm> observed; |
| 566 PasswordForm form(MakeSimpleForm()); | 567 PasswordForm form(MakeSimpleForm()); |
| 567 observed.push_back(form); | 568 observed.push_back(form); |
| 568 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 569 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 569 observed.clear(); | 570 observed.clear(); |
| 570 manager()->OnPasswordFormsRendered(&driver_, observed, | 571 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 571 true); // The initial layout. | 572 true); // The initial layout. |
| 572 | 573 |
| 573 manager()->OnPasswordFormsParsed(&driver_, | 574 manager()->OnPasswordFormsParsed(&driver_, |
| 574 observed); // The post-navigation load. | 575 observed); // The post-navigation load. |
| 575 manager()->OnPasswordFormsRendered(&driver_, observed, | 576 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 576 true); // The post-navigation layout. | 577 true); // The post-navigation layout. |
| 577 } | 578 } |
| 578 | 579 |
| 579 TEST_F(PasswordManagerTest, SavingDependsOnManagerEnabledPreference) { | 580 TEST_F(PasswordManagerTest, SavingDependsOnManagerEnabledPreference) { |
| 580 // Test that saving passwords depends on the password manager enabled | 581 // Test that saving passwords depends on the password manager enabled |
| 581 // preference. | 582 // preference. |
| 582 prefs_.SetUserPref(prefs::kPasswordManagerSavingEnabled, | 583 prefs_.SetUserPref(prefs::kPasswordManagerSavingEnabled, |
| 583 new base::FundamentalValue(true)); | 584 new base::FundamentalValue(true)); |
| 584 EXPECT_TRUE(manager()->IsSavingEnabledForCurrentPage()); | 585 EXPECT_TRUE(manager()->IsSavingEnabledForCurrentPage()); |
| 585 prefs_.SetUserPref(prefs::kPasswordManagerSavingEnabled, | 586 prefs_.SetUserPref(prefs::kPasswordManagerSavingEnabled, |
| 586 new base::FundamentalValue(false)); | 587 new base::FundamentalValue(false)); |
| 587 EXPECT_FALSE(manager()->IsSavingEnabledForCurrentPage()); | 588 EXPECT_FALSE(manager()->IsSavingEnabledForCurrentPage()); |
| 588 } | 589 } |
| 589 | 590 |
| 590 TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) { | 591 TEST_F(PasswordManagerTest, FillPasswordsOnDisabledManager) { |
| 591 // Test fix for issue 158296: Passwords must be filled even if the password | 592 // Test fix for issue 158296: Passwords must be filled even if the password |
| 592 // manager is disabled. | 593 // manager is disabled. |
| 593 std::vector<PasswordForm*> result; | 594 ScopedVector<PasswordForm> result; |
| 594 PasswordForm* existing = new PasswordForm(MakeSimpleForm()); | 595 result.push_back(new PasswordForm(MakeSimpleForm())); |
| 595 result.push_back(existing); | |
| 596 prefs_.SetUserPref(prefs::kPasswordManagerSavingEnabled, | 596 prefs_.SetUserPref(prefs::kPasswordManagerSavingEnabled, |
| 597 new base::FundamentalValue(false)); | 597 new base::FundamentalValue(false)); |
| 598 EXPECT_CALL(driver_, FillPasswordForm(_)); | 598 EXPECT_CALL(driver_, FillPasswordForm(_)); |
| 599 EXPECT_CALL(*store_.get(), | 599 EXPECT_CALL(*store_, |
| 600 GetLogins(_, testing::Eq(PasswordStore::DISALLOW_PROMPT), _)) | 600 GetLogins(_, testing::Eq(PasswordStore::DISALLOW_PROMPT), _)) |
| 601 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 601 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 602 std::vector<PasswordForm> observed; | 602 std::vector<PasswordForm> observed; |
| 603 PasswordForm form(MakeSimpleForm()); | 603 PasswordForm form(MakeSimpleForm()); |
| 604 observed.push_back(form); | 604 observed.push_back(form); |
| 605 manager()->OnPasswordFormsParsed(&driver_, observed); | 605 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 606 } | 606 } |
| 607 | 607 |
| 608 TEST_F(PasswordManagerTest, FormSavedWithAutocompleteOff) { | 608 TEST_F(PasswordManagerTest, FormSavedWithAutocompleteOff) { |
| 609 // Test password form with non-generated password will be saved even if | 609 // Test password form with non-generated password will be saved even if |
| 610 // autocomplete=off. | 610 // autocomplete=off. |
| 611 std::vector<PasswordForm*> result; // Empty password store. | 611 ScopedVector<PasswordForm> result; // Empty password store. |
| 612 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 612 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 613 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 613 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 614 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 614 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 615 std::vector<PasswordForm> observed; | 615 std::vector<PasswordForm> observed; |
| 616 PasswordForm form(MakeSimpleForm()); | 616 PasswordForm form(MakeSimpleForm()); |
| 617 form.password_autocomplete_set = false; | 617 form.password_autocomplete_set = false; |
| 618 observed.push_back(form); | 618 observed.push_back(form); |
| 619 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 619 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 620 manager()->OnPasswordFormsRendered(&driver_, observed, | 620 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 621 true); // The initial layout. | 621 true); // The initial layout. |
| 622 | 622 |
| 623 // And the form submit contract is to call ProvisionallySavePassword. | 623 // And the form submit contract is to call ProvisionallySavePassword. |
| 624 manager()->ProvisionallySavePassword(form); | 624 manager()->ProvisionallySavePassword(form); |
| 625 | 625 |
| 626 // Password form should be saved. | 626 // Password form should be saved. |
| 627 scoped_ptr<PasswordFormManager> form_to_save; | 627 scoped_ptr<PasswordFormManager> form_to_save; |
| 628 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) | 628 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
| 629 .Times(Exactly(1)) | 629 .Times(Exactly(1)) |
| 630 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); | 630 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
| 631 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))).Times(Exactly(0)); | 631 EXPECT_CALL(*store_, AddLogin(FormMatches(form))).Times(Exactly(0)); |
| 632 | 632 |
| 633 // Now the password manager waits for the navigation to complete. | 633 // Now the password manager waits for the navigation to complete. |
| 634 observed.clear(); | 634 observed.clear(); |
| 635 manager()->OnPasswordFormsParsed(&driver_, | 635 manager()->OnPasswordFormsParsed(&driver_, |
| 636 observed); // The post-navigation load. | 636 observed); // The post-navigation load. |
| 637 manager()->OnPasswordFormsRendered(&driver_, observed, | 637 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 638 true); // The post-navigation layout. | 638 true); // The post-navigation layout. |
| 639 | 639 |
| 640 ASSERT_TRUE(form_to_save.get()); | 640 ASSERT_TRUE(form_to_save.get()); |
| 641 } | 641 } |
| 642 | 642 |
| 643 TEST_F(PasswordManagerTest, GeneratedPasswordFormSavedAutocompleteOff) { | 643 TEST_F(PasswordManagerTest, GeneratedPasswordFormSavedAutocompleteOff) { |
| 644 // Test password form with generated password will still be saved if | 644 // Test password form with generated password will still be saved if |
| 645 // autocomplete=off. | 645 // autocomplete=off. |
| 646 std::vector<PasswordForm*> result; // Empty password store. | 646 ScopedVector<PasswordForm> result; // Empty password store. |
| 647 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 647 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 648 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 648 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 649 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 649 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 650 std::vector<PasswordForm> observed; | 650 std::vector<PasswordForm> observed; |
| 651 PasswordForm form(MakeSimpleForm()); | 651 PasswordForm form(MakeSimpleForm()); |
| 652 form.password_autocomplete_set = false; | 652 form.password_autocomplete_set = false; |
| 653 observed.push_back(form); | 653 observed.push_back(form); |
| 654 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 654 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 655 manager()->OnPasswordFormsRendered(&driver_, observed, | 655 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 656 true); // The initial layout. | 656 true); // The initial layout. |
| 657 | 657 |
| 658 // Simulate the user generating the password and submitting the form. | 658 // Simulate the user generating the password and submitting the form. |
| 659 manager()->SetFormHasGeneratedPassword(&driver_, form); | 659 manager()->SetFormHasGeneratedPassword(&driver_, form); |
| 660 manager()->ProvisionallySavePassword(form); | 660 manager()->ProvisionallySavePassword(form); |
| 661 | 661 |
| 662 // The user should not be presented with an infobar as they have already given | 662 // The user should not be presented with an infobar as they have already given |
| 663 // consent by using the generated password. The form should be saved once | 663 // consent by using the generated password. The form should be saved once |
| 664 // navigation occurs. The client will be informed that automatic saving has | 664 // navigation occurs. The client will be informed that automatic saving has |
| 665 // occured. | 665 // occured. |
| 666 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); | 666 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); |
| 667 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); | 667 EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| 668 scoped_ptr<PasswordFormManager> saved_form_manager; | 668 scoped_ptr<PasswordFormManager> saved_form_manager; |
| 669 EXPECT_CALL(client_, AutomaticPasswordSavePtr(_)) | 669 EXPECT_CALL(client_, AutomaticPasswordSavePtr(_)) |
| 670 .Times(Exactly(1)) | 670 .Times(Exactly(1)) |
| 671 .WillOnce(WithArg<0>(SaveToScopedPtr(&saved_form_manager))); | 671 .WillOnce(WithArg<0>(SaveToScopedPtr(&saved_form_manager))); |
| 672 | 672 |
| 673 // Now the password manager waits for the navigation to complete. | 673 // Now the password manager waits for the navigation to complete. |
| 674 observed.clear(); | 674 observed.clear(); |
| 675 manager()->OnPasswordFormsParsed(&driver_, | 675 manager()->OnPasswordFormsParsed(&driver_, |
| 676 observed); // The post-navigation load. | 676 observed); // The post-navigation load. |
| 677 manager()->OnPasswordFormsRendered(&driver_, observed, | 677 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 678 true); // The post-navigation layout. | 678 true); // The post-navigation layout. |
| 679 } | 679 } |
| 680 | 680 |
| 681 TEST_F(PasswordManagerTest, SubmissionCallbackTest) { | 681 TEST_F(PasswordManagerTest, SubmissionCallbackTest) { |
| 682 manager()->AddSubmissionCallback(SubmissionCallback()); | 682 manager()->AddSubmissionCallback(SubmissionCallback()); |
| 683 PasswordForm form = MakeSimpleForm(); | 683 PasswordForm form = MakeSimpleForm(); |
| 684 OnPasswordFormSubmitted(form); | 684 OnPasswordFormSubmitted(form); |
| 685 EXPECT_TRUE(FormsAreEqual(form, submitted_form_)); | 685 EXPECT_TRUE(FormsAreEqual(form, submitted_form_)); |
| 686 } | 686 } |
| 687 | 687 |
| 688 TEST_F(PasswordManagerTest, PasswordFormReappearance) { | 688 TEST_F(PasswordManagerTest, PasswordFormReappearance) { |
| 689 // Test the heuristic to know if a password form reappears. | 689 // Test the heuristic to know if a password form reappears. |
| 690 // We assume that if we send our credentials and there | 690 // We assume that if we send our credentials and there |
| 691 // is at least one visible password form in the next page that | 691 // is at least one visible password form in the next page that |
| 692 // means that our previous login attempt failed. | 692 // means that our previous login attempt failed. |
| 693 std::vector<PasswordForm*> result; // Empty password store. | 693 ScopedVector<PasswordForm> result; // Empty password store. |
| 694 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(0); | 694 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(0); |
| 695 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 695 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 696 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 696 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 697 std::vector<PasswordForm> observed; | 697 std::vector<PasswordForm> observed; |
| 698 PasswordForm login_form(MakeTwitterLoginForm()); | 698 PasswordForm login_form(MakeTwitterLoginForm()); |
| 699 observed.push_back(login_form); | 699 observed.push_back(login_form); |
| 700 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 700 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 701 manager()->OnPasswordFormsRendered(&driver_, observed, | 701 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 702 true); // The initial layout. | 702 true); // The initial layout. |
| 703 | 703 |
| 704 manager()->ProvisionallySavePassword(login_form); | 704 manager()->ProvisionallySavePassword(login_form); |
| 705 | 705 |
| 706 PasswordForm failed_login_form(MakeTwitterFailedLoginForm()); | 706 PasswordForm failed_login_form(MakeTwitterFailedLoginForm()); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 723 // attempt to autofill forms found on a website. | 723 // attempt to autofill forms found on a website. |
| 724 EXPECT_CALL(client_, DidLastPageLoadEncounterSSLErrors()) | 724 EXPECT_CALL(client_, DidLastPageLoadEncounterSSLErrors()) |
| 725 .WillRepeatedly(Return(true)); | 725 .WillRepeatedly(Return(true)); |
| 726 | 726 |
| 727 // Let us pretend some forms were found on a website. | 727 // Let us pretend some forms were found on a website. |
| 728 std::vector<PasswordForm> forms; | 728 std::vector<PasswordForm> forms; |
| 729 forms.push_back(MakeSimpleForm()); | 729 forms.push_back(MakeSimpleForm()); |
| 730 | 730 |
| 731 // Feed those forms to |manager()| and check that it does not try to find | 731 // Feed those forms to |manager()| and check that it does not try to find |
| 732 // matching saved credentials for the forms. | 732 // matching saved credentials for the forms. |
| 733 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)).Times(Exactly(0)); | 733 EXPECT_CALL(*store_, GetLogins(_, _, _)).Times(Exactly(0)); |
| 734 manager()->OnPasswordFormsParsed(&driver_, forms); | 734 manager()->OnPasswordFormsParsed(&driver_, forms); |
| 735 } | 735 } |
| 736 | 736 |
| 737 TEST_F(PasswordManagerTest, SavingDisabledIfManagerDisabled) { | 737 TEST_F(PasswordManagerTest, SavingDisabledIfManagerDisabled) { |
| 738 EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage()) | 738 EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage()) |
| 739 .WillRepeatedly(Return(false)); | 739 .WillRepeatedly(Return(false)); |
| 740 EXPECT_FALSE(manager()->IsSavingEnabledForCurrentPage()); | 740 EXPECT_FALSE(manager()->IsSavingEnabledForCurrentPage()); |
| 741 } | 741 } |
| 742 | 742 |
| 743 TEST_F(PasswordManagerTest, AutofillingDisabledIfManagerDisabled) { | 743 TEST_F(PasswordManagerTest, AutofillingDisabledIfManagerDisabled) { |
| 744 EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage()) | 744 EXPECT_CALL(client_, IsPasswordManagerEnabledForCurrentPage()) |
| 745 .WillRepeatedly(Return(false)); | 745 .WillRepeatedly(Return(false)); |
| 746 | 746 |
| 747 // Let us pretend some forms were found on a website. | 747 // Let us pretend some forms were found on a website. |
| 748 std::vector<PasswordForm> forms; | 748 std::vector<PasswordForm> forms; |
| 749 forms.push_back(MakeSimpleForm()); | 749 forms.push_back(MakeSimpleForm()); |
| 750 | 750 |
| 751 // Feed those forms to |manager()| and check that it does not try to find | 751 // Feed those forms to |manager()| and check that it does not try to find |
| 752 // matching saved credentials for the forms. | 752 // matching saved credentials for the forms. |
| 753 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)).Times(Exactly(0)); | 753 EXPECT_CALL(*store_, GetLogins(_, _, _)).Times(Exactly(0)); |
| 754 manager()->OnPasswordFormsParsed(&driver_, forms); | 754 manager()->OnPasswordFormsParsed(&driver_, forms); |
| 755 } | 755 } |
| 756 | 756 |
| 757 TEST_F(PasswordManagerTest, SyncCredentialsNotSaved) { | 757 TEST_F(PasswordManagerTest, SyncCredentialsNotSaved) { |
| 758 EXPECT_CALL(client_, IsSyncAccountCredential(_, _)) | 758 EXPECT_CALL(client_, IsSyncAccountCredential(_, _)) |
| 759 .WillRepeatedly(Return(true)); | 759 .WillRepeatedly(Return(true)); |
| 760 | 760 |
| 761 // Simulate loading a simple form with no existing stored password. | 761 // Simulate loading a simple form with no existing stored password. |
| 762 std::vector<PasswordForm*> result; // Empty password store. | 762 ScopedVector<PasswordForm> result; // Empty password store. |
| 763 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 763 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 764 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 764 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 765 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 765 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 766 std::vector<PasswordForm> observed; | 766 std::vector<PasswordForm> observed; |
| 767 PasswordForm form(MakeSimpleForm()); | 767 PasswordForm form(MakeSimpleForm()); |
| 768 form.password_autocomplete_set = false; | 768 form.password_autocomplete_set = false; |
| 769 observed.push_back(form); | 769 observed.push_back(form); |
| 770 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 770 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 771 manager()->OnPasswordFormsRendered(&driver_, observed, | 771 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 772 true); // The initial layout. | 772 true); // The initial layout. |
| 773 | 773 |
| 774 // User should not be prompted and password should not be saved. | 774 // User should not be prompted and password should not be saved. |
| 775 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); | 775 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)).Times(Exactly(0)); |
| 776 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))).Times(Exactly(0)); | 776 EXPECT_CALL(*store_, AddLogin(FormMatches(form))).Times(Exactly(0)); |
| 777 | 777 |
| 778 // Submit form and finish navigation. | 778 // Submit form and finish navigation. |
| 779 manager()->ProvisionallySavePassword(form); | 779 manager()->ProvisionallySavePassword(form); |
| 780 observed.clear(); | 780 observed.clear(); |
| 781 manager()->OnPasswordFormsParsed(&driver_, observed); | 781 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 782 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 782 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| 783 } | 783 } |
| 784 | 784 |
| 785 // On failed login attempts, the retry-form can have action scheme changed from | 785 // On failed login attempts, the retry-form can have action scheme changed from |
| 786 // HTTP to HTTPS (see http://crbug.com/400769). Check that such retry-form is | 786 // HTTP to HTTPS (see http://crbug.com/400769). Check that such retry-form is |
| 787 // considered equal to the original login form, and the attempt recognised as a | 787 // considered equal to the original login form, and the attempt recognised as a |
| 788 // failure. | 788 // failure. |
| 789 TEST_F(PasswordManagerTest, | 789 TEST_F(PasswordManagerTest, |
| 790 SeeingFormActionWithOnlyHttpHttpsChangeIsLoginFailure) { | 790 SeeingFormActionWithOnlyHttpHttpsChangeIsLoginFailure) { |
| 791 std::vector<PasswordForm*> result; // Empty password store. | 791 ScopedVector<PasswordForm> result; // Empty password store. |
| 792 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 792 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 793 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 793 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 794 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 794 .WillRepeatedly(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 795 | 795 |
| 796 PasswordForm first_form(MakeSimpleForm()); | 796 PasswordForm first_form(MakeSimpleForm()); |
| 797 first_form.origin = GURL("http://www.xda-developers.com/"); | 797 first_form.origin = GURL("http://www.xda-developers.com/"); |
| 798 first_form.action = GURL("http://forum.xda-developers.com/login.php"); | 798 first_form.action = GURL("http://forum.xda-developers.com/login.php"); |
| 799 | 799 |
| 800 // |second_form|'s action differs only with it's scheme i.e. *https://*. | 800 // |second_form|'s action differs only with it's scheme i.e. *https://*. |
| 801 PasswordForm second_form(first_form); | 801 PasswordForm second_form(first_form); |
| 802 second_form.action = GURL("https://forum.xda-developers.com/login.php"); | 802 second_form.action = GURL("https://forum.xda-developers.com/login.php"); |
| 803 | 803 |
| 804 std::vector<PasswordForm> observed; | 804 std::vector<PasswordForm> observed; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 843 manager()->OnPasswordFormsParsed(&driver_, | 843 manager()->OnPasswordFormsParsed(&driver_, |
| 844 observed); // The post-navigation load. | 844 observed); // The post-navigation load. |
| 845 manager()->OnPasswordFormsRendered(&driver_, observed, | 845 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 846 true); // The post-navigation layout. | 846 true); // The post-navigation layout. |
| 847 } | 847 } |
| 848 | 848 |
| 849 TEST_F(PasswordManagerTest, FormSubmitWithOnlyPassowrdField) { | 849 TEST_F(PasswordManagerTest, FormSubmitWithOnlyPassowrdField) { |
| 850 // Test to verify that on submitting the HTML password form without having | 850 // Test to verify that on submitting the HTML password form without having |
| 851 // username input filed shows password save promt and saves the password to | 851 // username input filed shows password save promt and saves the password to |
| 852 // store. | 852 // store. |
| 853 std::vector<PasswordForm*> result; // Empty password store. | 853 ScopedVector<PasswordForm> result; // Empty password store. |
| 854 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 854 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 855 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 855 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 856 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 856 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 857 std::vector<PasswordForm> observed; | 857 std::vector<PasswordForm> observed; |
| 858 | 858 |
| 859 // Loads passsword form without username input field. | 859 // Loads passsword form without username input field. |
| 860 PasswordForm form(MakeSimpleFormWithOnlyPasswordField()); | 860 PasswordForm form(MakeSimpleFormWithOnlyPasswordField()); |
| 861 observed.push_back(form); | 861 observed.push_back(form); |
| 862 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. | 862 manager()->OnPasswordFormsParsed(&driver_, observed); // The initial load. |
| 863 manager()->OnPasswordFormsRendered(&driver_, observed, | 863 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 864 true); // The initial layout. | 864 true); // The initial layout. |
| 865 | 865 |
| 866 // And the form submit contract is to call ProvisionallySavePassword. | 866 // And the form submit contract is to call ProvisionallySavePassword. |
| 867 manager()->ProvisionallySavePassword(form); | 867 manager()->ProvisionallySavePassword(form); |
| 868 | 868 |
| 869 scoped_ptr<PasswordFormManager> form_to_save; | 869 scoped_ptr<PasswordFormManager> form_to_save; |
| 870 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) | 870 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
| 871 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); | 871 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
| 872 | 872 |
| 873 // Now the password manager waits for the navigation to complete. | 873 // Now the password manager waits for the navigation to complete. |
| 874 observed.clear(); | 874 observed.clear(); |
| 875 manager()->OnPasswordFormsParsed(&driver_, | 875 manager()->OnPasswordFormsParsed(&driver_, |
| 876 observed); // The post-navigation load. | 876 observed); // The post-navigation load. |
| 877 manager()->OnPasswordFormsRendered(&driver_, observed, | 877 manager()->OnPasswordFormsRendered(&driver_, observed, |
| 878 true); // The post-navigation layout. | 878 true); // The post-navigation layout. |
| 879 | 879 |
| 880 ASSERT_TRUE(form_to_save.get()); | 880 ASSERT_TRUE(form_to_save.get()); |
| 881 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); | 881 EXPECT_CALL(*store_, AddLogin(FormMatches(form))); |
| 882 | 882 |
| 883 // Simulate saving the form, as if the info bar was accepted. | 883 // Simulate saving the form, as if the info bar was accepted. |
| 884 form_to_save->Save(); | 884 form_to_save->Save(); |
| 885 } | 885 } |
| 886 | 886 |
| 887 TEST_F(PasswordManagerTest, FillPasswordOnManyFrames) { | 887 TEST_F(PasswordManagerTest, FillPasswordOnManyFrames) { |
| 888 // If one password form appears in more frames, it should be filled in all of | 888 // If one password form appears in more frames, it should be filled in all of |
| 889 // them. | 889 // them. |
| 890 PasswordForm form(MakeSimpleForm()); // The observed and saved form. | 890 PasswordForm form(MakeSimpleForm()); // The observed and saved form. |
| 891 | 891 |
| 892 // "Save" the form. | 892 // "Save" the form. |
| 893 std::vector<PasswordForm*> result; | 893 ScopedVector<PasswordForm> result; |
| 894 result.push_back(new PasswordForm(form)); // Calee owns the form. | 894 result.push_back(new PasswordForm(form)); |
| 895 EXPECT_CALL(*store_.get(), | 895 EXPECT_CALL(*store_, |
| 896 GetLogins(_, testing::Eq(PasswordStore::DISALLOW_PROMPT), _)) | 896 GetLogins(_, testing::Eq(PasswordStore::DISALLOW_PROMPT), _)) |
| 897 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 897 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
| 898 | 898 |
| 899 // The form will be seen the first time. | 899 // The form will be seen the first time. |
| 900 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(1); | 900 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(1); |
| 901 std::vector<PasswordForm> observed; | 901 std::vector<PasswordForm> observed; |
| 902 observed.push_back(form); | 902 observed.push_back(form); |
| 903 manager()->OnPasswordFormsParsed(&driver_, observed); | 903 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 904 | 904 |
| 905 // Now the form will be seen the second time, in a different frame. The driver | 905 // Now the form will be seen the second time, in a different frame. The driver |
| 906 // for that frame should be told to fill it, but the store should not be asked | 906 // for that frame should be told to fill it, but the store should not be asked |
| 907 // for it again. | 907 // for it again. |
| 908 MockPasswordManagerDriver driver_b; | 908 MockPasswordManagerDriver driver_b; |
| 909 EXPECT_CALL(driver_b, FillPasswordForm(_)).Times(1); | 909 EXPECT_CALL(driver_b, FillPasswordForm(_)).Times(1); |
| 910 manager()->OnPasswordFormsParsed(&driver_b, observed); | 910 manager()->OnPasswordFormsParsed(&driver_b, observed); |
| 911 } | 911 } |
| 912 | 912 |
| 913 TEST_F(PasswordManagerTest, InPageNavigation) { | 913 TEST_F(PasswordManagerTest, InPageNavigation) { |
| 914 // Test that observing a newly submitted form shows the save password bar on | 914 // Test that observing a newly submitted form shows the save password bar on |
| 915 // call in page navigation. | 915 // call in page navigation. |
| 916 std::vector<PasswordForm*> result; // Empty password store. | 916 ScopedVector<PasswordForm> result; // Empty password store. |
| 917 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); | 917 EXPECT_CALL(driver_, FillPasswordForm(_)).Times(Exactly(0)); |
| 918 EXPECT_CALL(*store_.get(), GetLogins(_, _, _)) | 918 EXPECT_CALL(*store_, GetLogins(_, _, _)) |
| 919 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(result)), Return())); | 919 .WillOnce(DoAll(WithArg<2>(InvokeConsumer(&result)), Return())); |
|
vasilii
2015/02/05 19:23:27
The file is full of these calls. It seems that it'
vabr (Chromium)
2015/02/06 14:16:05
Great idea!
Done.
vasilii
2015/02/09 10:08:34
I don't see it's done.
vabr (Chromium)
2015/02/09 11:36:06
Sorry, I focussed on adding the empty consumer act
| |
| 920 std::vector<PasswordForm> observed; | 920 std::vector<PasswordForm> observed; |
| 921 PasswordForm form(MakeSimpleForm()); | 921 PasswordForm form(MakeSimpleForm()); |
| 922 observed.push_back(form); | 922 observed.push_back(form); |
| 923 // The initial load. | 923 // The initial load. |
| 924 manager()->OnPasswordFormsParsed(&driver_, observed); | 924 manager()->OnPasswordFormsParsed(&driver_, observed); |
| 925 // The initial layout. | 925 // The initial layout. |
| 926 manager()->OnPasswordFormsRendered(&driver_, observed, true); | 926 manager()->OnPasswordFormsRendered(&driver_, observed, true); |
| 927 | 927 |
| 928 // And the form submit contract is to call ProvisionallySavePassword. | 928 // And the form submit contract is to call ProvisionallySavePassword. |
| 929 manager()->ProvisionallySavePassword(form); | 929 manager()->ProvisionallySavePassword(form); |
| 930 | 930 |
| 931 scoped_ptr<PasswordFormManager> form_to_save; | 931 scoped_ptr<PasswordFormManager> form_to_save; |
| 932 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) | 932 EXPECT_CALL(client_, PromptUserToSavePasswordPtr(_)) |
| 933 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); | 933 .WillOnce(WithArg<0>(SaveToScopedPtr(&form_to_save))); |
| 934 | 934 |
| 935 manager()->OnInPageNavigation(&driver_, form); | 935 manager()->OnInPageNavigation(&driver_, form); |
| 936 } | 936 } |
| 937 | 937 |
| 938 } // namespace password_manager | 938 } // namespace password_manager |
| OLD | NEW |