#include "components/autofill/core/browser/manual_testing_import.h"
#include <string>
#include <string_view>
#include "base/check.h"
#include "base/command_line.h"
#include "base/containers/fixed_flat_map.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/location.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "components/autofill/core/browser/address_data_manager.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/data_model/autofill_structured_address_component.h"
#include "components/autofill/core/browser/field_type_utils.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/payments_data_manager.h"
namespace autofill {
namespace {
struct AutofillProfilesAndCreditCards { … };
constexpr std::string_view kKeyProfiles = …;
constexpr std::string_view kKeyCreditCards = …;
constexpr std::string_view kKeyRecordType = …;
constexpr std::string_view kKeyNickname = …;
constexpr auto kRecordTypeMapping = …;
constexpr std::string_view kKeyInitialCreatorId = …;
bool IsFullyStructuredProfile(const AutofillProfile& profile) { … }
std::optional<AutofillProfile::RecordType> GetRecordTypeFromDict(
const base::Value::Dict& dict) { … }
std::optional<AutofillProfile> MakeProfile(const base::Value::Dict& dict) { … }
std::optional<CreditCard> MakeCard(const base::Value::Dict& dict) { … }
void RemoveAllExistingProfiles(PersonalDataManager& pdm) { … }
void SetData(
base::WeakPtr<PersonalDataManager> pdm,
std::optional<AutofillProfilesAndCreditCards> profiles_or_credit_cards) { … }
template <class T>
std::optional<std::vector<T>> DataModelsFromJSON(
const base::Value::List* const json_array,
base::RepeatingCallback<std::optional<T>(const base::Value::Dict&)>
to_data_model) { … }
std::optional<AutofillProfilesAndCreditCards> LoadDataFromJSONContent(
const std::string& file_content) { … }
std::optional<AutofillProfilesAndCreditCards> LoadDataFromFile(
base::FilePath file) { … }
}
std::optional<std::vector<AutofillProfile>> LoadProfilesFromFile(
base::FilePath file) { … }
std::optional<std::vector<CreditCard>> LoadCreditCardsFromFile(
base::FilePath file) { … }
std::optional<std::vector<AutofillProfile>> AutofillProfilesFromJSON(
const base::Value::List* const profiles_json) { … }
std::optional<std::vector<CreditCard>> CreditCardsFromJSON(
const base::Value::List* const cards_json) { … }
void MaybeImportDataForManualTesting(base::WeakPtr<PersonalDataManager> pdm) { … }
}