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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 7 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
8 #include "chrome/browser/ui/autofill/data_model_wrapper.h" | 8 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
| 9 #include "components/autofill/browser/autofill_common_test.h" |
| 10 #include "components/autofill/browser/autofill_profile.h" |
9 #include "components/autofill/browser/credit_card.h" | 11 #include "components/autofill/browser/credit_card.h" |
10 #include "components/autofill/browser/field_types.h" | 12 #include "components/autofill/browser/field_types.h" |
11 #include "components/autofill/browser/wallet/wallet_items.h" | 13 #include "components/autofill/browser/wallet/wallet_items.h" |
12 #include "components/autofill/browser/wallet/wallet_test_util.h" | 14 #include "components/autofill/browser/wallet/wallet_test_util.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
14 | 16 |
15 namespace autofill { | 17 namespace autofill { |
16 | 18 |
17 TEST(AutofillCreditCardWrapperTest, GetInfoCreditCardExpMonth) { | 19 TEST(AutofillCreditCardWrapperTest, GetInfoCreditCardExpMonth) { |
18 CreditCard card; | 20 CreditCard card; |
(...skipping 23 matching lines...) Expand all Loading... |
42 } | 44 } |
43 | 45 |
44 TEST(WalletInstrumentWrapperTest, GetDisplayTextEmptyWhenExpired) { | 46 TEST(WalletInstrumentWrapperTest, GetDisplayTextEmptyWhenExpired) { |
45 scoped_ptr<wallet::WalletItems::MaskedInstrument> instrument( | 47 scoped_ptr<wallet::WalletItems::MaskedInstrument> instrument( |
46 wallet::GetTestMaskedInstrument()); | 48 wallet::GetTestMaskedInstrument()); |
47 instrument->status_ = wallet::WalletItems::MaskedInstrument::EXPIRED; | 49 instrument->status_ = wallet::WalletItems::MaskedInstrument::EXPIRED; |
48 WalletInstrumentWrapper wrapper(instrument.get()); | 50 WalletInstrumentWrapper wrapper(instrument.get()); |
49 EXPECT_TRUE(wrapper.GetDisplayText().empty()); | 51 EXPECT_TRUE(wrapper.GetDisplayText().empty()); |
50 } | 52 } |
51 | 53 |
| 54 TEST(DataModelWrapperTest, GetDisplayTextEmptyWithoutPhone) { |
| 55 scoped_ptr<wallet::WalletItems::MaskedInstrument> instrument( |
| 56 wallet::GetTestMaskedInstrument()); |
| 57 |
| 58 WalletInstrumentWrapper instrument_wrapper(instrument.get()); |
| 59 ASSERT_FALSE(instrument_wrapper.GetDisplayText().empty()); |
| 60 |
| 61 WalletAddressWrapper address_wrapper(&instrument->address()); |
| 62 ASSERT_FALSE(address_wrapper.GetDisplayText().empty()); |
| 63 |
| 64 const_cast<wallet::Address*>(&instrument->address())->set_phone_number( |
| 65 string16()); |
| 66 |
| 67 ASSERT_TRUE(instrument_wrapper.GetInfo(PHONE_HOME_WHOLE_NUMBER).empty()); |
| 68 EXPECT_TRUE(instrument_wrapper.GetDisplayText().empty()); |
| 69 |
| 70 ASSERT_TRUE(address_wrapper.GetInfo(PHONE_HOME_WHOLE_NUMBER).empty()); |
| 71 EXPECT_TRUE(address_wrapper.GetDisplayText().empty()); |
| 72 } |
| 73 |
52 } // autofill | 74 } // autofill |
OLD | NEW |