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

Unified Diff: components/autofill/core/browser/autofill_common_test.cc

Issue 17572015: Begin abstracting sending of IPC from autofill core code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review, add tests Created 7 years, 6 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
Index: components/autofill/core/browser/autofill_common_test.cc
diff --git a/components/autofill/core/browser/autofill_common_test.cc b/components/autofill/core/browser/autofill_common_test.cc
index 3313c2360b40ca575f025fad970b61354b8005c0..2e668c67c29f87a2f1ad22ee3daea1a1528bb03a 100644
--- a/components/autofill/core/browser/autofill_common_test.cc
+++ b/components/autofill/core/browser/autofill_common_test.cc
@@ -10,6 +10,7 @@
#include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/credit_card.h"
#include "components/autofill/core/common/autofill_pref_names.h"
+#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/user_prefs/user_prefs.h"
#include "components/webdata/encryptor/encryptor.h"
@@ -35,6 +36,41 @@ void CreateTestFormField(const char* label,
field->form_control_type = type;
}
+// Populates |form| with data corresponding to a simple address form.
+// Note that this actually appends fields to the form data, which can be useful
+// for building up more complex test forms.
Ilya Sherman 2013/06/26 22:54:58 nit: This comment is duplicated from the header.
blundell 2013/06/27 21:58:27 Done.
+void CreateTestAddressFormData(FormData* form) {
+ form->name = ASCIIToUTF16("MyForm");
+ form->method = ASCIIToUTF16("POST");
+ form->origin = GURL("http://myform.com/form.html");
+ form->action = GURL("http://myform.com/submit.html");
+ form->user_submitted = true;
+
+ FormFieldData field;
+ test::CreateTestFormField("First Name", "firstname", "", "text", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("Middle Name", "middlename", "", "text", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("Last Name", "lastname", "", "text", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("Address Line 1", "addr1", "", "text", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("Address Line 2", "addr2", "", "text", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("City", "city", "", "text", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("State", "state", "", "text", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("Postal Code", "zipcode", "", "text", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("Country", "country", "", "text", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("Phone Number", "phonenumber", "", "tel", &field);
+ form->fields.push_back(field);
+ test::CreateTestFormField("Email", "email", "", "email", &field);
+ form->fields.push_back(field);
+}
+
inline void check_and_set(
FormGroup* profile, AutofillFieldType type, const char* value) {
if (value)

Powered by Google App Engine
This is Rietveld 408576698