Index: components/autofill/core/browser/form_structure_unittest.cc |
diff --git a/components/autofill/core/browser/form_structure_unittest.cc b/components/autofill/core/browser/form_structure_unittest.cc |
index 9d2ccc481b136e02e2ca134a0bfa37799c72c090..8f8f4bd6f8bfa1c98405c2999ac60ad6f171629a 100644 |
--- a/components/autofill/core/browser/form_structure_unittest.cc |
+++ b/components/autofill/core/browser/form_structure_unittest.cc |
@@ -482,6 +482,28 @@ TEST(FormStructureTest, AutocompleteAttributeOverridesOtherHeuristics) { |
EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(0)->heuristic_type()); |
EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(1)->heuristic_type()); |
EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type()); |
+ |
+ // Even with an 'autocomplete' attribute set, ShouldBeCrowdsourced() should |
+ // return true if the structure contains a password field, since there are |
+ // no local heuristics to depend upon in this case. Fields will still not be |
+ // considered autofillable though. |
Ilya Sherman
2014/10/24 01:24:45
Please create a separate TEST() for this case.
Garrett Casto
2014/10/24 21:13:10
Done.
|
+ field.label = ASCIIToUTF16("Password"); |
+ field.name = ASCIIToUTF16("Password"); |
+ field.form_control_type = "password"; |
+ form.fields.push_back(field); |
+ |
+ form_structure.reset(new FormStructure(form)); |
+ form_structure->DetermineHeuristicTypes(TestAutofillMetrics()); |
+ EXPECT_FALSE(form_structure->IsAutofillable()); |
+ EXPECT_TRUE(form_structure->ShouldBeCrowdsourced()); |
+ |
+ ASSERT_EQ(4U, form_structure->field_count()); |
+ ASSERT_EQ(0U, form_structure->autofill_count()); |
+ |
+ EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(0)->heuristic_type()); |
+ EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(1)->heuristic_type()); |
+ EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(2)->heuristic_type()); |
+ EXPECT_EQ(UNKNOWN_TYPE, form_structure->field(3)->heuristic_type()); |
Ilya Sherman
2014/10/24 01:24:45
I'm not convinced that most of these expectations
Garrett Casto
2014/10/24 21:13:10
Do we not want to check that IsAutofillable() retu
Ilya Sherman
2014/10/24 22:42:30
It's not obvious to me why that's relevant to this
|
} |
// Verify that we can correctly process sections listed in the |autocomplete| |