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

Unified Diff: components/autofill/core/browser/webdata/autofill_table_unittest.cc

Issue 2829853008: Stores server card as a full server card when upload to server succeeds. (Closed)
Patch Set: Renames AddServerCreditCard to AddFullServerCreditCard. Adds DCHECK to verify that we are in a tran… Created 3 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/webdata/autofill_table_unittest.cc
diff --git a/components/autofill/core/browser/webdata/autofill_table_unittest.cc b/components/autofill/core/browser/webdata/autofill_table_unittest.cc
index 58439067907dbeb5f6ad215f7b396000accac334..87cda8edab7a4f7b2bb8547b0b94ac608e4694f7 100644
--- a/components/autofill/core/browser/webdata/autofill_table_unittest.cc
+++ b/components/autofill/core/browser/webdata/autofill_table_unittest.cc
@@ -1029,6 +1029,24 @@ TEST_F(AutofillTableTest, CreditCard) {
EXPECT_FALSE(db_creditcard);
}
+TEST_F(AutofillTableTest, AddFullServerCreditCard) {
+ CreditCard credit_card;
+ credit_card.set_record_type(CreditCard::FULL_SERVER_CARD);
+ credit_card.set_server_id("server_id");
+ credit_card.set_origin("https://www.example.com/");
+ credit_card.SetRawInfo(CREDIT_CARD_NAME_FULL, ASCIIToUTF16("Jack Torrance"));
+ credit_card.SetRawInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("1234567890123456"));
+ credit_card.SetRawInfo(CREDIT_CARD_EXP_MONTH, ASCIIToUTF16("04"));
+ credit_card.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, ASCIIToUTF16("2013"));
+
+ EXPECT_TRUE(table_->AddFullServerCreditCard(credit_card));
+
+ std::vector<std::unique_ptr<CreditCard>> outputs;
+ ASSERT_TRUE(table_->GetServerCreditCards(&outputs));
+ ASSERT_EQ(1U, outputs.size());
+ EXPECT_EQ(0, credit_card.Compare(*outputs[0]));
+}
+
TEST_F(AutofillTableTest, UpdateAutofillProfile) {
// Add a profile to the db.
AutofillProfile profile;

Powered by Google App Engine
This is Rietveld 408576698