#ifndef COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_TEST_UTILS_H_
#define COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_TEST_UTILS_H_
#include <string_view>
#include <vector>
#include "base/location.h"
#include "base/test/scoped_feature_list.h"
#include "base/types/strong_alias.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/unique_ids.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace autofill {
class FormFieldData;
namespace test {
class AutofillTestEnvironment { … };
class AutofillUnitTestEnvironment : public AutofillTestEnvironment { … };
class AutofillBrowserTestEnvironment : public AutofillTestEnvironment { … };
RandomizeFrame;
LocalFrameToken MakeLocalFrameToken(
RandomizeFrame randomize = RandomizeFrame(true));
RemoteFrameToken MakeRemoteFrameToken(
RandomizeFrame randomize = RandomizeFrame(true));
inline FormRendererId MakeFormRendererId() { … }
inline FieldRendererId MakeFieldRendererId() { … }
inline FormGlobalId MakeFormGlobalId(
RandomizeFrame randomize = RandomizeFrame(true)) { … }
inline FieldGlobalId MakeFieldGlobalId(
RandomizeFrame randomize = RandomizeFrame(true)) { … }
FormData CreateFormDataForFrame(FormData form, LocalFrameToken frame_token);
FormData WithoutValues(FormData form);
FormData AsAutofilled(FormData form, bool is_autofilled = true);
FormData WithoutUnserializedData(FormData form);
FormFieldData WithoutUnserializedData(FormFieldData field);
inline constexpr char kIbanValue[] = …;
inline constexpr char16_t kIbanValue16[] = …;
inline constexpr char kIbanValue_1[] = …;
inline constexpr char kIbanValue_2[] = …;
[[nodiscard]] FormFieldData CreateTestFormField(std::string_view label,
std::string_view name,
std::string_view value,
FormControlType type);
[[nodiscard]] FormFieldData CreateTestFormField(std::string_view label,
std::string_view name,
std::string_view value,
FormControlType type,
std::string_view autocomplete);
[[nodiscard]] FormFieldData CreateTestFormField(std::string_view label,
std::string_view name,
std::string_view value,
FormControlType type,
std::string_view autocomplete,
uint64_t max_length);
[[nodiscard]] FormFieldData CreateTestSelectField(
std::string_view label,
std::string_view name,
std::string_view value,
const std::vector<const char*>& values,
const std::vector<const char*>& contents);
[[nodiscard]] FormFieldData CreateTestSelectField(
std::string_view label,
std::string_view name,
std::string_view value,
std::string_view autocomplete,
const std::vector<const char*>& values,
const std::vector<const char*>& contents);
[[nodiscard]] FormFieldData CreateTestSelectField(
const std::vector<const char*>& values);
[[nodiscard]] FormFieldData CreateTestSelectOrSelectListField(
std::string_view label,
std::string_view name,
std::string_view value,
std::string_view autocomplete,
const std::vector<const char*>& values,
const std::vector<const char*>& contents,
FormControlType type);
[[nodiscard]] FormFieldData CreateTestDatalistField(
std::string_view label,
std::string_view name,
std::string_view value,
const std::vector<const char*>& values,
const std::vector<const char*>& labels);
[[nodiscard]] FormData CreateTestPersonalInformationFormData();
[[nodiscard]] FormData CreateTestCreditCardFormData(bool is_https,
bool use_month_type,
bool split_names = false);
[[nodiscard]] FormData CreateTestIbanFormData(
std::string_view value = kIbanValue,
bool is_https = true);
[[nodiscard]] FormData CreateTestPasswordFormData();
[[nodiscard]] FormData CreateTestUnclassifiedFormData();
MATCHER_P(DeepEqualsFormData,
form_data,
negation ? "does not equal" : "equals") { … }
}
}
#endif