diff --git a/chrome/renderer/autofill/form_autofill_browsertest.cc b/chrome/renderer/autofill/form_autofill_browsertest.cc index 43b4bbff3a0145..4b2093f7f2ed1f 100644 --- a/chrome/renderer/autofill/form_autofill_browsertest.cc +++ b/chrome/renderer/autofill/form_autofill_browsertest.cc @@ -3592,6 +3592,23 @@ TEST_F(FormAutofillTest, LabelForAttribute) { testing::UnorderedElementsAre(base::Bucket(AssignedLabelSource::kId, 2))); } +// Tests that when a label is assigned to an input, text behind it is considered +// as a fallback. +// The label is assigned to the input without the for-attribute, by declaring it +// it inside the label. +TEST_F(FormAutofillTest, LabelTextBehindInput) { + ExpectLabels(R"( +
+ )", + /*id_attributes=*/{u""}, /*name_attributes=*/{u""}, + /*labels=*/{u"label"}, /*names=*/{u""}, /*values=*/{u""}); +} + TEST_F(FormAutofillTest, LabelsWithSpans) { ExpectJohnSmithLabelsAndIdAttributes( "