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

Side by Side Diff: components/autofill/core/browser/autofill_common_test.h

Issue 65953002: [Autofill] Rename autofill_common_test -> autofill_test_utils (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 #include "base/memory/scoped_ptr.h"
9
10 class PrefService;
11
12 namespace content {
13 class BrowserContext;
14 }
15
16 namespace autofill {
17
18 class AutofillProfile;
19 class CreditCard;
20 struct FormData;
21 struct FormFieldData;
22
23 // Common utilities shared amongst Autofill tests.
24 namespace test {
25
26 // Returns a PrefService that can be used for Autofill-related testing in
27 // contexts where the PrefService would otherwise have to be constructed
28 // manually (e.g., in unit tests within Autofill core code). The returned
29 // PrefService has had Autofill preferences registered on its associated
30 // registry.
31 scoped_ptr<PrefService> PrefServiceForTesting();
32
33 // Provides a quick way to populate a FormField with c-strings.
34 void CreateTestFormField(const char* label,
35 const char* name,
36 const char* value,
37 const char* type,
38 FormFieldData* field);
39
40 // Populates |form| with data corresponding to a simple address form.
41 // Note that this actually appends fields to the form data, which can be useful
42 // for building up more complex test forms.
43 void CreateTestAddressFormData(FormData* form);
44
45 // Returns a profile full of dummy info.
46 AutofillProfile GetFullProfile();
47
48 // Returns a profile full of dummy info, different to the above.
49 AutofillProfile GetFullProfile2();
50
51 // Returns a verified profile full of dummy info.
52 AutofillProfile GetVerifiedProfile();
53
54 // Returns a verified profile full of dummy info, different to the above.
55 AutofillProfile GetVerifiedProfile2();
56
57 // Returns a credit card full of dummy info.
58 CreditCard GetCreditCard();
59
60 // Returns a credit card full of dummy info, different to the above.
61 CreditCard GetCreditCard2();
62
63 // Returns a verified credit card full of dummy info.
64 CreditCard GetVerifiedCreditCard();
65
66 // Returns a verified credit card full of dummy info, different to the above.
67 CreditCard GetVerifiedCreditCard2();
68
69 // A unit testing utility that is common to a number of the Autofill unit
70 // tests. |SetProfileInfo| provides a quick way to populate a profile with
71 // c-strings.
72 void SetProfileInfo(AutofillProfile* profile,
73 const char* first_name, const char* middle_name,
74 const char* last_name, const char* email, const char* company,
75 const char* address1, const char* address2, const char* city,
76 const char* state, const char* zipcode, const char* country,
77 const char* phone);
78
79 void SetProfileInfoWithGuid(AutofillProfile* profile,
80 const char* guid, const char* first_name, const char* middle_name,
81 const char* last_name, const char* email, const char* company,
82 const char* address1, const char* address2, const char* city,
83 const char* state, const char* zipcode, const char* country,
84 const char* phone);
85
86 // A unit testing utility that is common to a number of the Autofill unit
87 // tests. |SetCreditCardInfo| provides a quick way to populate a credit card
88 // with c-strings.
89 void SetCreditCardInfo(CreditCard* credit_card,
90 const char* name_on_card, const char* card_number,
91 const char* expiration_month, const char* expiration_year);
92
93 // TODO(isherman): We should do this automatically for all tests, not manually
94 // on a per-test basis: http://crbug.com/57221
95 // Disables or mocks out code that would otherwise reach out to system services.
96 void DisableSystemServices(content::BrowserContext* browser_context);
97
98 } // namespace test
99 } // namespace autofill
100
101 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698