OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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_BROWSER_AUTOFILL_COMMON_TEST_H_ | |
6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COMMON_TEST_H_ | |
7 | |
8 class Profile; | |
9 | |
10 namespace autofill { | |
11 | |
12 class AutofillProfile; | |
13 class CreditCard; | |
14 struct FormFieldData; | |
15 | |
16 // Common utilities shared amongst Autofill tests. | |
17 namespace test { | |
18 | |
19 // Provides a quick way to populate a FormField with c-strings. | |
20 void CreateTestFormField(const char* label, | |
21 const char* name, | |
22 const char* value, | |
23 const char* type, | |
24 FormFieldData* field); | |
25 | |
26 // Returns a profile full of dummy info. | |
27 AutofillProfile GetFullProfile(); | |
28 | |
29 // Returns a profile full of dummy info, different to the above. | |
30 AutofillProfile GetFullProfile2(); | |
31 | |
32 // Returns a verified profile full of dummy info. | |
33 AutofillProfile GetVerifiedProfile(); | |
34 | |
35 // Returns a verified profile full of dummy info, different to the above. | |
36 AutofillProfile GetVerifiedProfile2(); | |
37 | |
38 // Returns a credit card full of dummy info. | |
39 CreditCard GetCreditCard(); | |
40 | |
41 // Returns a verified credit card full of dummy info. | |
42 CreditCard GetVerifiedCreditCard(); | |
43 | |
44 // A unit testing utility that is common to a number of the Autofill unit | |
45 // tests. |SetProfileInfo| provides a quick way to populate a profile with | |
46 // c-strings. | |
47 void SetProfileInfo(AutofillProfile* profile, | |
48 const char* first_name, const char* middle_name, | |
49 const char* last_name, const char* email, const char* company, | |
50 const char* address1, const char* address2, const char* city, | |
51 const char* state, const char* zipcode, const char* country, | |
52 const char* phone); | |
53 | |
54 void SetProfileInfoWithGuid(AutofillProfile* profile, | |
55 const char* guid, const char* first_name, const char* middle_name, | |
56 const char* last_name, const char* email, const char* company, | |
57 const char* address1, const char* address2, const char* city, | |
58 const char* state, const char* zipcode, const char* country, | |
59 const char* phone); | |
60 | |
61 // A unit testing utility that is common to a number of the Autofill unit | |
62 // tests. |SetCreditCardInfo| provides a quick way to populate a credit card | |
63 // with c-strings. | |
64 void SetCreditCardInfo(CreditCard* credit_card, | |
65 const char* name_on_card, const char* card_number, | |
66 const char* expiration_month, const char* expiration_year); | |
67 | |
68 // TODO(isherman): We should do this automatically for all tests, not manually | |
69 // on a per-test basis: http://crbug.com/57221 | |
70 // Disables or mocks out code that would otherwise reach out to system services. | |
71 void DisableSystemServices(Profile* profile); | |
72 | |
73 } // namespace test | |
74 } // namespace autofill | |
75 | |
76 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOFILL_COMMON_TEST_H_ | |
OLD | NEW |