- add sources.
[platform/framework/web/crosswalk.git] / src / components / autofill / core / browser / autofill_common_test.h
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.
4
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_
7
8 namespace content {
9 class BrowserContext;
10 }
11
12 namespace autofill {
13
14 class AutofillProfile;
15 class CreditCard;
16 struct FormData;
17 struct FormFieldData;
18
19 // Common utilities shared amongst Autofill tests.
20 namespace test {
21
22 // Provides a quick way to populate a FormField with c-strings.
23 void CreateTestFormField(const char* label,
24                          const char* name,
25                          const char* value,
26                          const char* type,
27                          FormFieldData* field);
28
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);
33
34 // Returns a profile full of dummy info.
35 AutofillProfile GetFullProfile();
36
37 // Returns a profile full of dummy info, different to the above.
38 AutofillProfile GetFullProfile2();
39
40 // Returns a verified profile full of dummy info.
41 AutofillProfile GetVerifiedProfile();
42
43 // Returns a verified profile full of dummy info, different to the above.
44 AutofillProfile GetVerifiedProfile2();
45
46 // Returns a credit card full of dummy info.
47 CreditCard GetCreditCard();
48
49 // Returns a credit card full of dummy info, different to the above.
50 CreditCard GetCreditCard2();
51
52 // Returns a verified credit card full of dummy info.
53 CreditCard GetVerifiedCreditCard();
54
55 // Returns a verified credit card full of dummy info, different to the above.
56 CreditCard GetVerifiedCreditCard2();
57
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
60 // c-strings.
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,
66     const char* phone);
67
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,
73     const char* phone);
74
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
77 // with c-strings.
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);
81
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);
86
87 }  // namespace test
88 }  // namespace autofill
89
90 #endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_