Index: chrome/browser/autofill/form_structure_unittest.cc |
diff --git a/chrome/browser/autofill/form_structure_unittest.cc b/chrome/browser/autofill/form_structure_unittest.cc |
index bd2bded40da44dd115bc02fdc6c296cd953c4c69..7ea10122713cea29f20beee12cc7fa0c0c6fc4f3 100644 |
--- a/chrome/browser/autofill/form_structure_unittest.cc |
+++ b/chrome/browser/autofill/form_structure_unittest.cc |
@@ -59,6 +59,13 @@ class FormStructureTest { |
static std::string Hash64Bit(const std::string& str) { |
return FormStructure::Hash64Bit(str); |
} |
+ |
+ static void SetPageDetails(FormStructure* form, |
+ int page_number, |
+ int total_pages) { |
+ form->current_page_number_ = page_number; |
+ form->total_pages_ = total_pages; |
+ } |
}; |
TEST(FormStructureTest, FieldCount) { |
@@ -87,6 +94,41 @@ TEST(FormStructureTest, FieldCount) { |
EXPECT_EQ(3U, form_structure.field_count()); |
} |
+TEST(FormStructureTest, AutofillFlowInfo) { |
+ FormData form; |
+ form.method = ASCIIToUTF16("post"); |
+ |
+ FormFieldData field; |
+ field.label = ASCIIToUTF16("username"); |
+ field.name = ASCIIToUTF16("username"); |
+ field.form_control_type = "text"; |
+ form.fields.push_back(field); |
+ |
+ FormStructure form_structure(form); |
+ EXPECT_FALSE(form_structure.IsStartOfAutofillableFlow()); |
+ EXPECT_FALSE(form_structure.IsInAutofillableFlow()); |
+ |
+ FormStructureTest::SetPageDetails(&form_structure, -1, 0); |
+ EXPECT_FALSE(form_structure.IsStartOfAutofillableFlow()); |
+ EXPECT_FALSE(form_structure.IsInAutofillableFlow()); |
+ |
+ FormStructureTest::SetPageDetails(&form_structure, 0, 0); |
+ EXPECT_FALSE(form_structure.IsStartOfAutofillableFlow()); |
+ EXPECT_FALSE(form_structure.IsInAutofillableFlow()); |
+ |
+ FormStructureTest::SetPageDetails(&form_structure, 0, 1); |
+ EXPECT_TRUE(form_structure.IsStartOfAutofillableFlow()); |
+ EXPECT_TRUE(form_structure.IsInAutofillableFlow()); |
+ |
+ FormStructureTest::SetPageDetails(&form_structure, 1, 2); |
+ EXPECT_FALSE(form_structure.IsStartOfAutofillableFlow()); |
+ EXPECT_TRUE(form_structure.IsInAutofillableFlow()); |
+ |
+ FormStructureTest::SetPageDetails(&form_structure, 2, 2); |
+ EXPECT_FALSE(form_structure.IsStartOfAutofillableFlow()); |
+ EXPECT_FALSE(form_structure.IsInAutofillableFlow()); |
+} |
+ |
TEST(FormStructureTest, AutofillCount) { |
FormData form; |
form.method = ASCIIToUTF16("post"); |