Chromium Code Reviews| 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 2a3d651a73bbc48689861150e72716dd34276c5a..a24cdd86c050b2b3c04b09d332df1046317f3611 100644 |
| --- a/components/autofill/core/browser/autofill_manager_unittest.cc |
| +++ b/components/autofill/core/browser/autofill_manager_unittest.cc |
| @@ -1517,6 +1517,7 @@ TEST_F(AutofillManagerTest, GetCreditCardSuggestionsRepeatedObfuscatedNumber) { |
| "5231567890123456", // Mastercard |
| "05", "2999"); |
| credit_card->set_guid("00000000-0000-0000-0000-000000000007"); |
| + credit_card->set_use_date(base::Time::Now() - base::TimeDelta::FromDays(15)); |
| autofill_manager_->AddCreditCard(credit_card); |
| // Set up our form data. |
| @@ -1778,8 +1779,8 @@ TEST_F(AutofillManagerTest, FillAddressForm) { |
| const char guid[] = "00000000-0000-0000-0000-000000000001"; |
| AutofillProfile* profile = autofill_manager_->GetProfileWithGUID(guid); |
| ASSERT_TRUE(profile); |
| - EXPECT_EQ(0U, profile->use_count()); |
| - EXPECT_EQ(base::Time(), profile->use_date()); |
| + EXPECT_EQ(1U, profile->use_count()); |
| + EXPECT_NE(base::Time(), profile->use_date()); |
| int response_page_id = 0; |
| FormData response_data; |
| @@ -1789,7 +1790,7 @@ TEST_F(AutofillManagerTest, FillAddressForm) { |
| ExpectFilledAddressFormElvis(response_page_id, response_data, kDefaultPageID, |
| false); |
| - EXPECT_EQ(1U, profile->use_count()); |
| + EXPECT_EQ(2U, profile->use_count()); |
| EXPECT_NE(base::Time(), profile->use_date()); |
| } |
| @@ -4180,6 +4181,7 @@ TEST_F(AutofillManagerTest, FillInUpdatedExpirationDate) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Create, fill and submit an address form in order to establish a recent |
| @@ -4213,6 +4215,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_FeatureNotEnabled) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(false); |
| // Create, fill and submit an address form in order to establish a recent |
| @@ -4247,6 +4250,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_FeatureNotEnabled) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_CvcUnavailable) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Create, fill and submit an address form in order to establish a recent |
| @@ -4283,6 +4287,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_CvcUnavailable) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_NoProfileAvailable) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Don't fill or submit an address form. |
| @@ -4313,6 +4318,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_NoProfileAvailable) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_NoNameAvailable) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Create, fill and submit an address form in order to establish a recent |
| @@ -4349,6 +4355,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_NoNameAvailable) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_ZipCodesConflict) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Create, fill and submit two address forms with different zip codes. |
| @@ -4393,6 +4400,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_ZipCodesConflict) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_ZipCodesHavePrefixMatch) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Create, fill and submit two address forms with different zip codes. |
| @@ -4437,6 +4445,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_ZipCodesHavePrefixMatch) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_NoZipCodeAvailable) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Create, fill and submit an address form in order to establish a recent |
| @@ -4480,6 +4489,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_NoZipCodeAvailable) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_NamesMatchLoosely) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Create, fill and submit two address forms with different names. |
| @@ -4527,6 +4537,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_NamesMatchLoosely) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_NamesHaveToMatch) { |
| + personal_data_.ClearAutofillProfiles(); |
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Create, fill and submit two address forms with different names. |
| @@ -4571,6 +4582,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_NamesHaveToMatch) { |
| } |
| TEST_F(AutofillManagerTest, UploadCreditCard_UploadDetailsFails) { |
| + personal_data_.ClearAutofillProfiles(); |
|
Mathieu
2016/04/19 14:29:35
unclear why we need to call this at the beginning
sebsg
2016/04/20 20:25:46
It's because test profiles and credit cards are cr
|
| autofill_manager_->set_credit_card_upload_enabled(true); |
| // Anything other than "en-US" will cause GetUploadDetails to return a failure |