Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: chrome/browser/autofill/form_structure_unittest.cc

Issue 11539003: Pop up requestAutocomplete UI when autofill server hints chrome client that it is in a multipage au… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Resolve with AutofillDialogController refactoring. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/form_structure.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« no previous file with comments | « chrome/browser/autofill/form_structure.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698