#include <utility>
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/task_environment.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/common/autocomplete_parsing_util.h"
#include "components/autofill/core/common/autofill_clock.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/html_field_types.h"
#include "components/autofill/core/common/mojom/autofill_types.mojom.h"
#include "components/autofill/core/common/mojom/test_autofill_types.mojom.h"
#include "components/autofill/core/common/password_form_fill_data.h"
#include "components/autofill/core/common/password_generation_util.h"
#include "components/autofill/core/common/signatures.h"
#include "components/autofill/core/common/unique_ids.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace autofill {
bool operator==(const PasswordAndMetadata& lhs,
const PasswordAndMetadata& rhs) { … }
const std::vector<const char*> kOptions = {"Option1", "Option2", "Option3",
"Option4"};
namespace {
void CreateTestFieldDataPredictions(const std::string& signature,
FormFieldDataPredictions* field_predict) { … }
void CreateTestPasswordFormFillData(PasswordFormFillData* fill_data) { … }
void CreatePasswordGenerationUIData(
password_generation::PasswordGenerationUIData* data) { … }
void CreatePasswordSuggestionRequest(PasswordSuggestionRequest* data) { … }
void CheckEqualPasswordFormFillData(const PasswordFormFillData& expected,
const PasswordFormFillData& actual) { … }
void CheckEqualPassPasswordGenerationUIData(
const password_generation::PasswordGenerationUIData& expected,
const password_generation::PasswordGenerationUIData& actual) { … }
void CheckEqualPasswordSuggestionRequest(
const PasswordSuggestionRequest& expected,
const PasswordSuggestionRequest& actual) { … }
}
class AutofillTypeTraitsTestImpl : public testing::Test,
public mojom::TypeTraitsTest { … };
void ExpectFormFieldData(const FormFieldData& expected,
base::OnceClosure closure,
const FormFieldData& passed) { … }
void ExpectFormData(const FormData& expected,
base::OnceClosure closure,
const FormData& passed) { … }
void ExpectFormFieldDataPredictions(const FormFieldDataPredictions& expected,
base::OnceClosure closure,
const FormFieldDataPredictions& passed) { … }
void ExpectFormDataPredictions(FormDataPredictions expected,
base::OnceClosure closure,
const FormDataPredictions& passed) { … }
void ExpectPasswordFormFillData(const PasswordFormFillData& expected,
base::OnceClosure closure,
const PasswordFormFillData& passed) { … }
void ExpectPasswordFormGenerationData(
const PasswordFormGenerationData& expected,
base::OnceClosure closure,
const PasswordFormGenerationData& passed) { … }
void ExpectPasswordGenerationUIData(
const password_generation::PasswordGenerationUIData& expected,
base::OnceClosure closure,
const password_generation::PasswordGenerationUIData& passed) { … }
void ExpectPasswordSuggestionRequest(const PasswordSuggestionRequest& expected,
base::OnceClosure closure,
const PasswordSuggestionRequest& passed) { … }
class AutofillTypeTraitsTestImplSectionTest
: public AutofillTypeTraitsTestImpl,
public testing::WithParamInterface<Section> { … };
TEST_P(AutofillTypeTraitsTestImplSectionTest, PassSection) { … }
std::vector<Section> SectionTestCases() { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldData) { … }
TEST_F(AutofillTypeTraitsTestImpl, PassDataListFormFieldData) { … }
TEST_F(AutofillTypeTraitsTestImpl, PassFormData) { … }
TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldDataPredictions) { … }
TEST_F(AutofillTypeTraitsTestImpl, PassFormDataPredictions) { … }
TEST_F(AutofillTypeTraitsTestImpl, PassPasswordFormFillData) { … }
TEST_F(AutofillTypeTraitsTestImpl, PasswordFormGenerationData) { … }
TEST_F(AutofillTypeTraitsTestImpl, PassPasswordGenerationUIData) { … }
TEST_F(AutofillTypeTraitsTestImpl, PassPasswordSuggestionRequest) { … }
TEST(AutofillTypesMojomTraitsTest, AutocompleteParsingResult) { … }
}