1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_TEST_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_TEST_H_ 7 #pragma once 8 9 class AutofillProfile; 10 class CreditCard; 11 class Profile; 12 13 namespace webkit_glue { 14 struct FormField; 15 } // namespace webkit_glue 16 17 // Common utilities shared amongst Autofill tests. 18 namespace autofill_test { 19 20 // Provides a quick way to populate a FormField with c-strings. 21 void CreateTestFormField(const char* label, 22 const char* name, 23 const char* value, 24 const char* type, 25 webkit_glue::FormField* field); 26 27 // A unit testing utility that is common to a number of the Autofill unit 28 // tests. |SetProfileInfo| provides a quick way to populate a profile with 29 // c-strings. 30 void SetProfileInfo(AutofillProfile* profile, 31 const char* first_name, const char* middle_name, 32 const char* last_name, const char* email, const char* company, 33 const char* address1, const char* address2, const char* city, 34 const char* state, const char* zipcode, const char* country, 35 const char* phone, const char* fax); 36 37 void SetProfileInfoWithGuid(AutofillProfile* profile, 38 const char* guid, const char* first_name, const char* middle_name, 39 const char* last_name, const char* email, const char* company, 40 const char* address1, const char* address2, const char* city, 41 const char* state, const char* zipcode, const char* country, 42 const char* phone, const char* fax); 43 44 // A unit testing utility that is common to a number of the Autofill unit 45 // tests. |SetCreditCardInfo| provides a quick way to populate a credit card 46 // with c-strings. 47 void SetCreditCardInfo(CreditCard* credit_card, 48 const char* name_on_card, const char* card_number, 49 const char* expiration_month, const char* expiration_year); 50 51 // TODO(isherman): We should do this automatically for all tests, not manually 52 // on a per-test basis: http://crbug.com/57221 53 // Disables or mocks out code that would otherwise reach out to system services. 54 void DisableSystemServices(Profile* profile); 55 56 } // namespace autofill_test 57 58 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_TEST_H_ 59