#include "components/autofill/core/browser/autofill_manager.h"
#include <iterator>
#include <memory>
#include <tuple>
#include <vector>
#include "base/ranges/algorithm.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/autofill_manager_test_api.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/crowdsourcing/mock_autofill_crowdsourcing_manager.h"
#include "components/autofill/core/browser/mock_autofill_manager.h"
#include "components/autofill/core/browser/mock_autofill_manager_observer.h"
#include "components/autofill/core/browser/test_autofill_client.h"
#include "components/autofill/core/browser/test_autofill_driver.h"
#include "components/autofill/core/browser/test_autofill_manager_waiter.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/form_data_test_api.h"
#include "components/autofill/core/common/mojom/autofill_types.mojom-shared.h"
#include "components/optimization_guide/core/test_optimization_guide_model_provider.h"
#include "components/translate/core/common/language_detection_details.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "components/autofill/core/browser/ml_model/autofill_ml_prediction_model_handler.h"
#endif
namespace autofill {
namespace {
_;
AtLeast;
ElementsAre;
Eq;
Field;
Invoke;
NiceMock;
Pair;
Property;
Ref;
Return;
UnorderedElementsAreArray;
VariantWith;
FieldTypeSource;
class MockAutofillDriver : public TestAutofillDriver { … };
#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
class MockAutofillMlPredictionModelHandler
: public AutofillMlPredictionModelHandler { … };
#endif
std::vector<FormData> CreateTestForms(size_t num_forms) { … }
std::vector<FormGlobalId> GetFormIds(const std::vector<FormData>& forms) { … }
auto HaveSameFormIdAs(const FormData& form) { … }
auto HaveSameFormIdsAs(const std::vector<FormData>& forms) { … }
void OnFormsSeenWithExpectations(MockAutofillManager& manager,
const std::vector<FormData>& updated_forms,
const std::vector<FormGlobalId>& removed_forms,
const std::vector<FormData>& expectation) { … }
}
class AutofillManagerTest : public testing::Test { … };
class AutofillManagerTest_WithIntParam
: public AutofillManagerTest,
public ::testing::WithParamInterface<size_t> { … };
INSTANTIATE_TEST_SUITE_P(…);
class AutofillManagerTest_OnLoadedServerPredictionsObserver
: public AutofillManagerTest { … };
TEST_P(AutofillManagerTest_WithIntParam, CacheBoundFormsSeen) { … }
TEST_F(AutofillManagerTest, RemoveUnseenForms) { … }
TEST_F(AutofillManagerTest, RemoveAllForms) { … }
TEST_F(AutofillManagerTest, RemoveSomeForms) { … }
TEST_F(AutofillManagerTest, UpdateAndRemoveSameForms) { … }
TEST_F(AutofillManagerTest, ObserverReceiveCalls) { … }
TEST_F(AutofillManagerTest, CanShowAutofillUi) { … }
TEST_F(AutofillManagerTest, TriggerFormExtractionInAllFrames) { … }
#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
TEST_F(AutofillManagerTest, GetMlModelPredictionsForForm) { … }
#endif
TEST_F(
AutofillManagerTest_OnLoadedServerPredictionsObserver,
OnFormsSeen_SuccessfulQueryRequest_NotifiesBeforeLoadedServerPredictionsObserver) { … }
TEST_F(
AutofillManagerTest_OnLoadedServerPredictionsObserver,
OnFormsSeen_FailedQueryRequest_NotifiesBothLoadedServerPredictionsObservers) { … }
TEST_F(
AutofillManagerTest_OnLoadedServerPredictionsObserver,
OnLoadedServerPredictions_EmptyQueriedFormSignatures_NotifiesAfterLoadedServerPredictionsObserver) { … }
TEST_F(
AutofillManagerTest_OnLoadedServerPredictionsObserver,
OnLoadedServerPredictions_NonEmptyQueriedFormSignatures_NotifiesAfterLoadedServerPredictionsObserver) { … }
}