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

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

Issue 11348273: [autofill] Fill in values on a successful run of interactive autocomplete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: doc comment Created 8 years, 1 month 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
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 e0c77fe0ab2211367a5f6afee3de511f422de8f0..bd2bded40da44dd115bc02fdc6c296cd953c4c69 100644
--- a/chrome/browser/autofill/form_structure_unittest.cc
+++ b/chrome/browser/autofill/form_structure_unittest.cc
@@ -2063,3 +2063,34 @@ TEST(FormStructureTest, CheckFormSignature) {
std::string("https://login.facebook.com&login_form&email&first")),
form_structure->FormSignature());
}
+
+TEST(FormStructureTest, ToFormData) {
+ FormData form;
+ form.name = ASCIIToUTF16("the-name");
+ form.method = ASCIIToUTF16("POST");
+ form.origin = GURL("http://cool.com");
+ form.action = form.origin.Resolve("/login");
+
+ FormFieldData field;
+ field.label = ASCIIToUTF16("username");
+ field.name = ASCIIToUTF16("username");
+ field.form_control_type = "text";
+ form.fields.push_back(field);
+
+ field.label = ASCIIToUTF16("password");
+ field.name = ASCIIToUTF16("password");
+ field.form_control_type = "password";
+ form.fields.push_back(field);
+
+ field.label = string16();
+ field.name = ASCIIToUTF16("Submit");
+ field.form_control_type = "submit";
+ form.fields.push_back(field);
+
+ EXPECT_EQ(form, FormStructure(form).ToFormData());
+
+ // Currently |FormStructure(form_data)ToFormData().user_submitted| is always
+ // false. This forces a future author that changes this to update this test.
+ form.user_submitted = true;
+ EXPECT_NE(form, FormStructure(form).ToFormData());
+}

Powered by Google App Engine
This is Rietveld 408576698