chromium/components/autofill/core/browser/webdata/payments/payments_autofill_table_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/autofill/core/browser/webdata/payments/payments_autofill_table.h"

#include <map>
#include <memory>
#include <set>
#include <string>
#include <string_view>
#include <utility>

#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "base/uuid.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/data_model/autofill_offer_data.h"
#include "components/autofill/core/browser/data_model/autofill_wallet_usage_data.h"
#include "components/autofill/core/browser/data_model/bank_account.h"
#include "components/autofill/core/browser/data_model/credit_card.h"
#include "components/autofill/core/browser/data_model/credit_card_benefit_test_api.h"
#include "components/autofill/core/browser/data_model/credit_card_cloud_token_data.h"
#include "components/autofill/core/browser/data_model/payments_metadata.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/payments/payments_customer_data.h"
#include "components/autofill/core/browser/webdata/autofill_change.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/autofill/core/common/autofill_util.h"
#include "components/autofill/core/common/credit_card_network_identifiers.h"
#include "components/os_crypt/sync/os_crypt_mocker.h"
#include "components/sync/protocol/autofill_specifics.pb.h"
#include "components/webdata/common/web_database.h"
#include "sql/statement.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"

Time;
ElementsAre;
UnorderedElementsAre;

namespace autofill {
namespace {

CreditCardBenefitBase::BenefitId get_benefit_id(
    const CreditCardBenefit& benefit) {}

class PaymentsAutofillTableTest : public testing::Test {};

TEST_F(PaymentsAutofillTableTest, Iban) {}

// Test that masked IBANs can be added and loaded successfully.
TEST_F(PaymentsAutofillTableTest, MaskedServerIban) {}

// Test that masked IBANs can be added and loaded successfully without updating
// their metadata.
TEST_F(PaymentsAutofillTableTest, MaskedServerIbanMetadataNotUpdated) {}

TEST_F(PaymentsAutofillTableTest, CreditCard) {}

TEST_F(PaymentsAutofillTableTest, AddCreditCardCvcWithFlagOff) {}

// Tests that adding credit card with cvc, get credit card with cvc and update
// credit card with only cvc change will not update credit_card table
// modification_date.
TEST_F(PaymentsAutofillTableTest, CreditCardCvc) {}

// Tests that update a credit card CVC that doesn't have CVC set initially
// inserts a new CVC record.
TEST_F(PaymentsAutofillTableTest, UpdateCreditCardCvc_Add) {}

// Tests that updating a credit card CVC that is different from CVC set
// initially.
TEST_F(PaymentsAutofillTableTest, UpdateCreditCardCvc_Update) {}

// Tests that updating a credit card CVC with empty CVC will delete CVC
// record. This is necessary because if inserting a CVC, UPDATE is chosen over
// INSERT, it will causes a crash.
TEST_F(PaymentsAutofillTableTest, UpdateCreditCardCvc_Delete) {}

TEST_F(PaymentsAutofillTableTest, LocalCvcs_ClearAll) {}

// Tests that verify add, update and clear server cvc function working as
// expected.
TEST_F(PaymentsAutofillTableTest, ServerCvc) {}

// Tests that verify reconcile server cvc function working as expected.
TEST_F(PaymentsAutofillTableTest, ReconcileServerCvcs) {}

TEST_F(PaymentsAutofillTableTest, AddServerCreditCardForTesting) {}

TEST_F(PaymentsAutofillTableTest, UpdateCreditCard) {}

TEST_F(PaymentsAutofillTableTest, UpdateCreditCardOriginOnly) {}

TEST_F(PaymentsAutofillTableTest, RemoveAutofillDataModifiedBetween) {}

TEST_F(PaymentsAutofillTableTest, RemoveOriginURLsModifiedBetween) {}

TEST_F(PaymentsAutofillTableTest, SetGetServerCards) {}

TEST_F(PaymentsAutofillTableTest, SetGetRemoveServerCardMetadata) {}

// Test that masked IBAN metadata can be added, retrieved and removed
// successfully.
TEST_F(PaymentsAutofillTableTest, SetGetRemoveServerIbanMetadata) {}

TEST_F(PaymentsAutofillTableTest, AddUpdateServerCardMetadata) {}

TEST_F(PaymentsAutofillTableTest, UpdateServerCardMetadataDoesNotChangeData) {}

// Test that updating masked IBAN metadata won't affect IBAN data.
TEST_F(PaymentsAutofillTableTest, UpdateServerIbanMetadata) {}

TEST_F(PaymentsAutofillTableTest, RemoveWrongServerCardMetadata) {}

TEST_F(PaymentsAutofillTableTest, SetServerCardsData) {}

// Tests that adding server cards data does not delete the existing metadata.
TEST_F(PaymentsAutofillTableTest, SetServerCardsData_ExistingMetadata) {}

// Calling SetServerCreditCards should replace all existing cards.
TEST_F(PaymentsAutofillTableTest, SetServerCardModify) {}

TEST_F(PaymentsAutofillTableTest, SetServerCardUpdateUsageStatsAndBillingAddress) {}

// Test that we can get what we set.
TEST_F(PaymentsAutofillTableTest, SetGetPaymentsCustomerData) {}

// We don't set anything in the table. Test that we don't crash.
TEST_F(PaymentsAutofillTableTest, GetPaymentsCustomerData_NoData) {}

// The latest PaymentsCustomerData that was set is returned.
TEST_F(PaymentsAutofillTableTest, SetGetPaymentsCustomerData_MultipleSet) {}

TEST_F(PaymentsAutofillTableTest, SetGetCreditCardCloudData_OneTimeSet) {}

TEST_F(PaymentsAutofillTableTest, SetGetCreditCardCloudData_MultipleSet) {}

TEST_F(PaymentsAutofillTableTest, GetCreditCardCloudData_NoData) {}

TEST_F(PaymentsAutofillTableTest, SetAndGetCreditCardOfferData) {}

TEST_F(PaymentsAutofillTableTest, SetAndGetVirtualCardUsageData) {}

TEST_F(PaymentsAutofillTableTest, AddUpdateRemoveVirtualCardUsageData) {}

TEST_F(PaymentsAutofillTableTest, RemoveAllVirtualCardUsageData) {}

TEST_F(PaymentsAutofillTableTest, GetMaskedBankAccounts) {}

TEST_F(PaymentsAutofillTableTest,
       GetMaskedBankAccounts_BankAccountTypeOutOfBounds) {}

TEST_F(PaymentsAutofillTableTest, SetMaskedBankAccounts) {}

TEST_F(PaymentsAutofillTableTest, GetAllCreditCardBenefits) {}

TEST_F(PaymentsAutofillTableTest, AddInactiveCreditCardBenefit) {}

TEST_F(PaymentsAutofillTableTest, AddInvalidCreditCardBenefit) {}

TEST_F(PaymentsAutofillTableTest, ClearCreditCardBenefits) {}

TEST_F(PaymentsAutofillTableTest, GetCreditCardBenefitsForInstrumentId) {}

TEST_F(PaymentsAutofillTableTest,
       PaymentInstrument_StoresPaymentInstrumentWithBankAccount) {}

TEST_F(PaymentsAutofillTableTest,
       PaymentInstrument_StoresPaymentInstrumentWithIban) {}

TEST_F(PaymentsAutofillTableTest,
       PaymentInstrument_StoresMultiplePaymentInstruments) {}

TEST_F(PaymentsAutofillTableTest,
       PaymentInstrument_SetPaymentInstrumentsOverwritesExistingValues) {}

}  // namespace
}  // namespace autofill