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

Side by Side Diff: components/autofill/core/browser/webdata/autofill_table_unittest.cc

Issue 2109643003: Add billing address to masked server credit cards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add version_66.sql to the build file. Created 4 years, 5 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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <tuple> 10 #include <tuple>
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 table_->SetServerCreditCards(inputs); 1781 table_->SetServerCreditCards(inputs);
1782 table_->GetServerCreditCards(&outputs.get()); 1782 table_->GetServerCreditCards(&outputs.get());
1783 ASSERT_EQ(1u, outputs.size()); 1783 ASSERT_EQ(1u, outputs.size());
1784 EXPECT_EQ(masked_card.server_id(), outputs[0]->server_id()); 1784 EXPECT_EQ(masked_card.server_id(), outputs[0]->server_id());
1785 EXPECT_EQ(1U, outputs[0]->use_count()); 1785 EXPECT_EQ(1U, outputs[0]->use_count());
1786 EXPECT_NE(base::Time(), outputs[0]->use_date()); 1786 EXPECT_NE(base::Time(), outputs[0]->use_date());
1787 EXPECT_EQ(base::Time(), outputs[0]->modification_date()); 1787 EXPECT_EQ(base::Time(), outputs[0]->modification_date());
1788 outputs.clear(); 1788 outputs.clear();
1789 } 1789 }
1790 1790
1791 TEST_F(AutofillTableTest, UpdateServerCardBillingAddress) {
1792 // Add a masked card.
1793 CreditCard masked_card(CreditCard::MASKED_SERVER_CARD, "a123");
1794 masked_card.SetRawInfo(CREDIT_CARD_NAME_FULL,
1795 ASCIIToUTF16("Paul F. Tompkins"));
1796 masked_card.SetRawInfo(CREDIT_CARD_EXP_MONTH, ASCIIToUTF16("1"));
1797 masked_card.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, ASCIIToUTF16("2020"));
1798 masked_card.SetRawInfo(CREDIT_CARD_NUMBER, ASCIIToUTF16("1111"));
1799 masked_card.set_billing_address_id("billing-address-id-1");
1800 masked_card.SetTypeForMaskedCard(kVisaCard);
1801 test::SetServerCreditCards(table_.get(),
1802 std::vector<CreditCard>(1, masked_card));
1803 ScopedVector<CreditCard> outputs;
1804 table_->GetServerCreditCards(&outputs.get());
1805 ASSERT_EQ(1u, outputs.size());
1806
1807 EXPECT_EQ("billing-address-id-1", outputs[0]->billing_address_id());
1808
1809 masked_card.set_billing_address_id("billing-address-id-2");
1810 table_->UpdateServerCardBillingAddress(masked_card);
1811 outputs.clear();
1812 table_->GetServerCreditCards(&outputs.get());
1813 ASSERT_EQ(1u, outputs.size());
1814
1815 EXPECT_EQ("billing-address-id-2", outputs[0]->billing_address_id());
1816 }
1817
1791 TEST_F(AutofillTableTest, SetServerProfile) { 1818 TEST_F(AutofillTableTest, SetServerProfile) {
1792 AutofillProfile one(AutofillProfile::SERVER_PROFILE, "a123"); 1819 AutofillProfile one(AutofillProfile::SERVER_PROFILE, "a123");
1793 std::vector<AutofillProfile> inputs; 1820 std::vector<AutofillProfile> inputs;
1794 inputs.push_back(one); 1821 inputs.push_back(one);
1795 table_->SetServerProfiles(inputs); 1822 table_->SetServerProfiles(inputs);
1796 1823
1797 std::vector<AutofillProfile*> outputs; 1824 std::vector<AutofillProfile*> outputs;
1798 table_->GetServerProfiles(&outputs); 1825 table_->GetServerProfiles(&outputs);
1799 ASSERT_EQ(1u, outputs.size()); 1826 ASSERT_EQ(1u, outputs.size());
1800 EXPECT_EQ(one.server_id(), outputs[0]->server_id()); 1827 EXPECT_EQ(one.server_id(), outputs[0]->server_id());
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 for (size_t j = 0; j < kTestCases[i].expected_suggestion_count; ++j) { 2021 for (size_t j = 0; j < kTestCases[i].expected_suggestion_count; ++j) {
1995 EXPECT_EQ(ASCIIToUTF16(kTestCases[i].expected_suggestion[j]), v[j]); 2022 EXPECT_EQ(ASCIIToUTF16(kTestCases[i].expected_suggestion[j]), v[j]);
1996 } 2023 }
1997 2024
1998 changes.clear(); 2025 changes.clear();
1999 table_->RemoveFormElementsAddedBetween(t1, Time(), &changes); 2026 table_->RemoveFormElementsAddedBetween(t1, Time(), &changes);
2000 } 2027 }
2001 } 2028 }
2002 2029
2003 } // namespace autofill 2030 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698