| Index: components/autofill/core/browser/autofill_manager_unittest.cc
|
| diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc
|
| index bd81eba76c94a436749bb53d28862bc7cc47b3b9..4b3a6997d985291896244bcfa28e94ffe4b09314 100644
|
| --- a/components/autofill/core/browser/autofill_manager_unittest.cc
|
| +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
|
| @@ -1077,6 +1077,11 @@ class AutofillManagerTest : public testing::Test {
|
| {kAutofillUpstreamRequestCvcIfMissing, kAutofillUkmLogging}, {});
|
| }
|
|
|
| + void DisableAutofillUpstreamUseAutofillProfileComparatorForName() {
|
| + scoped_feature_list_.InitAndDisableFeature(
|
| + kAutofillUpstreamUseAutofillProfileComparatorForName);
|
| + }
|
| +
|
| void ExpectUniqueFillableFormParsedUkm() {
|
| ukm::TestUkmService* ukm_service = autofill_client_.GetTestUkmService();
|
|
|
| @@ -4629,13 +4634,7 @@ TEST_F(AutofillManagerTest, FillInUpdatedExpirationDate) {
|
| "4012888888881881");
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard DISABLED_UploadCreditCard
|
| -#else
|
| -#define MAYBE_UploadCreditCard UploadCreditCard
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard) {
|
| EnableUkmLogging();
|
| personal_data_.ClearCreditCards();
|
| personal_data_.ClearAutofillProfiles();
|
| @@ -4680,13 +4679,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard) {
|
| ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCardAndSaveCopy DISABLED_UploadCreditCardAndSaveCopy
|
| -#else
|
| -#define MAYBE_UploadCreditCardAndSaveCopy UploadCreditCardAndSaveCopy
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCardAndSaveCopy) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCardAndSaveCopy) {
|
| personal_data_.ClearCreditCards();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -4732,15 +4725,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCardAndSaveCopy) {
|
| EXPECT_EQ(base::ASCIIToUTF16(card_number), saved_card->number());
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_FeatureNotEnabled \
|
| - DISABLED_UploadCreditCard_FeatureNotEnabled
|
| -#else
|
| -#define MAYBE_UploadCreditCard_FeatureNotEnabled \
|
| - UploadCreditCard_FeatureNotEnabled
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_FeatureNotEnabled) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_FeatureNotEnabled) {
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(false);
|
|
|
| @@ -4775,14 +4760,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_FeatureNotEnabled) {
|
| histogram_tester.ExpectTotalCount("Autofill.CardUploadDecisionMetric", 0);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_CvcUnavailable \
|
| - DISABLED_UploadCreditCard_CvcUnavailable
|
| -#else
|
| -#define MAYBE_UploadCreditCard_CvcUnavailable UploadCreditCard_CvcUnavailable
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_CvcUnavailable) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_CvcUnavailable) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -4834,15 +4812,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_CvcUnavailable) {
|
| EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_CvcInvalidLength \
|
| - DISABLED_UploadCreditCard_CvcInvalidLength
|
| -#else
|
| -#define MAYBE_UploadCreditCard_CvcInvalidLength \
|
| - UploadCreditCard_CvcInvalidLength
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_CvcInvalidLength) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_CvcInvalidLength) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -4891,15 +4861,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_CvcInvalidLength) {
|
| EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_MultipleCvcFields \
|
| - DISABLED_UploadCreditCard_MultipleCvcFields
|
| -#else
|
| -#define MAYBE_UploadCreditCard_MultipleCvcFields \
|
| - UploadCreditCard_MultipleCvcFields
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_MultipleCvcFields) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_MultipleCvcFields) {
|
| EnableUkmLogging();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
|
|
| @@ -4960,15 +4922,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_MultipleCvcFields) {
|
| ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_NoCvcFieldOnForm \
|
| - DISABLED_UploadCreditCard_NoCvcFieldOnForm
|
| -#else
|
| -#define MAYBE_UploadCreditCard_NoCvcFieldOnForm \
|
| - UploadCreditCard_NoCvcFieldOnForm
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoCvcFieldOnForm) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_NoCvcFieldOnForm) {
|
| EnableUkmLogging();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
|
|
| @@ -5092,16 +5046,7 @@ TEST_F(AutofillManagerTest,
|
| 1 /* expected_num_matching_entries */);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_NoCvcFieldOnFormExperimentOff \
|
| - DISABLED_UploadCreditCard_NoCvcFieldOnFormExperimentOff
|
| -#else
|
| -#define MAYBE_UploadCreditCard_NoCvcFieldOnFormExperimentOff \
|
| - UploadCreditCard_NoCvcFieldOnFormExperimentOff
|
| -#endif
|
| -TEST_F(AutofillManagerTest,
|
| - MAYBE_UploadCreditCard_NoCvcFieldOnFormExperimentOff) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_NoCvcFieldOnFormExperimentOff) {
|
| EnableUkmLogging();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
|
|
| @@ -5166,15 +5111,7 @@ TEST_F(AutofillManagerTest,
|
| EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_NoProfileAvailable \
|
| - DISABLED_UploadCreditCard_NoProfileAvailable
|
| -#else
|
| -#define MAYBE_UploadCreditCard_NoProfileAvailable \
|
| - UploadCreditCard_NoProfileAvailable
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoProfileAvailable) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_NoProfileAvailable) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5218,15 +5155,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoProfileAvailable) {
|
| EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_NoRecentlyUsedProfile \
|
| - DISABLED_UploadCreditCard_NoRecentlyUsedProfile
|
| -#else
|
| -#define MAYBE_UploadCreditCard_NoRecentlyUsedProfile \
|
| - UploadCreditCard_NoRecentlyUsedProfile
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoRecentlyUsedProfile) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_NoRecentlyUsedProfile) {
|
| // Create the test clock and set the time to a specific value.
|
| TestAutofillClock test_clock;
|
| test_clock.SetNow(kArbitraryTime);
|
| @@ -5274,16 +5203,8 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoRecentlyUsedProfile) {
|
| AutofillMetrics::UPLOAD_NOT_OFFERED_NO_RECENTLY_USED_ADDRESS);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_CvcUnavailableAndNoProfileAvailable \
|
| - DISABLED_UploadCreditCard_CvcUnavailableAndNoProfileAvailable
|
| -#else
|
| -#define MAYBE_UploadCreditCard_CvcUnavailableAndNoProfileAvailable \
|
| - UploadCreditCard_CvcUnavailableAndNoProfileAvailable
|
| -#endif
|
| TEST_F(AutofillManagerTest,
|
| - MAYBE_UploadCreditCard_CvcUnavailableAndNoProfileAvailable) {
|
| + UploadCreditCard_CvcUnavailableAndNoProfileAvailable) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5334,14 +5255,7 @@ TEST_F(AutofillManagerTest,
|
| EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_NoNameAvailable \
|
| - DISABLED_UploadCreditCard_NoNameAvailable
|
| -#else
|
| -#define MAYBE_UploadCreditCard_NoNameAvailable UploadCreditCard_NoNameAvailable
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoNameAvailable) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_NoNameAvailable) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5390,15 +5304,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoNameAvailable) {
|
| EXPECT_EQ(rappor::ETLD_PLUS_ONE_RAPPOR_TYPE, type);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_ZipCodesConflict \
|
| - DISABLED_UploadCreditCard_ZipCodesConflict
|
| -#else
|
| -#define MAYBE_UploadCreditCard_ZipCodesConflict \
|
| - UploadCreditCard_ZipCodesConflict
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_ZipCodesConflict) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_ZipCodesConflict) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5448,15 +5354,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_ZipCodesConflict) {
|
| AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_ZIPS);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_ZipCodesHavePrefixMatch \
|
| - DISABLED_UploadCreditCard_ZipCodesHavePrefixMatch
|
| -#else
|
| -#define MAYBE_UploadCreditCard_ZipCodesHavePrefixMatch \
|
| - UploadCreditCard_ZipCodesHavePrefixMatch
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_ZipCodesHavePrefixMatch) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_ZipCodesHavePrefixMatch) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5503,15 +5401,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_ZipCodesHavePrefixMatch) {
|
| ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_NoZipCodeAvailable \
|
| - DISABLED_UploadCreditCard_NoZipCodeAvailable
|
| -#else
|
| -#define MAYBE_UploadCreditCard_NoZipCodeAvailable \
|
| - UploadCreditCard_NoZipCodeAvailable
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoZipCodeAvailable) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_NoZipCodeAvailable) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5557,16 +5447,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NoZipCodeAvailable) {
|
| ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_CreditCardFormHasMiddleInitial \
|
| - DISABLED_UploadCreditCard_CreditCardFormHasMiddleInitial
|
| -#else
|
| -#define MAYBE_UploadCreditCard_CreditCardFormHasMiddleInitial \
|
| - UploadCreditCard_CreditCardFormHasMiddleInitial
|
| -#endif
|
| -TEST_F(AutofillManagerTest,
|
| - MAYBE_UploadCreditCard_CreditCardFormHasMiddleInitial) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_CCFormHasMiddleInitial) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5612,16 +5493,52 @@ TEST_F(AutofillManagerTest,
|
| ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial \
|
| - DISABLED_UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial
|
| -#else
|
| -#define MAYBE_UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial \
|
| - UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial
|
| -#endif
|
| TEST_F(AutofillManagerTest,
|
| - MAYBE_UploadCreditCard_CreditCardFormDoesNotHaveMiddleInitial) {
|
| + UploadCreditCard_CCFormHasMiddleInitial_DisableComparator) {
|
| + DisableAutofillUpstreamUseAutofillProfileComparatorForName();
|
| + personal_data_.ClearAutofillProfiles();
|
| + autofill_manager_->set_credit_card_upload_enabled(true);
|
| +
|
| + // Create, fill and submit two address forms with different names.
|
| + FormData address_form1, address_form2;
|
| + test::CreateTestAddressFormData(&address_form1);
|
| + test::CreateTestAddressFormData(&address_form2);
|
| + FormsSeen({address_form1, address_form2});
|
| +
|
| + // Names can be different case.
|
| + ManuallyFillAddressForm("flo", "master", "77401", "US", &address_form1);
|
| + FormSubmitted(address_form1);
|
| +
|
| + // And they can have a middle initial even if the other names don't.
|
| + ManuallyFillAddressForm("Flo W", "Master", "77401", "US", &address_form2);
|
| + FormSubmitted(address_form2);
|
| +
|
| + // Set up our credit card form data.
|
| + FormData credit_card_form;
|
| + CreateTestCreditCardFormData(&credit_card_form, true, false);
|
| + FormsSeen({credit_card_form});
|
| +
|
| + // Edit the data, but use the name with a middle initial *and* period, and
|
| + // submit.
|
| + credit_card_form.fields[0].value = ASCIIToUTF16("Flo W. Master");
|
| + credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111");
|
| + credit_card_form.fields[2].value = ASCIIToUTF16("11");
|
| + credit_card_form.fields[3].value = ASCIIToUTF16("2017");
|
| + credit_card_form.fields[4].value = ASCIIToUTF16("123");
|
| +
|
| + base::HistogramTester histogram_tester;
|
| +
|
| + // Names match loosely, upload should happen.
|
| + EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0);
|
| + FormSubmitted(credit_card_form);
|
| + EXPECT_TRUE(autofill_manager_->credit_card_was_uploaded());
|
| +
|
| + // Verify that the correct histogram entry (and only that) was logged.
|
| + ExpectUniqueCardUploadDecision(histogram_tester,
|
| + AutofillMetrics::UPLOAD_OFFERED);
|
| +}
|
| +
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_NoMiddleInitialInCCForm) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5664,16 +5581,49 @@ TEST_F(AutofillManagerTest,
|
| ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_CreditCardFormHasMiddleName \
|
| - DISABLED_UploadCreditCard_CreditCardFormHasMiddleName
|
| -#else
|
| -#define MAYBE_UploadCreditCard_CreditCardFormHasMiddleName \
|
| - UploadCreditCard_CreditCardFormHasMiddleName
|
| -#endif
|
| TEST_F(AutofillManagerTest,
|
| - MAYBE_UploadCreditCard_CreditCardFormHasMiddleName) {
|
| + UploadCreditCard_NoMiddleInitialInCCForm_DisableComparator) {
|
| + DisableAutofillUpstreamUseAutofillProfileComparatorForName();
|
| + personal_data_.ClearAutofillProfiles();
|
| + autofill_manager_->set_credit_card_upload_enabled(true);
|
| +
|
| + // Create, fill and submit two address forms with different names.
|
| + FormData address_form1, address_form2;
|
| + test::CreateTestAddressFormData(&address_form1);
|
| + test::CreateTestAddressFormData(&address_form2);
|
| + FormsSeen({address_form1, address_form2});
|
| +
|
| + // Names can have different variations of middle initials.
|
| + ManuallyFillAddressForm("flo w.", "master", "77401", "US", &address_form1);
|
| + FormSubmitted(address_form1);
|
| + ManuallyFillAddressForm("Flo W", "Master", "77401", "US", &address_form2);
|
| + FormSubmitted(address_form2);
|
| +
|
| + // Set up our credit card form data.
|
| + FormData credit_card_form;
|
| + CreateTestCreditCardFormData(&credit_card_form, true, false);
|
| + FormsSeen({credit_card_form});
|
| +
|
| + // Edit the data, but do not use middle initial.
|
| + credit_card_form.fields[0].value = ASCIIToUTF16("Flo Master");
|
| + credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111");
|
| + credit_card_form.fields[2].value = ASCIIToUTF16("11");
|
| + credit_card_form.fields[3].value = ASCIIToUTF16("2017");
|
| + credit_card_form.fields[4].value = ASCIIToUTF16("123");
|
| +
|
| + base::HistogramTester histogram_tester;
|
| +
|
| + // Names match loosely, upload should happen.
|
| + EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0);
|
| + FormSubmitted(credit_card_form);
|
| + EXPECT_TRUE(autofill_manager_->credit_card_was_uploaded());
|
| +
|
| + // Verify that the correct histogram entry (and only that) was logged.
|
| + ExpectUniqueCardUploadDecision(histogram_tester,
|
| + AutofillMetrics::UPLOAD_OFFERED);
|
| +}
|
| +
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_CCFormHasMiddleName) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5711,16 +5661,45 @@ TEST_F(AutofillManagerTest,
|
| ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_CreditCardFormRemovesMiddleName \
|
| - DISABLED_UploadCreditCard_CreditCardFormRemovesMiddleName
|
| -#else
|
| -#define MAYBE_UploadCreditCard_CreditCardFormRemovesMiddleName \
|
| - UploadCreditCard_CreditCardFormRemovesMiddleName
|
| -#endif
|
| TEST_F(AutofillManagerTest,
|
| - MAYBE_UploadCreditCard_CreditCardFormRemovesMiddleName) {
|
| + UploadCreditCard_CCFormHasMiddleName_DisableComparator) {
|
| + DisableAutofillUpstreamUseAutofillProfileComparatorForName();
|
| + personal_data_.ClearAutofillProfiles();
|
| + autofill_manager_->set_credit_card_upload_enabled(true);
|
| +
|
| + // Create, fill and submit address form without middle name.
|
| + FormData address_form;
|
| + test::CreateTestAddressFormData(&address_form);
|
| + FormsSeen({address_form});
|
| + ManuallyFillAddressForm("John", "Adams", "77401", "US", &address_form);
|
| + FormSubmitted(address_form);
|
| +
|
| + // Set up our credit card form data.
|
| + FormData credit_card_form;
|
| + CreateTestCreditCardFormData(&credit_card_form, true, false);
|
| + FormsSeen({credit_card_form});
|
| +
|
| + // Edit the name by adding a middle name.
|
| + credit_card_form.fields[0].value = ASCIIToUTF16("John Quincy Adams");
|
| + credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111");
|
| + credit_card_form.fields[2].value = ASCIIToUTF16("11");
|
| + credit_card_form.fields[3].value = ASCIIToUTF16("2017");
|
| + credit_card_form.fields[4].value = ASCIIToUTF16("123");
|
| +
|
| + base::HistogramTester histogram_tester;
|
| +
|
| + // Names match loosely but we have disabled comparator. Upload should not
|
| + // happen.
|
| + EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0);
|
| + FormSubmitted(credit_card_form);
|
| + EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded());
|
| +
|
| + // Verify that the correct histogram entry (and only that) was logged.
|
| + ExpectUniqueCardUploadDecision(
|
| + histogram_tester, AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES);
|
| +}
|
| +
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_CCFormRemovesMiddleName) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5758,15 +5737,7 @@ TEST_F(AutofillManagerTest,
|
| ExpectCardUploadDecisionUkm(AutofillMetrics::UPLOAD_OFFERED);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_NamesHaveToMatch \
|
| - DISABLED_UploadCreditCard_NamesHaveToMatch
|
| -#else
|
| -#define MAYBE_UploadCreditCard_NamesHaveToMatch \
|
| - UploadCreditCard_NamesHaveToMatch
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_NamesHaveToMatch) {
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_NamesHaveToMatch) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5872,15 +5843,53 @@ TEST_F(AutofillManagerTest, UploadCreditCard_IgnoreOldProfiles) {
|
| AutofillMetrics::UPLOAD_OFFERED);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_UploadCreditCard_UploadDetailsFails \
|
| - DISABLED_UploadCreditCard_UploadDetailsFails
|
| -#else
|
| -#define MAYBE_UploadCreditCard_UploadDetailsFails \
|
| - UploadCreditCard_UploadDetailsFails
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_UploadDetailsFails) {
|
| +TEST_F(AutofillManagerTest,
|
| + UploadCreditCard_NamesHaveToMatch_DisableComparator) {
|
| + DisableAutofillUpstreamUseAutofillProfileComparatorForName();
|
| + personal_data_.ClearAutofillProfiles();
|
| + autofill_manager_->set_credit_card_upload_enabled(true);
|
| +
|
| + // Create, fill and submit two address forms with different names.
|
| + FormData address_form1, address_form2;
|
| + test::CreateTestAddressFormData(&address_form1);
|
| + test::CreateTestAddressFormData(&address_form2);
|
| +
|
| + std::vector<FormData> address_forms;
|
| + address_forms.push_back(address_form1);
|
| + address_forms.push_back(address_form2);
|
| + FormsSeen(address_forms);
|
| +
|
| + ManuallyFillAddressForm("Flo", "Master", "77401", "US", &address_form1);
|
| + FormSubmitted(address_form1);
|
| +
|
| + ManuallyFillAddressForm("Master", "Blaster", "77401", "US", &address_form2);
|
| + FormSubmitted(address_form2);
|
| +
|
| + // Set up our credit card form data.
|
| + FormData credit_card_form;
|
| + CreateTestCreditCardFormData(&credit_card_form, true, false);
|
| + FormsSeen(std::vector<FormData>(1, credit_card_form));
|
| +
|
| + // Edit the data, but use yet another name, and submit.
|
| + credit_card_form.fields[0].value = ASCIIToUTF16("Bob Master");
|
| + credit_card_form.fields[1].value = ASCIIToUTF16("4111111111111111");
|
| + credit_card_form.fields[2].value = ASCIIToUTF16("11");
|
| + credit_card_form.fields[3].value = ASCIIToUTF16("2017");
|
| + credit_card_form.fields[4].value = ASCIIToUTF16("123");
|
| +
|
| + base::HistogramTester histogram_tester;
|
| +
|
| + // Names are required to match, upload should not happen.
|
| + EXPECT_CALL(autofill_client_, ConfirmSaveCreditCardLocally(_, _)).Times(0);
|
| + FormSubmitted(credit_card_form);
|
| + EXPECT_FALSE(autofill_manager_->credit_card_was_uploaded());
|
| +
|
| + // Verify that the correct histogram entry (and only that) was logged.
|
| + ExpectUniqueCardUploadDecision(
|
| + histogram_tester, AutofillMetrics::UPLOAD_NOT_OFFERED_CONFLICTING_NAMES);
|
| +}
|
| +
|
| +TEST_F(AutofillManagerTest, UploadCreditCard_UploadDetailsFails) {
|
| EnableUkmLogging();
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| @@ -5925,13 +5934,7 @@ TEST_F(AutofillManagerTest, MAYBE_UploadCreditCard_UploadDetailsFails) {
|
| AutofillMetrics::UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED);
|
| }
|
|
|
| -// TODO(crbug.com/666704): Flaky on android_n5x_swarming_rel bot.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_DuplicateMaskedCreditCard DISABLED_DuplicatedMaskedCreditCard
|
| -#else
|
| -#define MAYBE_DuplicateMaskedCreditCard DuplicateMaskedCreditCard
|
| -#endif
|
| -TEST_F(AutofillManagerTest, MAYBE_DuplicateMaskedCreditCard) {
|
| +TEST_F(AutofillManagerTest, DuplicateMaskedCreditCard) {
|
| personal_data_.ClearAutofillProfiles();
|
| autofill_manager_->set_credit_card_upload_enabled(true);
|
| autofill_manager_->set_app_locale("en-US");
|
|
|