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 #include "components/autofill/core/browser/autofill_test_utils.h" | 5 #include "components/autofill/core/browser/autofill_test_utils.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/pref_service_factory.h" | 9 #include "base/prefs/pref_service_factory.h" |
10 #include "base/prefs/testing_pref_store.h" | 10 #include "base/prefs/testing_pref_store.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "components/autofill/core/browser/autofill_manager.h" | 12 #include "components/autofill/core/browser/autofill_manager.h" |
13 #include "components/autofill/core/browser/autofill_profile.h" | 13 #include "components/autofill/core/browser/autofill_profile.h" |
14 #include "components/autofill/core/browser/credit_card.h" | 14 #include "components/autofill/core/browser/credit_card.h" |
15 #include "components/autofill/core/browser/field_types.h" | 15 #include "components/autofill/core/browser/field_types.h" |
16 #include "components/autofill/core/common/autofill_pref_names.h" | 16 #include "components/autofill/core/common/autofill_pref_names.h" |
17 #include "components/autofill/core/common/form_data.h" | 17 #include "components/autofill/core/common/form_data.h" |
18 #include "components/autofill/core/common/form_field_data.h" | 18 #include "components/autofill/core/common/form_field_data.h" |
19 #include "components/user_prefs/pref_registry_syncable.h" | 19 #include "components/user_prefs/pref_registry_syncable.h" |
20 #include "components/user_prefs/user_prefs.h" | 20 #include "components/user_prefs/user_prefs.h" |
21 #include "components/webdata/encryptor/encryptor.h" | 21 #include "components/webdata/encryptor/encryptor.h" |
22 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
23 | 23 |
| 24 using base::ASCIIToUTF16; |
| 25 |
24 namespace autofill { | 26 namespace autofill { |
25 namespace test { | 27 namespace test { |
26 | 28 |
27 namespace { | 29 namespace { |
28 | 30 |
29 const char kSettingsOrigin[] = "Chrome settings"; | 31 const char kSettingsOrigin[] = "Chrome settings"; |
30 | 32 |
31 } // namespace | 33 } // namespace |
32 | 34 |
33 scoped_ptr<PrefService> PrefServiceForTesting() { | 35 scoped_ptr<PrefService> PrefServiceForTesting() { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 form->fields.push_back(field); | 80 form->fields.push_back(field); |
79 test::CreateTestFormField("Phone Number", "phonenumber", "", "tel", &field); | 81 test::CreateTestFormField("Phone Number", "phonenumber", "", "tel", &field); |
80 form->fields.push_back(field); | 82 form->fields.push_back(field); |
81 test::CreateTestFormField("Email", "email", "", "email", &field); | 83 test::CreateTestFormField("Email", "email", "", "email", &field); |
82 form->fields.push_back(field); | 84 form->fields.push_back(field); |
83 } | 85 } |
84 | 86 |
85 inline void check_and_set( | 87 inline void check_and_set( |
86 FormGroup* profile, ServerFieldType type, const char* value) { | 88 FormGroup* profile, ServerFieldType type, const char* value) { |
87 if (value) | 89 if (value) |
88 profile->SetRawInfo(type, UTF8ToUTF16(value)); | 90 profile->SetRawInfo(type, base::UTF8ToUTF16(value)); |
89 } | 91 } |
90 | 92 |
91 AutofillProfile GetFullProfile() { | 93 AutofillProfile GetFullProfile() { |
92 AutofillProfile profile(base::GenerateGUID(), "http://www.example.com/"); | 94 AutofillProfile profile(base::GenerateGUID(), "http://www.example.com/"); |
93 SetProfileInfo(&profile, | 95 SetProfileInfo(&profile, |
94 "John", | 96 "John", |
95 "H.", | 97 "H.", |
96 "Doe", | 98 "Doe", |
97 "johndoe@hades.com", | 99 "johndoe@hades.com", |
98 "Underworld", | 100 "Underworld", |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // Disable auxiliary profiles for unit testing. These reach out to system | 213 // Disable auxiliary profiles for unit testing. These reach out to system |
212 // services on the Mac. | 214 // services on the Mac. |
213 if (browser_context) { | 215 if (browser_context) { |
214 user_prefs::UserPrefs::Get(browser_context)->SetBoolean( | 216 user_prefs::UserPrefs::Get(browser_context)->SetBoolean( |
215 prefs::kAutofillAuxiliaryProfilesEnabled, false); | 217 prefs::kAutofillAuxiliaryProfilesEnabled, false); |
216 } | 218 } |
217 } | 219 } |
218 | 220 |
219 } // namespace test | 221 } // namespace test |
220 } // namespace autofill | 222 } // namespace autofill |
OLD | NEW |