#include "components/autofill/core/browser/payments/iban_save_manager.h"
#include "base/json/json_reader.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/uuid.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/data_model/iban.h"
#include "components/autofill/core/browser/payments/mock_test_payments_network_interface.h"
#include "components/autofill/core/browser/payments/payments_autofill_client.h"
#include "components/autofill/core/browser/payments/payments_network_interface.h"
#include "components/autofill/core/browser/payments_data_manager.h"
#include "components/autofill/core/browser/strike_databases/payments/iban_save_strike_database.h"
#include "components/autofill/core/browser/test_autofill_client.h"
#include "components/autofill/core/browser/test_personal_data_manager.h"
#include "components/autofill/core/common/autofill_prefs.h"
#include "components/prefs/pref_service.h"
#include "components/sync/test/test_sync_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace autofill {
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
namespace {
constexpr char kLegalMessageLines[] = …;
constexpr char kInvalidLegalMessageLines[] = …;
constexpr char16_t kCapitalizedIbanRegex[] = …;
}
class IbanSaveManagerTest : public testing::Test { … };
TEST_F(IbanSaveManagerTest, AttemptToOfferSave_NewIban_ShouldOfferSave) { … }
TEST_F(IbanSaveManagerTest, AttemptToOfferSave_LocalIban_ShouldOfferSave) { … }
TEST_F(IbanSaveManagerTest, ShouldOfferUploadSave_NewIban_FlagOff) { … }
TEST_F(IbanSaveManagerTest, ShouldOfferUploadSave_MaxServerIban) { … }
TEST_F(IbanSaveManagerTest, ShouldOfferUploadSave_NewIban) { … }
TEST_F(IbanSaveManagerTest, ShouldOfferUploadSave_LocalIban) { … }
TEST_F(IbanSaveManagerTest, ShouldOfferUploadSave_LocalAndServerIban) { … }
TEST_F(IbanSaveManagerTest, ShouldOfferUploadSave_ServerIban) { … }
TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Accepted) { … }
TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Declined) { … }
TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Ignored) { … }
TEST_F(IbanSaveManagerTest, LocallySaveIban_NotEnoughStrikesShouldOfferToSave) { … }
TEST_F(IbanSaveManagerTest, LocallySaveIban_MaxStrikesShouldNotOfferToSave) { … }
TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Accepted_ClearsStrikes) { … }
TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Declined_AddsStrike) { … }
TEST_F(IbanSaveManagerTest, OnUserDidDecideOnLocalSave_Ignored_AddsStrike) { … }
TEST_F(IbanSaveManagerTest, LocallySaveIban_OfferIbanSave) { … }
TEST_F(IbanSaveManagerTest,
LocallySaveIban_MaxStrikesShouldNotOfferToSave_Metrics) { … }
TEST_F(IbanSaveManagerTest, StrikesPresentWhenIbanSaved_Local) { … }
TEST_F(IbanSaveManagerTest, IsIbanUploadEnabled_SyncServiceNotAvailable) { … }
TEST_F(IbanSaveManagerTest, IsIbanUploadEnabled_AuthError) { … }
TEST_F(IbanSaveManagerTest,
IsIbanUploadEnabled_SyncDoesNotHaveAutofillWalletDataActiveType) { … }
TEST_F(IbanSaveManagerTest,
IsIbanUploadEnabled_SyncServiceUsingExplicitPassphrase) { … }
TEST_F(IbanSaveManagerTest, IsIbanUploadEnabled_SyncServiceLocalSyncOnly) { … }
TEST_F(IbanSaveManagerTest, IsIbanUploadEnabled_Enabled) { … }
TEST_F(IbanSaveManagerTest, OfferUploadSave_NewIban_Success) { … }
TEST_F(IbanSaveManagerTest, OfferUploadSave_NewIban_FailureOnRegexNotMatch) { … }
TEST_F(IbanSaveManagerTest,
OfferUploadSave_NewIban_Failure_ThenAttemptToOfferLocalSave) { … }
TEST_F(
IbanSaveManagerTest,
OfferUploadSave_NewIban_InvalidLegalMessage_ThenAttemptToOfferLocalSave) { … }
TEST_F(IbanSaveManagerTest, OfferUploadSave_LocalIban_Success) { … }
TEST_F(IbanSaveManagerTest,
OfferUploadSave_LocalIban_Failure_LocalSaveNotOffered) { … }
TEST_F(IbanSaveManagerTest, UploadSaveIban_Accept_SuccessShouldClearStrikes) { … }
TEST_F(IbanSaveManagerTest, UploadSaveIban_Accept_FailureShouldAddStrike) { … }
TEST_F(IbanSaveManagerTest, OnUserDidDecideOnUploadSave_Decline_AddsStrike) { … }
TEST_F(IbanSaveManagerTest, OnUserDidDecideOnUploadSave_Ignore_AddsStrike) { … }
TEST_F(IbanSaveManagerTest, Metric_UploadOfferedIbanOrigin_NewIban) { … }
TEST_F(IbanSaveManagerTest, Metric_UploadOfferedIbanOrigin_LocalIban) { … }
TEST_F(IbanSaveManagerTest, Metric_AcceptedOfferedIbanOrigin_NewIban) { … }
TEST_F(IbanSaveManagerTest, Metric_AcceptedOfferedIbanOrigin_LocalIban) { … }
TEST_F(IbanSaveManagerTest, Metric_DeclinedOfferedIbanOrigin_NewIban) { … }
TEST_F(IbanSaveManagerTest, Metric_DeclinedOfferedIbanOrigin_LocalIban) { … }
TEST_F(IbanSaveManagerTest, Metric_IgnoredOfferedIbanOrigin_NewIban) { … }
TEST_F(IbanSaveManagerTest, Metric_IgnoredOfferedIbanOrigin_LocalIban) { … }
TEST_F(IbanSaveManagerTest, Metric_CountryOfSaveOffered_LocalIban) { … }
TEST_F(IbanSaveManagerTest, Metric_CountryOfSaveOffered_ServerIban) { … }
TEST_F(IbanSaveManagerTest, Metric_CountryOfSaveAccepted_LocalIban) { … }
TEST_F(IbanSaveManagerTest, Metric_CountryOfSaveAccepted_ServerIban) { … }
TEST_F(IbanSaveManagerTest,
Metrics_OnUploadIban_FallbackToLocalSave_NewIbanAdded) { … }
TEST_F(IbanSaveManagerTest,
Metrics_OnUploadIban_FallbackToLocalSave_LocalIbanNotAdded) { … }
TEST_F(
IbanSaveManagerTest,
Metrics_OnUploadIban_FallbackToLocalSave_LocalIbanWithDifferentNicknameNotAdded) { … }
#endif
}