data_model_wrapper_unittest.cc revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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 3// found in the LICENSE file. 4 5#include "base/memory/scoped_ptr.h" 6#include "base/string_number_conversions.h" 7#include "chrome/browser/ui/autofill/autofill_dialog_models.h" 8#include "chrome/browser/ui/autofill/data_model_wrapper.h" 9#include "components/autofill/browser/credit_card.h" 10#include "components/autofill/browser/field_types.h" 11#include "components/autofill/browser/wallet/wallet_items.h" 12#include "components/autofill/browser/wallet/wallet_test_util.h" 13#include "testing/gtest/include/gtest/gtest.h" 14 15namespace autofill { 16 17TEST(AutofillCreditCardWrapperTest, GetInfoCreditCardExpMonth) { 18 CreditCard card; 19 MonthComboboxModel model; 20 for (int month = 1; month <= 12; ++month) { 21 card.SetRawInfo(CREDIT_CARD_EXP_MONTH, base::IntToString16(month)); 22 AutofillCreditCardWrapper wrapper(&card); 23 EXPECT_EQ(model.GetItemAt(month), wrapper.GetInfo(CREDIT_CARD_EXP_MONTH)); 24 } 25} 26 27TEST(WalletInstrumentWrapperTest, GetInfoCreditCardExpMonth) { 28 scoped_ptr<wallet::WalletItems::MaskedInstrument> instrument( 29 wallet::GetTestMaskedInstrument()); 30 MonthComboboxModel model; 31 for (int month = 1; month <= 12; ++month) { 32 instrument->expiration_month_ = month; 33 WalletInstrumentWrapper wrapper(instrument.get()); 34 EXPECT_EQ(model.GetItemAt(month), wrapper.GetInfo(CREDIT_CARD_EXP_MONTH)); 35 } 36} 37 38} // autofill 39