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

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 2864873002: Adds feature flag to disable AutofillProfileComparator for card name. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 "components/autofill/core/browser/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 1070
1071 void EnableUkmLogging() { 1071 void EnableUkmLogging() {
1072 scoped_feature_list_.InitAndEnableFeature(kAutofillUkmLogging); 1072 scoped_feature_list_.InitAndEnableFeature(kAutofillUkmLogging);
1073 } 1073 }
1074 1074
1075 void EnableAutofillUpstreamRequestCvcIfMissingExperimentAndUkmLogging() { 1075 void EnableAutofillUpstreamRequestCvcIfMissingExperimentAndUkmLogging() {
1076 scoped_feature_list_.InitWithFeatures( 1076 scoped_feature_list_.InitWithFeatures(
1077 {kAutofillUpstreamRequestCvcIfMissing, kAutofillUkmLogging}, {}); 1077 {kAutofillUpstreamRequestCvcIfMissing, kAutofillUkmLogging}, {});
1078 } 1078 }
1079 1079
1080 void DisableAutofillUpstreamUseAutofillProfileComparatorForName() {
1081 scoped_feature_list_.InitAndDisableFeature(
1082 kAutofillUpstreamUseAutofillProfileComparatorForName);
1083 }
1084
1080 void ExpectUniqueFillableFormParsedUkm() { 1085 void ExpectUniqueFillableFormParsedUkm() {
1081 ukm::TestUkmService* ukm_service = autofill_client_.GetTestUkmService(); 1086 ukm::TestUkmService* ukm_service = autofill_client_.GetTestUkmService();
1082 1087
1083 // Check that one source is logged. 1088 // Check that one source is logged.
1084 ASSERT_EQ(1U, ukm_service->sources_count()); 1089 ASSERT_EQ(1U, ukm_service->sources_count());
1085 const ukm::UkmSource* source = GetUkmSources(ukm_service)[0]; 1090 const ukm::UkmSource* source = GetUkmSources(ukm_service)[0];
1086 1091
1087 // Check that one entry is logged. 1092 // Check that one entry is logged.
1088 EXPECT_EQ(1U, ukm_service->entries_count()); 1093 EXPECT_EQ(1U, ukm_service->entries_count());
1089 const ukm::UkmEntry* entry = ukm_service->GetEntry(0); 1094 const ukm::UkmEntry* entry = ukm_service->GetEntry(0);
(...skipping 4462 matching lines...) Expand 10 before | Expand all | Expand 10 after
5552 5557
5553 // Verify that the correct histogram entry (and only that) was logged. 5558 // Verify that the correct histogram entry (and only that) was logged.
5554 ExpectUniqueCardUploadDecision( 5559 ExpectUniqueCardUploadDecision(
5555 histogram_tester, AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE); 5560 histogram_tester, AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE);
5556 // Verify that the correct UKM was logged. 5561 // Verify that the correct UKM was logged.
5557 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE); 5562 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE);
5558 } 5563 }
5559 5564
5560 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot. 5565 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
5561 #if defined(OS_ANDROID) 5566 #if defined(OS_ANDROID)
5562 #define MAYBE_UploadCreditCard_CreditCardFormHasMiddleInitial \ 5567 #define MAYBE_UploadCreditCard_CCFormHasMiddleInitial \
5563 DISABLED_UploadCreditCard_CreditCardFormHasMiddleInitial 5568 DISABLED_UploadCreditCard_CCFormHasMiddleInitial
5564 #else 5569 #else
5565 #define MAYBE_UploadCreditCard_CreditCardFormHasMiddleInitial \ 5570 #define MAYBE_UploadCreditCard_CCFormHasMiddleInitial \
5566 UploadCreditCard_CreditCardFormHasMiddleInitial 5571 UploadCreditCard_CCFormHasMiddleInitial
5567 #endif 5572 #endif
5568 TEST_F(AutofillManagerTest, 5573 TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_CCFormHasMiddleInitial) {
5569 MAYBE_UploadCreditCard_CreditCardFormHasMiddleInitial) {
5570 EnableUkmLogging(); 5574 EnableUkmLogging();
5571 personal_data_.ClearAutofillProfiles(); 5575 personal_data_.ClearAutofillProfiles();
5572 autofill_manager_->set_credit_card_upload_enabled(true); 5576 autofill_manager_->set_credit_card_upload_enabled(true);
5573 5577
5574 // Create, fill and submit two address forms with different names. 5578 // Create, fill and submit two address forms with different names.
5575 FormData address_form1, address_form2; 5579 FormData address_form1, address_form2;
5576 test::CreateTestAddressFormData(&address_form1); 5580 test::CreateTestAddressFormData(&address_form1);
5577 test::CreateTestAddressFormData(&address_form2); 5581 test::CreateTestAddressFormData(&address_form2);
5578 FormsSeen({address_form1, address_form2}); 5582 FormsSeen({address_form1, address_form2});
5579 5583
(...skipping 27 matching lines...) Expand all
5607 5611
5608 // Verify that the correct histogram entry (and only that) was logged. 5612 // Verify that the correct histogram entry (and only that) was logged.
5609 ExpectUniqueCardUploadDecision(histogram_tester, 5613 ExpectUniqueCardUploadDecision(histogram_tester,
5610 AutofillMetrics::UPLOAD_OFFERED); 5614 AutofillMetrics::UPLOAD_OFFERED);
5611 // Verify that the correct UKM was logged. 5615 // Verify that the correct UKM was logged.
5612 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED); 5616 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
5613 } 5617 }
5614 5618
5615 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot. 5619 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
5616 #if defined(OS_ANDROID) 5620 #if defined(OS_ANDROID)
5617 #define MAYBE_UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial \ 5621 #define MAYBE_UploadCreditCard_CCFormHasMiddleInitial_DisableComparator \
5618 DISABLED_UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial 5622 DISABLED_UploadCreditCard_CCFormHasMiddleInitial_DisableComparator
5619 #else 5623 #else
5620 #define MAYBE_UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial \ 5624 #define MAYBE_UploadCreditCard_CCFormHasMiddleInitial_DisableComparator \
5621 UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial 5625 UploadCreditCard_CCFormHasMiddleInitial_DisableComparator
5622 #endif 5626 #endif
5623 TEST_F(AutofillManagerTest, 5627 TEST_F(AutofillManagerTest,
5624 MAYBE_UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial) { 5628 MAYBE_UploadCreditCard_CCFormHasMiddleInitial_DisableComparator) {
Roger McFarlane (Chromium) 2017/05/08 15:38:16 Do we need to start out with the added tests disab
csashi 2017/05/08 16:17:14 Just following the pattern. I can try removing it.
5629 DisableAutofillUpstreamUseAutofillProfileComparatorForName();
5630 personal_data_.ClearAutofillProfiles();
5631 autofill_manager_->set_credit_card_upload_enabled(true);
5632
5633 // Create, fill and submit two address forms with different names.
5634 FormData address_form1, address_form2;
5635 test::CreateTestAddressFormData(&address_form1);
5636 test::CreateTestAddressFormData(&address_form2);
5637 FormsSeen({address_form1, address_form2});
5638
5639 // Names can be different case.
5640 ManuallyFillAddressForm("flo", "master", "77401", "US", &address_form1);
5641 FormSubmitted(address_form1);
5642
5643 // And they can have a middle initial even if the other names don't.
5644 ManuallyFillAddressForm("Flo W", "Master", "77401", "US", &address_form2);
5645 FormSubmitted(address_form2);
5646
5647 // Set up our credit card form data.
5648 FormData credit_card_form;
5649 CreateTestCreditCardFormData(&credit_card_form, true, false);
5650 FormsSeen({credit_card_form});
5651
5652 // Edit the data, but use the name with a middle initial *and* period, and
5653 // submit.
5654 credit_card_form.fields[0].value = ASCIIToUTF16("Flo W. Master");
5655 credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111");
5656 credit_card_form.fields[2].value = ASCIIToUTF16("11");
5657 credit_card_form.fields[3].value = ASCIIToUTF16("2017");
5658 credit_card_form.fields[4].value = ASCIIToUTF16("123");
5659
5660 base::HistogramTester histogram_tester;
5661
5662 // Names match loosely, upload should happen.
5663 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0);
5664 FormSubmitted(credit_card_form);
5665 EXPECT_TRUE(autofill_manager_->credit_card_was_uploaded());
5666
5667 // Verify that the correct histogram entry (and only that) was logged.
5668 ExpectUniqueCardUploadDecision(histogram_tester,
5669 AutofillMetrics::UPLOAD_OFFERED);
5670 }
5671
5672 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
5673 #if defined(OS_ANDROID)
5674 #define MAYBE_UploadCreditCard_NoMiddleInitialInCCForm \
5675 DISABLED_UploadCreditCard_NoMiddleInitialInCCForm
5676 #else
5677 #define MAYBE_UploadCreditCard_NoMiddleInitialInCCForm \
5678 UploadCreditCard_NoMiddleInitialInCCForm
5679 #endif
5680 TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoMiddleInitialInCCForm) {
5625 EnableUkmLogging(); 5681 EnableUkmLogging();
5626 personal_data_.ClearAutofillProfiles(); 5682 personal_data_.ClearAutofillProfiles();
5627 autofill_manager_->set_credit_card_upload_enabled(true); 5683 autofill_manager_->set_credit_card_upload_enabled(true);
5628 5684
5629 // Create, fill and submit two address forms with different names. 5685 // Create, fill and submit two address forms with different names.
5630 FormData address_form1, address_form2; 5686 FormData address_form1, address_form2;
5631 test::CreateTestAddressFormData(&address_form1); 5687 test::CreateTestAddressFormData(&address_form1);
5632 test::CreateTestAddressFormData(&address_form2); 5688 test::CreateTestAddressFormData(&address_form2);
5633 FormsSeen({address_form1, address_form2}); 5689 FormsSeen({address_form1, address_form2});
5634 5690
(...skipping 24 matching lines...) Expand all
5659 5715
5660 // Verify that the correct histogram entry (and only that) was logged. 5716 // Verify that the correct histogram entry (and only that) was logged.
5661 ExpectUniqueCardUploadDecision(histogram_tester, 5717 ExpectUniqueCardUploadDecision(histogram_tester,
5662 AutofillMetrics::UPLOAD_OFFERED); 5718 AutofillMetrics::UPLOAD_OFFERED);
5663 // Verify that the correct UKM was logged. 5719 // Verify that the correct UKM was logged.
5664 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED); 5720 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
5665 } 5721 }
5666 5722
5667 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot. 5723 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
5668 #if defined(OS_ANDROID) 5724 #if defined(OS_ANDROID)
5669 #define MAYBE_UploadCreditCard_CreditCardFormHasMiddleName \ 5725 #define MAYBE_UploadCreditCard_NoMiddleInitialInCCForm_DisableComparator \
5670 DISABLED_UploadCreditCard_CreditCardFormHasMiddleName 5726 DISABLED_UploadCreditCard_NoMiddleInitialInCCForm_DisableComparator
5671 #else 5727 #else
5672 #define MAYBE_UploadCreditCard_CreditCardFormHasMiddleName \ 5728 #define MAYBE_UploadCreditCard_NoMiddleInitialInCCForm_DisableComparator \
5673 UploadCreditCard_CreditCardFormHasMiddleName 5729 UploadCreditCard_NoMiddleInitialInCCForm_DisableComparator
5674 #endif 5730 #endif
5675 TEST_F(AutofillManagerTest, 5731 TEST_F(AutofillManagerTest,
5676 MAYBE_UploadCreditCard_CreditCardFormHasMiddleName) { 5732 MAYBE_UploadCreditCard_NoMiddleInitialInCCForm_DisableComparator) {
5733 DisableAutofillUpstreamUseAutofillProfileComparatorForName();
5734 personal_data_.ClearAutofillProfiles();
5735 autofill_manager_->set_credit_card_upload_enabled(true);
5736
5737 // Create, fill and submit two address forms with different names.
5738 FormData address_form1, address_form2;
5739 test::CreateTestAddressFormData(&address_form1);
5740 test::CreateTestAddressFormData(&address_form2);
5741 FormsSeen({address_form1, address_form2});
5742
5743 // Names can have different variations of middle initials.
5744 ManuallyFillAddressForm("flo w.", "master", "77401", "US", &address_form1);
5745 FormSubmitted(address_form1);
5746 ManuallyFillAddressForm("Flo W", "Master", "77401", "US", &address_form2);
5747 FormSubmitted(address_form2);
5748
5749 // Set up our credit card form data.
5750 FormData credit_card_form;
5751 CreateTestCreditCardFormData(&credit_card_form, true, false);
5752 FormsSeen({credit_card_form});
5753
5754 // Edit the data, but do not use middle initial.
5755 credit_card_form.fields[0].value = ASCIIToUTF16("Flo Master");
5756 credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111");
5757 credit_card_form.fields[2].value = ASCIIToUTF16("11");
5758 credit_card_form.fields[3].value = ASCIIToUTF16("2017");
5759 credit_card_form.fields[4].value = ASCIIToUTF16("123");
5760
5761 base::HistogramTester histogram_tester;
5762
5763 // Names match loosely, upload should happen.
5764 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0);
5765 FormSubmitted(credit_card_form);
5766 EXPECT_TRUE(autofill_manager_->credit_card_was_uploaded());
5767
5768 // Verify that the correct histogram entry (and only that) was logged.
5769 ExpectUniqueCardUploadDecision(histogram_tester,
5770 AutofillMetrics::UPLOAD_OFFERED);
5771 }
5772
5773 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
5774 #if defined(OS_ANDROID)
5775 #define MAYBE_UploadCreditCard_CCFormHasMiddleName \
5776 DISABLED_UploadCreditCard_CCFormHasMiddleName
5777 #else
5778 #define MAYBE_UploadCreditCard_CCFormHasMiddleName \
5779 UploadCreditCard_CCFormHasMiddleName
5780 #endif
5781 TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_CCFormHasMiddleName) {
5677 EnableUkmLogging(); 5782 EnableUkmLogging();
5678 personal_data_.ClearAutofillProfiles(); 5783 personal_data_.ClearAutofillProfiles();
5679 autofill_manager_->set_credit_card_upload_enabled(true); 5784 autofill_manager_->set_credit_card_upload_enabled(true);
5680 5785
5681 // Create, fill and submit address form without middle name. 5786 // Create, fill and submit address form without middle name.
5682 FormData address_form; 5787 FormData address_form;
5683 test::CreateTestAddressFormData(&address_form); 5788 test::CreateTestAddressFormData(&address_form);
5684 FormsSeen({address_form}); 5789 FormsSeen({address_form});
5685 ManuallyFillAddressForm("John", "Adams", "77401", "US", &address_form); 5790 ManuallyFillAddressForm("John", "Adams", "77401", "US", &address_form);
5686 FormSubmitted(address_form); 5791 FormSubmitted(address_form);
(...skipping 19 matching lines...) Expand all
5706 5811
5707 // Verify that the correct histogram entry (and only that) was logged. 5812 // Verify that the correct histogram entry (and only that) was logged.
5708 ExpectUniqueCardUploadDecision(histogram_tester, 5813 ExpectUniqueCardUploadDecision(histogram_tester,
5709 AutofillMetrics::UPLOAD_OFFERED); 5814 AutofillMetrics::UPLOAD_OFFERED);
5710 // Verify that the correct UKM was logged. 5815 // Verify that the correct UKM was logged.
5711 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED); 5816 ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
5712 } 5817 }
5713 5818
5714 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot. 5819 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
5715 #if defined(OS_ANDROID) 5820 #if defined(OS_ANDROID)
5716 #define MAYBE_UploadCreditCard_CreditCardFormRemovesMiddleName \ 5821 #define MAYBE_UploadCreditCard_CCFormHasMiddleName_DisableComparator \
5717 DISABLED_UploadCreditCard_CreditCardFormRemovesMiddleName 5822 DISABLED_UploadCreditCard_CCFormHasMiddleName_DisableComparator
5718 #else 5823 #else
5719 #define MAYBE_UploadCreditCard_CreditCardFormRemovesMiddleName \ 5824 #define MAYBE_UploadCreditCard_CCFormHasMiddleName_DisableComparator \
5720 UploadCreditCard_CreditCardFormRemovesMiddleName 5825 UploadCreditCard_CCFormHasMiddleName_DisableComparator
5721 #endif 5826 #endif
5722 TEST_F(AutofillManagerTest, 5827 TEST_F(AutofillManagerTest,
5723 MAYBE_UploadCreditCard_CreditCardFormRemovesMiddleName) { 5828 MAYBE_UploadCreditCard_CCFormHasMiddleName_DisableComparator) {
5829 DisableAutofillUpstreamUseAutofillProfileComparatorForName();
5830 personal_data_.ClearAutofillProfiles();
5831 autofill_manager_->set_credit_card_upload_enabled(true);
5832
5833 // Create, fill and submit address form without middle name.
5834 FormData address_form;
5835 test::CreateTestAddressFormData(&address_form);
5836 FormsSeen({address_form});
5837 ManuallyFillAddressForm("John", "Adams", "77401", "US", &address_form);
5838 FormSubmitted(address_form);
5839
5840 // Set up our credit card form data.
5841 FormData credit_card_form;
5842 CreateTestCreditCardFormData(&credit_card_form, true, false);
5843 FormsSeen({credit_card_form});
5844
5845 // Edit the name by adding a middle name.
5846 credit_card_form.fields[0].value = ASCIIToUTF16("John Quincy Adams");
5847 credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111");
5848 credit_card_form.fields[2].value = ASCIIToUTF16("11");
5849 credit_card_form.fields[3].value = ASCIIToUTF16("2017");
5850 credit_card_form.fields[4].value = ASCIIToUTF16("123");
5851
5852 base::HistogramTester histogram_tester;
5853
5854 // Names match loosely but we have disabled comparator. Upload should not
5855 // happen.
5856 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0);
5857 FormSubmitted(credit_card_form);
5858 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded());
5859
5860 // Verify that the correct histogram entry (and only that) was logged.
5861 ExpectUniqueCardUploadDecision(
5862 histogram_tester, AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES);
5863 }
5864
5865 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
5866 #if defined(OS_ANDROID)
5867 #define MAYBE_UploadCreditCard_CCFormRemovesMiddleName \
5868 DISABLED_UploadCreditCard_CCFormRemovesMiddleName
5869 #else
5870 #define MAYBE_UploadCreditCard_CCFormRemovesMiddleName \
5871 UploadCreditCard_CCFormRemovesMiddleName
5872 #endif
5873 TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_CCFormRemovesMiddleName) {
5724 EnableUkmLogging(); 5874 EnableUkmLogging();
5725 personal_data_.ClearAutofillProfiles(); 5875 personal_data_.ClearAutofillProfiles();
5726 autofill_manager_->set_credit_card_upload_enabled(true); 5876 autofill_manager_->set_credit_card_upload_enabled(true);
5727 5877
5728 // Create, fill and submit address form with middle name. 5878 // Create, fill and submit address form with middle name.
5729 FormData address_form; 5879 FormData address_form;
5730 test::CreateTestAddressFormData(&address_form); 5880 test::CreateTestAddressFormData(&address_form);
5731 FormsSeen({address_form}); 5881 FormsSeen({address_form});
5732 ManuallyFillAddressForm("John Quincy", "Adams", "77401", "US", &address_form); 5882 ManuallyFillAddressForm("John Quincy", "Adams", "77401", "US", &address_form);
5733 FormSubmitted(address_form); 5883 FormSubmitted(address_form);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
5819 std::string sample; 5969 std::string sample;
5820 rappor::RapporType type; 5970 rappor::RapporType type;
5821 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric( 5971 EXPECT_TRUE(rappor_service->GetRecordedSampleForMetric(
5822 "Autofill.CardUploadNotOfferedConflictingNames", &sample, &type)); 5972 "Autofill.CardUploadNotOfferedConflictingNames", &sample, &type));
5823 EXPECT_EQ("myform.com", sample); 5973 EXPECT_EQ("myform.com", sample);
5824 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type); 5974 EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type);
5825 } 5975 }
5826 5976
5827 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot. 5977 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
5828 #if defined(OS_ANDROID) 5978 #if defined(OS_ANDROID)
5979 #define MAYBE_UploadCreditCard_NamesHaveToMatch_DisableComparator \
5980 DISABLED_UploadCreditCard_NamesHaveToMatch_DisableComparator
5981 #else
5982 #define MAYBE_UploadCreditCard_NamesHaveToMatch_DisableComparator \
5983 UploadCreditCard_NamesHaveToMatch_DisableComparator
5984 #endif
5985 TEST_F(AutofillManagerTest,
5986 MAYBE_UploadCreditCard_NamesHaveToMatch_DisableComparator) {
5987 DisableAutofillUpstreamUseAutofillProfileComparatorForName();
5988 personal_data_.ClearAutofillProfiles();
5989 autofill_manager_->set_credit_card_upload_enabled(true);
5990
5991 // Create, fill and submit two address forms with different names.
5992 FormData address_form1, address_form2;
5993 test::CreateTestAddressFormData(&address_form1);
5994 test::CreateTestAddressFormData(&address_form2);
5995
5996 std::vector<FormData> address_forms;
5997 address_forms.push_back(address_form1);
5998 address_forms.push_back(address_form2);
5999 FormsSeen(address_forms);
6000
6001 ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form1);
6002 FormSubmitted(address_form1);
6003
6004 ManuallyFillAddressForm("Master", "Blaster", "77401", "US", &address_form2);
6005 FormSubmitted(address_form2);
6006
6007 // Set up our credit card form data.
6008 FormData credit_card_form;
6009 CreateTestCreditCardFormData(&credit_card_form, true, false);
6010 FormsSeen(std::vector<FormData>(1, credit_card_form));
6011
6012 // Edit the data, but use yet another name, and submit.
6013 credit_card_form.fields[0].value = ASCIIToUTF16("Bob Master");
6014 credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111");
6015 credit_card_form.fields[2].value = ASCIIToUTF16("11");
6016 credit_card_form.fields[3].value = ASCIIToUTF16("2017");
6017 credit_card_form.fields[4].value = ASCIIToUTF16("123");
6018
6019 base::HistogramTester histogram_tester;
6020
6021 // Names are required to match, upload should not happen.
6022 EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0);
6023 FormSubmitted(credit_card_form);
6024 EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded());
6025
6026 // Verify that the correct histogram entry (and only that) was logged.
6027 ExpectUniqueCardUploadDecision(
6028 histogram_tester, AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES);
6029 }
6030
6031 // TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
6032 #if defined(OS_ANDROID)
5829 #define MAYBE_UploadCreditCard_UploadDetailsFails \ 6033 #define MAYBE_UploadCreditCard_UploadDetailsFails \
5830 DISABLED_UploadCreditCard_UploadDetailsFails 6034 DISABLED_UploadCreditCard_UploadDetailsFails
5831 #else 6035 #else
5832 #define MAYBE_UploadCreditCard_UploadDetailsFails \ 6036 #define MAYBE_UploadCreditCard_UploadDetailsFails \
5833 UploadCreditCard_UploadDetailsFails 6037 UploadCreditCard_UploadDetailsFails
5834 #endif 6038 #endif
5835 TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_UploadDetailsFails) { 6039 TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_UploadDetailsFails) {
5836 EnableUkmLogging(); 6040 EnableUkmLogging();
5837 personal_data_.ClearAutofillProfiles(); 6041 personal_data_.ClearAutofillProfiles();
5838 autofill_manager_->set_credit_card_upload_enabled(true); 6042 autofill_manager_->set_credit_card_upload_enabled(true);
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
6530 6734
6531 // Wait for upload to complete (will check expected types as well). 6735 // Wait for upload to complete (will check expected types as well).
6532 autofill_manager_->WaitForAsyncUploadProcess(); 6736 autofill_manager_->WaitForAsyncUploadProcess();
6533 6737
6534 EXPECT_EQ(signature, autofill_manager_->GetSubmittedFormSignature()); 6738 EXPECT_EQ(signature, autofill_manager_->GetSubmittedFormSignature());
6535 EXPECT_NE(uploaded_available_types.end(), 6739 EXPECT_NE(uploaded_available_types.end(),
6536 uploaded_available_types.find(autofill::PASSWORD)); 6740 uploaded_available_types.find(autofill::PASSWORD));
6537 } 6741 }
6538 6742
6539 } // namespace autofill 6743 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698