1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_
14 class AutofillProfile;
19 // Common utilities shared amongst Autofill tests.
22 // Provides a quick way to populate a FormField with c-strings.
23 void CreateTestFormField(const char* label,
27 FormFieldData* field);
29 // Populates |form| with data corresponding to a simple address form.
30 // Note that this actually appends fields to the form data, which can be useful
31 // for building up more complex test forms.
32 void CreateTestAddressFormData(FormData* form);
34 // Returns a profile full of dummy info.
35 AutofillProfile GetFullProfile();
37 // Returns a profile full of dummy info, different to the above.
38 AutofillProfile GetFullProfile2();
40 // Returns a verified profile full of dummy info.
41 AutofillProfile GetVerifiedProfile();
43 // Returns a verified profile full of dummy info, different to the above.
44 AutofillProfile GetVerifiedProfile2();
46 // Returns a credit card full of dummy info.
47 CreditCard GetCreditCard();
49 // Returns a credit card full of dummy info, different to the above.
50 CreditCard GetCreditCard2();
52 // Returns a verified credit card full of dummy info.
53 CreditCard GetVerifiedCreditCard();
55 // Returns a verified credit card full of dummy info, different to the above.
56 CreditCard GetVerifiedCreditCard2();
58 // A unit testing utility that is common to a number of the Autofill unit
59 // tests. |SetProfileInfo| provides a quick way to populate a profile with
61 void SetProfileInfo(AutofillProfile* profile,
62 const char* first_name, const char* middle_name,
63 const char* last_name, const char* email, const char* company,
64 const char* address1, const char* address2, const char* city,
65 const char* state, const char* zipcode, const char* country,
68 void SetProfileInfoWithGuid(AutofillProfile* profile,
69 const char* guid, const char* first_name, const char* middle_name,
70 const char* last_name, const char* email, const char* company,
71 const char* address1, const char* address2, const char* city,
72 const char* state, const char* zipcode, const char* country,
75 // A unit testing utility that is common to a number of the Autofill unit
76 // tests. |SetCreditCardInfo| provides a quick way to populate a credit card
78 void SetCreditCardInfo(CreditCard* credit_card,
79 const char* name_on_card, const char* card_number,
80 const char* expiration_month, const char* expiration_year);
82 // TODO(isherman): We should do this automatically for all tests, not manually
83 // on a per-test basis: http://crbug.com/57221
84 // Disables or mocks out code that would otherwise reach out to system services.
85 void DisableSystemServices(content::BrowserContext* browser_context);
88 } // namespace autofill
90 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_