#include <memory>
#include <tuple>
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/test/base/chrome_render_view_test.h"
#include "components/autofill/content/renderer/autofill_agent.h"
#include "components/autofill/content/renderer/autofill_agent_test_api.h"
#include "components/autofill/content/renderer/focus_test_utils.h"
#include "components/autofill/content/renderer/form_autofill_util.h"
#include "components/autofill/content/renderer/form_tracker_test_api.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_test_utils.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_data_test_api.h"
#include "components/autofill/core/common/mojom/autofill_types.mojom-shared.h"
#include "content/public/renderer/render_frame.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/metrics/document_update_reason.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_element.h"
#include "third_party/blink/public/web/web_form_element.h"
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_input_element.h"
#include "third_party/blink/public/web/web_local_frame.h"
WebDocument;
WebElement;
WebFormControlElement;
WebInputElement;
WebString;
namespace autofill {
SubmissionSource;
namespace {
class FakeContentAutofillDriver : public mojom::AutofillDriver { … };
void VerifyReceivedRendererMessages(
const FakeContentAutofillDriver& fake_driver,
const std::string& fname,
const std::string& lname,
bool expect_known_success,
SubmissionSource expect_submission_source) { … }
void VerifyReceivedAddressRendererMessages(
const FakeContentAutofillDriver& fake_driver,
const std::string& address,
bool expect_known_success,
SubmissionSource expect_submission_source) { … }
void VerifyNoSubmitMessagesReceived(
const FakeContentAutofillDriver& fake_driver) { … }
FormData CreateAutofillFormData(blink::WebLocalFrame* main_frame) { … }
std::vector<FormFieldData::FillData> GetFieldsForFilling(
const std::vector<FormData>& forms) { … }
class FormAutocompleteTest : public ChromeRenderViewTest { … };
TEST_F(FormAutocompleteTest, VerifyFocusAndBlurEventsAfterAutofill) { … }
TEST_F(FormAutocompleteTest,
VerifyFocusAndBlurEventsAfterAutofillWithFocusedElement) { … }
TEST_F(FormAutocompleteTest,
VerifyFocusAndBlurEventAfterAutofillWithFocusedElementForSingleElement) { … }
TEST_F(FormAutocompleteTest, VerifyFocusAndBlurEventAfterElementAdded) { … }
TEST_F(FormAutocompleteTest, VerifyFocusAndBlurEventAfterElementRemoved) { … }
TEST_F(FormAutocompleteTest, AcceptDataListSuggestion) { … }
TEST_F(FormAutocompleteTest, SelectControlChanged) { … }
class FormAutocompleteSubmissionTest : public FormAutocompleteTest,
public testing::WithParamInterface<int> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(FormAutocompleteSubmissionTest, NormalFormSubmit) { … }
TEST_P(FormAutocompleteSubmissionTest, SubmitEventPrevented) { … }
TEST_P(FormAutocompleteSubmissionTest, DomMutationAfterAutofill) { … }
TEST_P(FormAutocompleteSubmissionTest, AjaxSucceeded_NoLongerVisible) { … }
TEST_P(FormAutocompleteSubmissionTest,
AjaxSucceeded_NoLongerVisible_DifferentActionsSameData) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_NoLongerVisibleBothNoActions …
#else
#define MAYBE_NoLongerVisibleBothNoActions …
#endif
TEST_P(FormAutocompleteSubmissionTest, MAYBE_NoLongerVisibleBothNoActions) { … }
TEST_P(FormAutocompleteSubmissionTest, AjaxSucceeded_NoLongerVisible_NoAction) { … }
TEST_P(FormAutocompleteSubmissionTest, AjaxSucceeded_StillVisible) { … }
TEST_P(FormAutocompleteSubmissionTest,
AjaxSucceeded_NoFormInteractionInvisible) { … }
TEST_P(FormAutocompleteSubmissionTest, AjaxSucceeded_FilledFormIsInvisible) { … }
TEST_P(FormAutocompleteSubmissionTest, AjaxSucceeded_FilledFormStillVisible) { … }
TEST_P(FormAutocompleteSubmissionTest, AjaxSucceeded_FormlessElements) { … }
TEST_P(FormAutocompleteSubmissionTest, AutoCompleteOffFormSubmit) { … }
TEST_P(FormAutocompleteSubmissionTest, AutoCompleteOffInputSubmit) { … }
TEST_P(FormAutocompleteSubmissionTest, DynamicAutoCompleteOffFormSubmit) { … }
TEST_P(FormAutocompleteSubmissionTest, FormSubmittedByDOMMutationAfterXHR) { … }
TEST_P(FormAutocompleteSubmissionTest, FormSubmittedBySameDocumentNavigation) { … }
TEST_P(FormAutocompleteSubmissionTest, FormSubmittedByProbablyFormSubmitted) { … }
}
}