| 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_COMMON_TEST_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 |
| 10 class PrefService; |
| 11 |
| 8 namespace content { | 12 namespace content { |
| 9 class BrowserContext; | 13 class BrowserContext; |
| 10 } | 14 } |
| 11 | 15 |
| 12 namespace autofill { | 16 namespace autofill { |
| 13 | 17 |
| 14 class AutofillProfile; | 18 class AutofillProfile; |
| 15 class CreditCard; | 19 class CreditCard; |
| 16 struct FormData; | 20 struct FormData; |
| 17 struct FormFieldData; | 21 struct FormFieldData; |
| 18 | 22 |
| 19 // Common utilities shared amongst Autofill tests. | 23 // Common utilities shared amongst Autofill tests. |
| 20 namespace test { | 24 namespace test { |
| 21 | 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 |
| 22 // Provides a quick way to populate a FormField with c-strings. | 33 // Provides a quick way to populate a FormField with c-strings. |
| 23 void CreateTestFormField(const char* label, | 34 void CreateTestFormField(const char* label, |
| 24 const char* name, | 35 const char* name, |
| 25 const char* value, | 36 const char* value, |
| 26 const char* type, | 37 const char* type, |
| 27 FormFieldData* field); | 38 FormFieldData* field); |
| 28 | 39 |
| 29 // Populates |form| with data corresponding to a simple address form. | 40 // Populates |form| with data corresponding to a simple address form. |
| 30 // Note that this actually appends fields to the form data, which can be useful | 41 // Note that this actually appends fields to the form data, which can be useful |
| 31 // for building up more complex test forms. | 42 // for building up more complex test forms. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 92 |
| 82 // TODO(isherman): We should do this automatically for all tests, not manually | 93 // TODO(isherman): We should do this automatically for all tests, not manually |
| 83 // on a per-test basis: http://crbug.com/57221 | 94 // on a per-test basis: http://crbug.com/57221 |
| 84 // Disables or mocks out code that would otherwise reach out to system services. | 95 // Disables or mocks out code that would otherwise reach out to system services. |
| 85 void DisableSystemServices(content::BrowserContext* browser_context); | 96 void DisableSystemServices(content::BrowserContext* browser_context); |
| 86 | 97 |
| 87 } // namespace test | 98 } // namespace test |
| 88 } // namespace autofill | 99 } // namespace autofill |
| 89 | 100 |
| 90 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_ | 101 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_COMMON_TEST_H_ |
| OLD | NEW |