#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/sync/test/integration/autofill_helper.h"
#include "chrome/browser/sync/test/integration/bookmarks_helper.h"
#include "chrome/browser/sync/test/integration/secondary_account_helper.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_service_impl_harness.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
#include "chrome/browser/sync/test/integration/wallet_helper.h"
#include "chrome/browser/webdata_services/web_data_service_factory.h"
#include "components/autofill/core/browser/autofill_data_util.h"
#include "components/autofill/core/browser/data_model/credit_card.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/metrics/autofill_metrics.h"
#include "components/autofill/core/browser/payments/payments_customer_data.h"
#include "components/autofill/core/browser/payments_data_manager.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/browser/personal_data_manager_observer.h"
#include "components/autofill/core/browser/personal_data_manager_test_utils.h"
#include "components/autofill/core/browser/webdata/payments/payments_sync_bridge_util.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/features.h"
#include "components/sync/protocol/autofill_specifics.pb.h"
#include "components/sync/protocol/data_type_state.pb.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/protocol/sync_entity.pb.h"
#include "components/sync/service/sync_service.h"
#include "components/sync/service/sync_token_status.h"
#include "components/sync/test/entity_builder_factory.h"
#include "components/sync/test/fake_server.h"
#include "components/webdata/common/web_data_service_consumer.h"
#include "content/public/test/browser_test.h"
#include "testing/gmock/include/gmock/gmock.h"
AutofillMetrics;
CreditCard;
CreditCardCloudTokenData;
PaymentsMetadata;
TruncateUTF8;
Contains;
CreateDefaultSyncCreditCardCloudTokenData;
CreateDefaultSyncPaymentsCustomerData;
CreateDefaultSyncWalletCard;
CreateSyncCreditCardCloudTokenData;
CreateSyncPaymentsCustomerData;
CreateSyncWalletCard;
ExpectDefaultCreditCardValues;
GetAccountWebDataService;
GetDefaultCreditCard;
GetPersonalDataManager;
GetProfileWebDataService;
GetServerCardsMetadata;
GetWalletDataTypeState;
kDefaultBillingAddressID;
kDefaultCardID;
kDefaultCustomerID;
namespace {
ACTION_P(QuitMessageLoop, loop) { … }
MATCHER(AddressHasConverted, "") { … }
const char kLocalGuidA[] = …;
const char kDifferentBillingAddressId[] = …;
template <class T>
class AutofillWebDataServiceConsumer : public WebDataServiceConsumer { … };
#if !BUILDFLAG(IS_CHROMEOS_ASH)
std::vector<std::unique_ptr<CreditCard>> GetServerCards(
scoped_refptr<autofill::AutofillWebDataService> service) { … }
std::unique_ptr<autofill::PaymentsCustomerData> GetPaymentsCustomerData(
scoped_refptr<autofill::AutofillWebDataService> service) { … }
std::vector<std::unique_ptr<autofill::CreditCardCloudTokenData>>
GetCreditCardCloudTokenData(
scoped_refptr<autofill::AutofillWebDataService> service) { … }
#endif
class TestForAuthError : public UpdatedProgressMarkerChecker { … };
}
class SingleClientWalletSyncTest : public SyncTest { … };
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest,
DownloadAccountStorage_Card) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest,
ClearOnSignOutAndDownstreamOnSignIn) { … }
#endif
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest, EnabledByDefault) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest, ClearOnSignOut) { … }
#endif
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest, ClearOnSyncPaused) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest,
NewSyncDataShouldReplaceExistingData) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest, EmptyUpdatesAreIgnored) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest, SameUpdatesAreIgnored) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest, ChangedEntityGetsUpdated) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest, ClearOnDisableWalletSync) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest,
ClearOnDisableWalletAutofill) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest,
NewWalletCardRemovesExistingCardAndProfile) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest,
NewWalletDataRemovesExistingData) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest,
SameWalletCard_PreservesLocalBillingAddressId) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest,
SameWalletCard_DiscardsOldServerBillingAddressId) { … }
IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest,
ShouldUpdateWhenDownloadingManyUpdates) { … }
class SingleClientWalletSecondaryAccountSyncTest
: public SingleClientWalletSyncTest { … };
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_F(SingleClientWalletSecondaryAccountSyncTest,
SwitchesFromAccountToProfileStorageOnSyncOptIn) { … }
IN_PROC_BROWSER_TEST_F(
SingleClientWalletSecondaryAccountSyncTest,
SwitchesFromAccountToProfileStorageOnSyncOptInWithAdvancedSetup) { … }
#endif