Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 class TestAutofillManager : public AutofillManager { | 464 class TestAutofillManager : public AutofillManager { |
| 465 public: | 465 public: |
| 466 TestAutofillManager(AutofillDriver* driver, | 466 TestAutofillManager(AutofillDriver* driver, |
| 467 AutofillClient* client, | 467 AutofillClient* client, |
| 468 TestPersonalDataManager* personal_data) | 468 TestPersonalDataManager* personal_data) |
| 469 : AutofillManager(driver, client, personal_data), | 469 : AutofillManager(driver, client, personal_data), |
| 470 personal_data_(personal_data), | 470 personal_data_(personal_data), |
| 471 autofill_enabled_(true), | 471 autofill_enabled_(true), |
| 472 credit_card_upload_enabled_(true), | 472 credit_card_upload_enabled_(true), |
| 473 credit_card_was_uploaded_(false), | 473 credit_card_was_uploaded_(false), |
| 474 expect_all_unknown_possible_types_(false) { | 474 expect_all_unknown_possible_types_(false), |
| 475 expected_observed_submission_(true) { | |
| 475 set_payments_client( | 476 set_payments_client( |
| 476 new TestPaymentsClient(driver->GetURLRequestContext(), this)); | 477 new TestPaymentsClient(driver->GetURLRequestContext(), this)); |
| 477 } | 478 } |
| 478 ~TestAutofillManager() override {} | 479 ~TestAutofillManager() override {} |
| 479 | 480 |
| 480 bool IsAutofillEnabled() const override { return autofill_enabled_; } | 481 bool IsAutofillEnabled() const override { return autofill_enabled_; } |
| 481 | 482 |
| 482 void set_autofill_enabled(bool autofill_enabled) { | 483 void set_autofill_enabled(bool autofill_enabled) { |
| 483 autofill_enabled_ = autofill_enabled; | 484 autofill_enabled_ = autofill_enabled; |
| 484 } | 485 } |
| 485 | 486 |
| 486 bool IsCreditCardUploadEnabled() override { | 487 bool IsCreditCardUploadEnabled() override { |
| 487 return credit_card_upload_enabled_; | 488 return credit_card_upload_enabled_; |
| 488 } | 489 } |
| 489 | 490 |
| 490 void set_credit_card_upload_enabled(bool credit_card_upload_enabled) { | 491 void set_credit_card_upload_enabled(bool credit_card_upload_enabled) { |
| 491 credit_card_upload_enabled_ = credit_card_upload_enabled; | 492 credit_card_upload_enabled_ = credit_card_upload_enabled; |
| 492 } | 493 } |
| 493 | 494 |
| 494 bool credit_card_was_uploaded() { return credit_card_was_uploaded_; } | 495 bool credit_card_was_uploaded() { return credit_card_was_uploaded_; } |
| 495 | 496 |
| 496 void set_expected_submitted_field_types( | 497 void set_expected_submitted_field_types( |
| 497 const std::vector<ServerFieldTypeSet>& expected_types) { | 498 const std::vector<ServerFieldTypeSet>& expected_types) { |
| 498 expected_submitted_field_types_ = expected_types; | 499 expected_submitted_field_types_ = expected_types; |
| 499 } | 500 } |
| 500 | 501 |
| 501 void UploadFormDataAsyncCallback( | 502 void set_expected_observed_submission(bool expected) { |
| 502 const FormStructure* submitted_form, | 503 expected_observed_submission_ = expected; |
| 503 const base::TimeTicks& load_time, | 504 } |
| 504 const base::TimeTicks& interaction_time, | 505 |
| 505 const base::TimeTicks& submission_time) override { | 506 void UploadFormDataAsyncCallback(const FormStructure* submitted_form, |
| 507 const base::TimeTicks& load_time, | |
| 508 const base::TimeTicks& interaction_time, | |
| 509 const base::TimeTicks& submission_time, | |
| 510 bool observed_submission) override { | |
| 506 run_loop_->Quit(); | 511 run_loop_->Quit(); |
| 507 | 512 |
| 513 EXPECT_EQ(expected_observed_submission_, observed_submission); | |
| 514 | |
| 508 // If we have expected field types set, make sure they match. | 515 // If we have expected field types set, make sure they match. |
| 509 if (!expected_submitted_field_types_.empty()) { | 516 if (!expected_submitted_field_types_.empty()) { |
| 510 ASSERT_EQ(expected_submitted_field_types_.size(), | 517 ASSERT_EQ(expected_submitted_field_types_.size(), |
| 511 submitted_form->field_count()); | 518 submitted_form->field_count()); |
| 512 for (size_t i = 0; i < expected_submitted_field_types_.size(); ++i) { | 519 for (size_t i = 0; i < expected_submitted_field_types_.size(); ++i) { |
| 513 SCOPED_TRACE( | 520 SCOPED_TRACE( |
| 514 base::StringPrintf( | 521 base::StringPrintf( |
| 515 "Field %d with value %s", static_cast<int>(i), | 522 "Field %d with value %s", static_cast<int>(i), |
| 516 base::UTF16ToUTF8(submitted_form->field(i)->value).c_str())); | 523 base::UTF16ToUTF8(submitted_form->field(i)->value).c_str())); |
| 517 const ServerFieldTypeSet& possible_types = | 524 const ServerFieldTypeSet& possible_types = |
| 518 submitted_form->field(i)->possible_types(); | 525 submitted_form->field(i)->possible_types(); |
| 519 EXPECT_EQ(expected_submitted_field_types_[i].size(), | 526 EXPECT_EQ(expected_submitted_field_types_[i].size(), |
| 520 possible_types.size()); | 527 possible_types.size()); |
| 521 for (ServerFieldTypeSet::const_iterator it = | 528 for (ServerFieldTypeSet::const_iterator it = |
| 522 expected_submitted_field_types_[i].begin(); | 529 expected_submitted_field_types_[i].begin(); |
| 523 it != expected_submitted_field_types_[i].end(); ++it) { | 530 it != expected_submitted_field_types_[i].end(); ++it) { |
| 524 EXPECT_TRUE(possible_types.count(*it)) | 531 EXPECT_TRUE(possible_types.count(*it)) |
| 525 << "Expected type: " << AutofillType(*it).ToString(); | 532 << "Expected type: " << AutofillType(*it).ToString(); |
| 526 } | 533 } |
| 527 } | 534 } |
| 528 } | 535 } |
| 529 | 536 |
| 530 AutofillManager::UploadFormDataAsyncCallback(submitted_form, | 537 AutofillManager::UploadFormDataAsyncCallback( |
| 531 load_time, | 538 submitted_form, load_time, interaction_time, submission_time, |
| 532 interaction_time, | 539 observed_submission); |
| 533 submission_time); | |
| 534 } | 540 } |
| 535 | 541 |
| 536 // Resets the run loop so that it can wait for an asynchronous form | 542 // Resets the run loop so that it can wait for an asynchronous form |
| 537 // submission to complete. | 543 // submission to complete. |
| 538 void ResetRunLoop() { run_loop_.reset(new base::RunLoop()); } | 544 void ResetRunLoop() { run_loop_.reset(new base::RunLoop()); } |
| 539 | 545 |
| 540 // Wait for the asynchronous OnWillSubmitForm() call to complete. | 546 // Wait for the asynchronous calls within StartUploadProcess() to complete. |
| 541 void WaitForAsyncOnWillSubmitForm() { run_loop_->Run(); } | 547 void WaitForAsyncUploadProcess() { run_loop_->Run(); } |
| 542 | 548 |
| 543 void UploadFormData(const FormStructure& submitted_form) override { | 549 void UploadFormData(const FormStructure& submitted_form) override { |
| 544 submitted_form_signature_ = submitted_form.FormSignature(); | 550 submitted_form_signature_ = submitted_form.FormSignature(); |
| 545 } | 551 } |
| 546 | 552 |
| 547 const std::string GetSubmittedFormSignature() { | 553 const std::string GetSubmittedFormSignature() { |
| 548 return submitted_form_signature_; | 554 return submitted_form_signature_; |
| 549 } | 555 } |
| 550 | 556 |
| 551 AutofillProfile* GetProfileWithGUID(const char* guid) { | 557 AutofillProfile* GetProfileWithGUID(const char* guid) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 credit_card_was_uploaded_ = true; | 590 credit_card_was_uploaded_ = true; |
| 585 }; | 591 }; |
| 586 | 592 |
| 587 // Weak reference. | 593 // Weak reference. |
| 588 TestPersonalDataManager* personal_data_; | 594 TestPersonalDataManager* personal_data_; |
| 589 | 595 |
| 590 bool autofill_enabled_; | 596 bool autofill_enabled_; |
| 591 bool credit_card_upload_enabled_; | 597 bool credit_card_upload_enabled_; |
| 592 bool credit_card_was_uploaded_; | 598 bool credit_card_was_uploaded_; |
| 593 bool expect_all_unknown_possible_types_; | 599 bool expect_all_unknown_possible_types_; |
| 600 bool expected_observed_submission_; | |
| 594 | 601 |
| 595 scoped_ptr<base::RunLoop> run_loop_; | 602 scoped_ptr<base::RunLoop> run_loop_; |
| 596 | 603 |
| 597 std::string submitted_form_signature_; | 604 std::string submitted_form_signature_; |
| 598 std::vector<ServerFieldTypeSet> expected_submitted_field_types_; | 605 std::vector<ServerFieldTypeSet> expected_submitted_field_types_; |
| 599 | 606 |
| 600 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager); | 607 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager); |
| 601 }; | 608 }; |
| 602 | 609 |
| 603 class TestAutofillExternalDelegate : public AutofillExternalDelegate { | 610 class TestAutofillExternalDelegate : public AutofillExternalDelegate { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 752 autofill_manager_->autocomplete_history_manager_->SendSuggestions(&result); | 759 autofill_manager_->autocomplete_history_manager_->SendSuggestions(&result); |
| 753 } | 760 } |
| 754 | 761 |
| 755 void FormsSeen(const std::vector<FormData>& forms) { | 762 void FormsSeen(const std::vector<FormData>& forms) { |
| 756 autofill_manager_->OnFormsSeen(forms, base::TimeTicks()); | 763 autofill_manager_->OnFormsSeen(forms, base::TimeTicks()); |
| 757 } | 764 } |
| 758 | 765 |
| 759 void FormSubmitted(const FormData& form) { | 766 void FormSubmitted(const FormData& form) { |
| 760 autofill_manager_->ResetRunLoop(); | 767 autofill_manager_->ResetRunLoop(); |
| 761 if (autofill_manager_->OnWillSubmitForm(form, base::TimeTicks::Now())) | 768 if (autofill_manager_->OnWillSubmitForm(form, base::TimeTicks::Now())) |
| 762 autofill_manager_->WaitForAsyncOnWillSubmitForm(); | 769 autofill_manager_->WaitForAsyncUploadProcess(); |
| 763 autofill_manager_->OnFormSubmitted(form); | 770 autofill_manager_->OnFormSubmitted(form); |
| 764 } | 771 } |
| 765 | 772 |
| 766 void FillAutofillFormData(int query_id, | 773 void FillAutofillFormData(int query_id, |
| 767 const FormData& form, | 774 const FormData& form, |
| 768 const FormFieldData& field, | 775 const FormFieldData& field, |
| 769 int unique_id) { | 776 int unique_id) { |
| 770 autofill_manager_->FillOrPreviewForm( | 777 autofill_manager_->FillOrPreviewForm( |
| 771 AutofillDriver::FORM_DATA_ACTION_FILL, query_id, form, field, | 778 AutofillDriver::FORM_DATA_ACTION_FILL, query_id, form, field, |
| 772 unique_id); | 779 unique_id); |
| (...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2483 MakeFrontendID(std::string(), guid), | 2490 MakeFrontendID(std::string(), guid), |
| 2484 &response_page_id, &response_data); | 2491 &response_page_id, &response_data); |
| 2485 ExpectFilledAddressFormElvis(response_page_id, response_data, kDefaultPageID, | 2492 ExpectFilledAddressFormElvis(response_page_id, response_data, kDefaultPageID, |
| 2486 false); | 2493 false); |
| 2487 | 2494 |
| 2488 // Simulate OnWillSubmitForm(). We should *not* be calling into the PDM at | 2495 // Simulate OnWillSubmitForm(). We should *not* be calling into the PDM at |
| 2489 // this point (since the form was not submitted). Does not call | 2496 // this point (since the form was not submitted). Does not call |
| 2490 // OnFormSubmitted. | 2497 // OnFormSubmitted. |
| 2491 autofill_manager_->ResetRunLoop(); | 2498 autofill_manager_->ResetRunLoop(); |
| 2492 autofill_manager_->OnWillSubmitForm(response_data, base::TimeTicks::Now()); | 2499 autofill_manager_->OnWillSubmitForm(response_data, base::TimeTicks::Now()); |
| 2493 autofill_manager_->WaitForAsyncOnWillSubmitForm(); | 2500 autofill_manager_->WaitForAsyncUploadProcess(); |
| 2494 EXPECT_EQ(0, personal_data_.num_times_save_imported_profile_called()); | 2501 EXPECT_EQ(0, personal_data_.num_times_save_imported_profile_called()); |
| 2495 } | 2502 } |
| 2496 | 2503 |
| 2497 // Test that when Autocomplete is enabled and Autofill is disabled, form | 2504 // Test that when Autocomplete is enabled and Autofill is disabled, form |
| 2498 // submissions are still received by AutocompleteHistoryManager. | 2505 // submissions are still received by AutocompleteHistoryManager. |
| 2499 TEST_F(AutofillManagerTest, FormSubmittedAutocompleteEnabled) { | 2506 TEST_F(AutofillManagerTest, FormSubmittedAutocompleteEnabled) { |
| 2500 TestAutofillClient client; | 2507 TestAutofillClient client; |
| 2501 autofill_manager_.reset( | 2508 autofill_manager_.reset( |
| 2502 new TestAutofillManager(autofill_driver_.get(), &client, NULL)); | 2509 new TestAutofillManager(autofill_driver_.get(), &client, NULL)); |
| 2503 autofill_manager_->set_autofill_enabled(false); | 2510 autofill_manager_->set_autofill_enabled(false); |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3342 FormData form; | 3349 FormData form; |
| 3343 test::CreateTestAddressFormData(&form); | 3350 test::CreateTestAddressFormData(&form); |
| 3344 std::vector<FormData> forms(1, form); | 3351 std::vector<FormData> forms(1, form); |
| 3345 FormsSeen(forms); | 3352 FormsSeen(forms); |
| 3346 const FormFieldData& field = form.fields[0]; | 3353 const FormFieldData& field = form.fields[0]; |
| 3347 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() | 3354 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() |
| 3348 | 3355 |
| 3349 EXPECT_TRUE(external_delegate_->on_query_seen()); | 3356 EXPECT_TRUE(external_delegate_->on_query_seen()); |
| 3350 } | 3357 } |
| 3351 | 3358 |
| 3359 // Test that unfocusing a filled form sends an upload with types matching the | |
| 3360 // fields. | |
| 3361 TEST_F(AutofillManagerTest, OnTextFieldDidChangeAndUnfocus_Upload) { | |
| 3362 // Set up our form data (it's already filled out with user data). | |
| 3363 FormData form; | |
| 3364 form.name = ASCIIToUTF16("MyForm"); | |
| 3365 form.origin = GURL("http://myform.com/form.html"); | |
| 3366 form.action = GURL("http://myform.com/submit.html"); | |
| 3367 | |
| 3368 std::vector<ServerFieldTypeSet> expected_types; | |
| 3369 ServerFieldTypeSet types; | |
| 3370 | |
| 3371 FormFieldData field; | |
| 3372 test::CreateTestFormField("First Name", "firstname", "Elvis", "text", &field); | |
| 3373 form.fields.push_back(field); | |
| 3374 types.insert(NAME_FIRST); | |
| 3375 expected_types.push_back(types); | |
| 3376 | |
| 3377 test::CreateTestFormField("Last Name", "lastname", "Presley", "text", &field); | |
| 3378 form.fields.push_back(field); | |
| 3379 types.clear(); | |
| 3380 types.insert(NAME_LAST); | |
| 3381 expected_types.push_back(types); | |
| 3382 | |
| 3383 test::CreateTestFormField("Email", "email", "theking@gmail.com", "text", | |
| 3384 &field); | |
| 3385 form.fields.push_back(field); | |
| 3386 types.clear(); | |
| 3387 types.insert(EMAIL_ADDRESS); | |
| 3388 expected_types.push_back(types); | |
| 3389 | |
| 3390 FormsSeen(std::vector<FormData>(1, form)); | |
| 3391 | |
| 3392 // We will expect these types in the upload and no observed submission. | |
|
vabr (Chromium)
2015/12/07 09:47:34
nit: Could you also point out in the comments, whi
Mathieu
2015/12/07 14:23:08
Done.
| |
| 3393 autofill_manager_->set_expected_submitted_field_types(expected_types); | |
| 3394 autofill_manager_->set_expected_observed_submission(false); | |
| 3395 | |
| 3396 // Simulate editing a field. | |
| 3397 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | |
| 3398 base::TimeTicks::Now()); | |
| 3399 | |
| 3400 autofill_manager_->ResetRunLoop(); | |
| 3401 // Simulate lost of focus on the form. | |
| 3402 autofill_manager_->OnFocusNoLongerOnForm(); | |
| 3403 // Wait for upload to complete (will check expected types as well). | |
| 3404 autofill_manager_->WaitForAsyncUploadProcess(); | |
| 3405 } | |
| 3406 | |
| 3407 // Test that navigating with a filled form sends an upload with types matching | |
| 3408 // the fields. | |
| 3409 TEST_F(AutofillManagerTest, OnTextFieldDidChangeAndNavigation_Upload) { | |
| 3410 // Set up our form data (it's already filled out with user data). | |
| 3411 FormData form; | |
| 3412 form.name = ASCIIToUTF16("MyForm"); | |
| 3413 form.origin = GURL("http://myform.com/form.html"); | |
| 3414 form.action = GURL("http://myform.com/submit.html"); | |
| 3415 | |
| 3416 std::vector<ServerFieldTypeSet> expected_types; | |
| 3417 ServerFieldTypeSet types; | |
| 3418 | |
| 3419 FormFieldData field; | |
| 3420 test::CreateTestFormField("First Name", "firstname", "Elvis", "text", &field); | |
| 3421 form.fields.push_back(field); | |
| 3422 types.insert(NAME_FIRST); | |
| 3423 expected_types.push_back(types); | |
| 3424 | |
| 3425 test::CreateTestFormField("Last Name", "lastname", "Presley", "text", &field); | |
| 3426 form.fields.push_back(field); | |
| 3427 types.clear(); | |
| 3428 types.insert(NAME_LAST); | |
| 3429 expected_types.push_back(types); | |
| 3430 | |
| 3431 test::CreateTestFormField("Email", "email", "theking@gmail.com", "text", | |
| 3432 &field); | |
| 3433 form.fields.push_back(field); | |
| 3434 types.clear(); | |
| 3435 types.insert(EMAIL_ADDRESS); | |
| 3436 expected_types.push_back(types); | |
| 3437 | |
| 3438 FormsSeen(std::vector<FormData>(1, form)); | |
| 3439 | |
| 3440 // We will expect these types in the upload and no observed submission. | |
| 3441 autofill_manager_->set_expected_submitted_field_types(expected_types); | |
| 3442 autofill_manager_->set_expected_observed_submission(false); | |
| 3443 | |
| 3444 // Simulate editing a field. | |
| 3445 autofill_manager_->OnTextFieldDidChange(form, form.fields.front(), | |
| 3446 base::TimeTicks::Now()); | |
| 3447 | |
| 3448 autofill_manager_->ResetRunLoop(); | |
| 3449 // Simulate a navigation so that the pending form is uploaded. | |
| 3450 autofill_manager_->Reset(); | |
| 3451 // Wait for upload to complete (will check expected types as well). | |
| 3452 autofill_manager_->WaitForAsyncUploadProcess(); | |
| 3453 } | |
| 3454 | |
| 3455 // Test that unfocusing a filled form sends an upload with types matching the | |
| 3456 // fields. | |
| 3457 TEST_F(AutofillManagerTest, OnDidFillAutofillFormDataAndUnfocus_Upload) { | |
| 3458 // Set up our form data (empty). | |
| 3459 FormData form; | |
| 3460 form.name = ASCIIToUTF16("MyForm"); | |
| 3461 form.origin = GURL("http://myform.com/form.html"); | |
| 3462 form.action = GURL("http://myform.com/submit.html"); | |
| 3463 | |
| 3464 std::vector<ServerFieldTypeSet> expected_types; | |
| 3465 | |
| 3466 // These fields should all match. | |
| 3467 ServerFieldTypeSet types; | |
| 3468 FormFieldData field; | |
| 3469 test::CreateTestFormField("First Name", "firstname", "", "text", &field); | |
| 3470 form.fields.push_back(field); | |
| 3471 types.insert(NAME_FIRST); | |
| 3472 expected_types.push_back(types); | |
| 3473 | |
| 3474 test::CreateTestFormField("Last Name", "lastname", "", "text", &field); | |
| 3475 form.fields.push_back(field); | |
| 3476 types.clear(); | |
| 3477 types.insert(NAME_LAST); | |
| 3478 expected_types.push_back(types); | |
| 3479 | |
| 3480 test::CreateTestFormField("Email", "email", "", "text", &field); | |
| 3481 form.fields.push_back(field); | |
| 3482 types.clear(); | |
| 3483 types.insert(EMAIL_ADDRESS); | |
| 3484 expected_types.push_back(types); | |
| 3485 | |
| 3486 FormsSeen(std::vector<FormData>(1, form)); | |
| 3487 | |
| 3488 // We will expect these types in the upload and no observed submission. | |
| 3489 autofill_manager_->set_expected_submitted_field_types(expected_types); | |
| 3490 autofill_manager_->set_expected_observed_submission(false); | |
| 3491 | |
| 3492 // Form was autofilled with user data. | |
| 3493 form.fields[0].value = base::ASCIIToUTF16("Elvis"); | |
| 3494 form.fields[1].value = base::ASCIIToUTF16("Presley"); | |
| 3495 form.fields[2].value = base::ASCIIToUTF16("theking@gmail.com"); | |
| 3496 autofill_manager_->OnDidFillAutofillFormData(form, base::TimeTicks::Now()); | |
| 3497 | |
| 3498 autofill_manager_->ResetRunLoop(); | |
| 3499 // Simulate lost of focus on the form. | |
| 3500 autofill_manager_->OnFocusNoLongerOnForm(); | |
| 3501 // Wait for upload to complete. | |
| 3502 autofill_manager_->WaitForAsyncUploadProcess(); | |
| 3503 } | |
| 3504 | |
| 3352 // Test to verify suggestions appears for forms having credit card number split | 3505 // Test to verify suggestions appears for forms having credit card number split |
| 3353 // across fields. | 3506 // across fields. |
| 3354 TEST_F(AutofillManagerTest, GetCreditCardSuggestionsForNumberSpitAcrossFields) { | 3507 TEST_F(AutofillManagerTest, GetCreditCardSuggestionsForNumberSpitAcrossFields) { |
| 3355 // Set up our form data with credit card number split across fields. | 3508 // Set up our form data with credit card number split across fields. |
| 3356 FormData form; | 3509 FormData form; |
| 3357 form.name = ASCIIToUTF16("MyForm"); | 3510 form.name = ASCIIToUTF16("MyForm"); |
| 3358 form.origin = GURL("https://myform.com/form.html"); | 3511 form.origin = GURL("https://myform.com/form.html"); |
| 3359 form.action = GURL("https://myform.com/submit.html"); | 3512 form.action = GURL("https://myform.com/submit.html"); |
| 3360 | 3513 |
| 3361 FormFieldData name_field; | 3514 FormFieldData name_field; |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3864 // Make sure it's reset for the next test case. | 4017 // Make sure it's reset for the next test case. |
| 3865 autofill_driver_->SetIsOffTheRecord(false); | 4018 autofill_driver_->SetIsOffTheRecord(false); |
| 3866 EXPECT_TRUE(autofill_manager_->ShouldUploadForm(form_structure_4)); | 4019 EXPECT_TRUE(autofill_manager_->ShouldUploadForm(form_structure_4)); |
| 3867 | 4020 |
| 3868 // Autofill disabled. | 4021 // Autofill disabled. |
| 3869 autofill_manager_->set_autofill_enabled(false); | 4022 autofill_manager_->set_autofill_enabled(false); |
| 3870 EXPECT_FALSE(autofill_manager_->ShouldUploadForm(form_structure_3)); | 4023 EXPECT_FALSE(autofill_manager_->ShouldUploadForm(form_structure_3)); |
| 3871 } | 4024 } |
| 3872 | 4025 |
| 3873 } // namespace autofill | 4026 } // namespace autofill |
| OLD | NEW |