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

Unified Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 1891903002: [Autofill] Set basic information when adding a new profiles and credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test that was added in rebase and removed unnecessary test. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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 227578f4ad74439ad191f313f9fe50b84dbae63c..20e0eb4b50e39741be5dd98f8df5cd62bf381a08 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
@@ -4285,6 +4289,11 @@ TEST_F(AutofillManagerTest, UploadCreditCard_CvcUnavailable) {
TEST_F(AutofillManagerTest, UploadCreditCard_MultipleCvcFields) {
autofill_manager_->set_credit_card_upload_enabled(true);
+ // Remove the profiles that were created in the TestPersonalDataManager
+ // constructor because they would result in conflicting names that would
+ // prevent the upload.
+ personal_data_.ClearAutofillProfiles();
+
// Create, fill and submit an address form in order to establish a recent
// profile which can be selected for the upload request.
FormData address_form;
@@ -4337,6 +4346,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_MultipleCvcFields) {
}
TEST_F(AutofillManagerTest, UploadCreditCard_NoProfileAvailable) {
+ personal_data_.ClearAutofillProfiles();
autofill_manager_->set_credit_card_upload_enabled(true);
// Don't fill or submit an address form.
@@ -4367,6 +4377,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
@@ -4403,6 +4414,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.
@@ -4447,6 +4459,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.
@@ -4491,6 +4504,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
@@ -4534,6 +4548,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.
@@ -4581,6 +4596,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.
@@ -4625,6 +4641,7 @@ TEST_F(AutofillManagerTest, UploadCreditCard_NamesHaveToMatch) {
}
TEST_F(AutofillManagerTest, UploadCreditCard_UploadDetailsFails) {
+ personal_data_.ClearAutofillProfiles();
autofill_manager_->set_credit_card_upload_enabled(true);
// Anything other than "en-US" will cause GetUploadDetails to return a failure
« no previous file with comments | « components/autofill/core/browser/autofill_data_model.cc ('k') | components/autofill/core/browser/autofill_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698