| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "components/autofill/core/browser/field_types.h" | 12 #include "components/autofill/core/browser/field_types.h" |
| 13 #include "components/autofill/core/browser/proto/server.pb.h" | 13 #include "components/autofill/core/browser/proto/server.pb.h" |
| 14 | 14 |
| 15 class PrefService; | 15 class PrefService; |
| 16 | 16 |
| 17 namespace user_prefs { |
| 18 class PrefRegistrySyncable; |
| 19 } // namespace user_prefs |
| 20 |
| 17 namespace autofill { | 21 namespace autofill { |
| 18 | 22 |
| 19 class AutofillProfile; | 23 class AutofillProfile; |
| 20 class AutofillTable; | 24 class AutofillTable; |
| 21 class CreditCard; | 25 class CreditCard; |
| 22 struct FormData; | 26 struct FormData; |
| 23 struct FormFieldData; | 27 struct FormFieldData; |
| 24 | 28 |
| 25 // Common utilities shared amongst Autofill tests. | 29 // Common utilities shared amongst Autofill tests. |
| 26 namespace test { | 30 namespace test { |
| 27 | 31 |
| 28 // Returns a PrefService that can be used for Autofill-related testing in | 32 // The following methods return a PrefService that can be used for |
| 29 // contexts where the PrefService would otherwise have to be constructed | 33 // Autofill-related testing in contexts where the PrefService would otherwise |
| 30 // manually (e.g., in unit tests within Autofill core code). The returned | 34 // have to be constructed manually (e.g., in unit tests within Autofill core |
| 31 // PrefService has had Autofill preferences registered on its associated | 35 // code). The returned PrefService has had Autofill preferences registered on |
| 32 // registry. | 36 // its associated registry. |
| 33 std::unique_ptr<PrefService> PrefServiceForTesting(); | 37 std::unique_ptr<PrefService> PrefServiceForTesting(); |
| 38 std::unique_ptr<PrefService> PrefServiceForTesting( |
| 39 user_prefs::PrefRegistrySyncable* registry); |
| 34 | 40 |
| 35 // Provides a quick way to populate a FormField with c-strings. | 41 // Provides a quick way to populate a FormField with c-strings. |
| 36 void CreateTestFormField(const char* label, | 42 void CreateTestFormField(const char* label, |
| 37 const char* name, | 43 const char* name, |
| 38 const char* value, | 44 const char* value, |
| 39 const char* type, | 45 const char* type, |
| 40 FormFieldData* field); | 46 FormFieldData* field); |
| 41 | 47 |
| 42 // Provides a quick way to populate a select field. | 48 // Provides a quick way to populate a select field. |
| 43 void CreateTestSelectField(const char* label, | 49 void CreateTestSelectField(const char* label, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // be set at all, as opposed to being set to empty string. | 155 // be set at all, as opposed to being set to empty string. |
| 150 void FillQueryField(AutofillQueryContents::Form::Field* field, | 156 void FillQueryField(AutofillQueryContents::Form::Field* field, |
| 151 unsigned signature, | 157 unsigned signature, |
| 152 const char* name, | 158 const char* name, |
| 153 const char* control_type); | 159 const char* control_type); |
| 154 | 160 |
| 155 } // namespace test | 161 } // namespace test |
| 156 } // namespace autofill | 162 } // namespace autofill |
| 157 | 163 |
| 158 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ | 164 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ |
| OLD | NEW |