| 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_common_test.h" | 5 #include "components/autofill/core/browser/autofill_common_test.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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile.h" | |
| 11 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
| 12 #include "components/autofill/core/browser/credit_card.h" | 11 #include "components/autofill/core/browser/credit_card.h" |
| 13 #include "components/autofill/core/common/autofill_pref_names.h" | 12 #include "components/autofill/core/common/autofill_pref_names.h" |
| 14 #include "components/autofill/core/common/form_field_data.h" | 13 #include "components/autofill/core/common/form_field_data.h" |
| 15 #include "components/user_prefs/user_prefs.h" | 14 #include "components/user_prefs/user_prefs.h" |
| 16 #include "components/webdata/encryptor/encryptor.h" | 15 #include "components/webdata/encryptor/encryptor.h" |
| 16 #include "content/public/browser/browser_context.h" |
| 17 | 17 |
| 18 namespace autofill { | 18 namespace autofill { |
| 19 namespace test { | 19 namespace test { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 const char kSettingsOrigin[] = "Chrome settings"; | 23 const char kSettingsOrigin[] = "Chrome settings"; |
| 24 | 24 |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 void SetCreditCardInfo(CreditCard* credit_card, | 136 void SetCreditCardInfo(CreditCard* credit_card, |
| 137 const char* name_on_card, const char* card_number, | 137 const char* name_on_card, const char* card_number, |
| 138 const char* expiration_month, const char* expiration_year) { | 138 const char* expiration_month, const char* expiration_year) { |
| 139 check_and_set(credit_card, CREDIT_CARD_NAME, name_on_card); | 139 check_and_set(credit_card, CREDIT_CARD_NAME, name_on_card); |
| 140 check_and_set(credit_card, CREDIT_CARD_NUMBER, card_number); | 140 check_and_set(credit_card, CREDIT_CARD_NUMBER, card_number); |
| 141 check_and_set(credit_card, CREDIT_CARD_EXP_MONTH, expiration_month); | 141 check_and_set(credit_card, CREDIT_CARD_EXP_MONTH, expiration_month); |
| 142 check_and_set(credit_card, CREDIT_CARD_EXP_4_DIGIT_YEAR, expiration_year); | 142 check_and_set(credit_card, CREDIT_CARD_EXP_4_DIGIT_YEAR, expiration_year); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void DisableSystemServices(Profile* profile) { | 145 void DisableSystemServices(content::BrowserContext* browser_context) { |
| 146 // Use a mock Keychain rather than the OS one to store credit card data. | 146 // Use a mock Keychain rather than the OS one to store credit card data. |
| 147 #if defined(OS_MACOSX) | 147 #if defined(OS_MACOSX) |
| 148 Encryptor::UseMockKeychain(true); | 148 Encryptor::UseMockKeychain(true); |
| 149 #endif | 149 #endif |
| 150 | 150 |
| 151 // Disable auxiliary profiles for unit testing. These reach out to system | 151 // Disable auxiliary profiles for unit testing. These reach out to system |
| 152 // services on the Mac. | 152 // services on the Mac. |
| 153 if (profile) { | 153 if (browser_context) { |
| 154 user_prefs::UserPrefs::Get(profile)->SetBoolean( | 154 user_prefs::UserPrefs::Get(browser_context)->SetBoolean( |
| 155 prefs::kAutofillAuxiliaryProfilesEnabled, false); | 155 prefs::kAutofillAuxiliaryProfilesEnabled, false); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace test | 159 } // namespace test |
| 160 } // namespace autofill | 160 } // namespace autofill |
| OLD | NEW |