OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // A unit testing utility that is common to a number of the Autofill unit | 106 // A unit testing utility that is common to a number of the Autofill unit |
107 // tests. |SetCreditCardInfo| provides a quick way to populate a credit card | 107 // tests. |SetCreditCardInfo| provides a quick way to populate a credit card |
108 // with c-strings. | 108 // with c-strings. |
109 void SetCreditCardInfo(CreditCard* credit_card, | 109 void SetCreditCardInfo(CreditCard* credit_card, |
110 const char* name_on_card, const char* card_number, | 110 const char* name_on_card, const char* card_number, |
111 const char* expiration_month, const char* expiration_year); | 111 const char* expiration_month, const char* expiration_year); |
112 | 112 |
113 // TODO(isherman): We should do this automatically for all tests, not manually | 113 // TODO(isherman): We should do this automatically for all tests, not manually |
114 // on a per-test basis: http://crbug.com/57221 | 114 // on a per-test basis: http://crbug.com/57221 |
115 // Disables or mocks out code that would otherwise reach out to system services. | 115 // Disables or mocks out code that would otherwise reach out to system services. |
| 116 // Revert this configuration with |ReenableSystemServices|. |
116 void DisableSystemServices(PrefService* prefs); | 117 void DisableSystemServices(PrefService* prefs); |
117 | 118 |
| 119 // Undoes the mocking set up by |DisableSystemServices| |
| 120 void ReenableSystemServices(); |
| 121 |
118 // Sets |cards| for |table|. |cards| may contain full, unmasked server cards, | 122 // Sets |cards| for |table|. |cards| may contain full, unmasked server cards, |
119 // whereas AutofillTable::SetServerCreditCards can only contain masked cards. | 123 // whereas AutofillTable::SetServerCreditCards can only contain masked cards. |
120 void SetServerCreditCards(AutofillTable* table, | 124 void SetServerCreditCards(AutofillTable* table, |
121 const std::vector<CreditCard>& cards); | 125 const std::vector<CreditCard>& cards); |
122 | 126 |
123 // Fills the upload |field| with the information passed by parameter. If the | 127 // Fills the upload |field| with the information passed by parameter. If the |
124 // value of a const char* parameter is NULL, the corresponding attribute won't | 128 // value of a const char* parameter is NULL, the corresponding attribute won't |
125 // be set at all, as opposed to being set to empty string. | 129 // be set at all, as opposed to being set to empty string. |
126 void FillUploadField(AutofillUploadContents::Field* field, | 130 void FillUploadField(AutofillUploadContents::Field* field, |
127 unsigned signature, | 131 unsigned signature, |
128 const char* name, | 132 const char* name, |
129 const char* control_type, | 133 const char* control_type, |
130 const char* label, | 134 const char* label, |
131 const char* autocomplete, | 135 const char* autocomplete, |
132 unsigned autofill_type); | 136 unsigned autofill_type); |
133 | 137 |
134 // Fills the query form |field| with the information passed by parameter. If the | 138 // Fills the query form |field| with the information passed by parameter. If the |
135 // value of a const char* parameter is NULL, the corresponding attribute won't | 139 // value of a const char* parameter is NULL, the corresponding attribute won't |
136 // be set at all, as opposed to being set to empty string. | 140 // be set at all, as opposed to being set to empty string. |
137 void FillQueryField(AutofillQueryContents::Form::Field* field, | 141 void FillQueryField(AutofillQueryContents::Form::Field* field, |
138 unsigned signature, | 142 unsigned signature, |
139 const char* name, | 143 const char* name, |
140 const char* control_type, | 144 const char* control_type, |
141 const char* label); | 145 const char* label); |
142 | 146 |
143 } // namespace test | 147 } // namespace test |
144 } // namespace autofill | 148 } // namespace autofill |
145 | 149 |
146 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ | 150 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ |
OLD | NEW |