| 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/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } // anonymous namespace | 348 } // anonymous namespace |
| 349 | 349 |
| 350 namespace autofill { | 350 namespace autofill { |
| 351 namespace wallet { | 351 namespace wallet { |
| 352 | 352 |
| 353 class FullWalletTest : public testing::Test { | 353 class FullWalletTest : public testing::Test { |
| 354 public: | 354 public: |
| 355 FullWalletTest() {} | 355 FullWalletTest() {} |
| 356 protected: | 356 protected: |
| 357 void SetUpDictionary(const std::string& json) { | 357 void SetUpDictionary(const std::string& json) { |
| 358 scoped_ptr<Value> value(base::JSONReader::Read(json)); | 358 scoped_ptr<base::Value> value(base::JSONReader::Read(json)); |
| 359 ASSERT_TRUE(value.get()); | 359 ASSERT_TRUE(value.get()); |
| 360 ASSERT_TRUE(value->IsType(Value::TYPE_DICTIONARY)); | 360 ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); |
| 361 dict.reset(static_cast<DictionaryValue*>(value.release())); | 361 dict.reset(static_cast<base::DictionaryValue*>(value.release())); |
| 362 } | 362 } |
| 363 scoped_ptr<DictionaryValue> dict; | 363 scoped_ptr<base::DictionaryValue> dict; |
| 364 }; | 364 }; |
| 365 | 365 |
| 366 TEST_F(FullWalletTest, CreateFullWalletMissingExpirationMonth) { | 366 TEST_F(FullWalletTest, CreateFullWalletMissingExpirationMonth) { |
| 367 SetUpDictionary(kFullWalletMissingExpirationMonth); | 367 SetUpDictionary(kFullWalletMissingExpirationMonth); |
| 368 EXPECT_EQ(NULL, FullWallet::CreateFullWallet(*dict).get()); | 368 EXPECT_EQ(NULL, FullWallet::CreateFullWallet(*dict).get()); |
| 369 } | 369 } |
| 370 | 370 |
| 371 TEST_F(FullWalletTest, CreateFullWalletMissingExpirationYear) { | 371 TEST_F(FullWalletTest, CreateFullWalletMissingExpirationYear) { |
| 372 SetUpDictionary(kFullWalletMissingExpirationYear); | 372 SetUpDictionary(kFullWalletMissingExpirationYear); |
| 373 EXPECT_EQ(NULL, FullWallet::CreateFullWallet(*dict).get()); | 373 EXPECT_EQ(NULL, FullWallet::CreateFullWallet(*dict).get()); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 full_wallet->GetInfo( | 521 full_wallet->GetInfo( |
| 522 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR))); | 522 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR))); |
| 523 EXPECT_TRUE(GetTestAddress()->EqualsIgnoreID( | 523 EXPECT_TRUE(GetTestAddress()->EqualsIgnoreID( |
| 524 *full_wallet->billing_address())); | 524 *full_wallet->billing_address())); |
| 525 EXPECT_TRUE(GetTestShippingAddress()->EqualsIgnoreID( | 525 EXPECT_TRUE(GetTestShippingAddress()->EqualsIgnoreID( |
| 526 *full_wallet->shipping_address())); | 526 *full_wallet->shipping_address())); |
| 527 } | 527 } |
| 528 | 528 |
| 529 } // namespace wallet | 529 } // namespace wallet |
| 530 } // namespace autofill | 530 } // namespace autofill |
| OLD | NEW |