| 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 <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "components/autofill/core/browser/field_types.h" | 11 #include "components/autofill/core/browser/field_types.h" |
| 12 #include "components/autofill/core/browser/proto/server.pb.h" | 12 #include "components/autofill/core/browser/proto/server.pb.h" |
| 13 | 13 |
| 14 class PrefService; | 14 class PrefService; |
| 15 | 15 |
| 16 namespace autofill { | 16 namespace autofill { |
| 17 | 17 |
| 18 class AutofillProfile; | 18 class AutofillProfile; |
| 19 class AutofillTable; | 19 class AutofillTable; |
| 20 class CreditCard; | 20 class CreditCard; |
| 21 struct FormData; | 21 struct FormData; |
| 22 struct FormFieldData; | 22 struct FormFieldData; |
| 23 | 23 |
| 24 // Common utilities shared amongst Autofill tests. | 24 // Common utilities shared amongst Autofill tests. |
| 25 namespace test { | 25 namespace test { |
| 26 | 26 |
| 27 // Returns a PrefService that can be used for Autofill-related testing in | 27 // Returns a PrefService that can be used for Autofill-related testing in |
| 28 // contexts where the PrefService would otherwise have to be constructed | 28 // contexts where the PrefService would otherwise have to be constructed |
| 29 // manually (e.g., in unit tests within Autofill core code). The returned | 29 // manually (e.g., in unit tests within Autofill core code). The returned |
| 30 // PrefService has had Autofill preferences registered on its associated | 30 // PrefService has had Autofill preferences registered on its associated |
| 31 // registry. | 31 // registry. |
| 32 scoped_ptr<PrefService> PrefServiceForTesting(); | 32 std::unique_ptr<PrefService> PrefServiceForTesting(); |
| 33 | 33 |
| 34 // Provides a quick way to populate a FormField with c-strings. | 34 // Provides a quick way to populate a FormField with c-strings. |
| 35 void CreateTestFormField(const char* label, | 35 void CreateTestFormField(const char* label, |
| 36 const char* name, | 36 const char* name, |
| 37 const char* value, | 37 const char* value, |
| 38 const char* type, | 38 const char* type, |
| 39 FormFieldData* field); | 39 FormFieldData* field); |
| 40 | 40 |
| 41 // Populates |form| with data corresponding to a simple address form. | 41 // Populates |form| with data corresponding to a simple address form. |
| 42 // Note that this actually appends fields to the form data, which can be useful | 42 // Note that this actually appends fields to the form data, which can be useful |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 void FillQueryField(AutofillQueryContents::Form::Field* field, | 125 void FillQueryField(AutofillQueryContents::Form::Field* field, |
| 126 unsigned signature, | 126 unsigned signature, |
| 127 const char* name, | 127 const char* name, |
| 128 const char* control_type, | 128 const char* control_type, |
| 129 const char* label); | 129 const char* label); |
| 130 | 130 |
| 131 } // namespace test | 131 } // namespace test |
| 132 } // namespace autofill | 132 } // namespace autofill |
| 133 | 133 |
| 134 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ | 134 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_TEST_UTILS_H_ |
| OLD | NEW |