| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 SetUpDictionary(kFullWalletWithRequiredActions); | 395 SetUpDictionary(kFullWalletWithRequiredActions); |
| 396 | 396 |
| 397 std::vector<RequiredAction> required_actions; | 397 std::vector<RequiredAction> required_actions; |
| 398 required_actions.push_back(CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS); | 398 required_actions.push_back(CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS); |
| 399 required_actions.push_back(UPDATE_EXPIRATION_DATE); | 399 required_actions.push_back(UPDATE_EXPIRATION_DATE); |
| 400 required_actions.push_back(VERIFY_CVV); | 400 required_actions.push_back(VERIFY_CVV); |
| 401 required_actions.push_back(REQUIRE_PHONE_NUMBER); | 401 required_actions.push_back(REQUIRE_PHONE_NUMBER); |
| 402 | 402 |
| 403 FullWallet full_wallet(-1, | 403 FullWallet full_wallet(-1, |
| 404 -1, | 404 -1, |
| 405 "", | 405 std::string(), |
| 406 "", | 406 std::string(), |
| 407 scoped_ptr<Address>(), | 407 scoped_ptr<Address>(), |
| 408 scoped_ptr<Address>(), | 408 scoped_ptr<Address>(), |
| 409 required_actions); | 409 required_actions); |
| 410 EXPECT_EQ(full_wallet, *FullWallet::CreateFullWallet(*dict)); | 410 EXPECT_EQ(full_wallet, *FullWallet::CreateFullWallet(*dict)); |
| 411 | 411 |
| 412 ASSERT_FALSE(required_actions.empty()); | 412 ASSERT_FALSE(required_actions.empty()); |
| 413 required_actions.pop_back(); | 413 required_actions.pop_back(); |
| 414 FullWallet different_required_actions( | 414 FullWallet different_required_actions(-1, |
| 415 -1, | 415 -1, |
| 416 -1, | 416 std::string(), |
| 417 "", | 417 std::string(), |
| 418 "", | 418 scoped_ptr<Address>(), |
| 419 scoped_ptr<Address>(), | 419 scoped_ptr<Address>(), |
| 420 scoped_ptr<Address>(), | 420 required_actions); |
| 421 required_actions); | |
| 422 EXPECT_NE(full_wallet, different_required_actions); | 421 EXPECT_NE(full_wallet, different_required_actions); |
| 423 } | 422 } |
| 424 | 423 |
| 425 TEST_F(FullWalletTest, CreateFullWalletWithInvalidRequiredActions) { | 424 TEST_F(FullWalletTest, CreateFullWalletWithInvalidRequiredActions) { |
| 426 SetUpDictionary(kFullWalletWithInvalidRequiredActions); | 425 SetUpDictionary(kFullWalletWithInvalidRequiredActions); |
| 427 EXPECT_EQ(NULL, FullWallet::CreateFullWallet(*dict).get()); | 426 EXPECT_EQ(NULL, FullWallet::CreateFullWallet(*dict).get()); |
| 428 } | 427 } |
| 429 | 428 |
| 430 TEST_F(FullWalletTest, CreateFullWallet) { | 429 TEST_F(FullWalletTest, CreateFullWallet) { |
| 431 SetUpDictionary(kFullWalletValidResponse); | 430 SetUpDictionary(kFullWalletValidResponse); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 EXPECT_TRUE(base::HexStringToBytes("075DA779F98B", &one_time_pad)); | 470 EXPECT_TRUE(base::HexStringToBytes("075DA779F98B", &one_time_pad)); |
| 472 full_wallet.set_one_time_pad(one_time_pad); | 471 full_wallet.set_one_time_pad(one_time_pad); |
| 473 EXPECT_EQ(ASCIIToUTF16("5285127687171393"), | 472 EXPECT_EQ(ASCIIToUTF16("5285127687171393"), |
| 474 full_wallet.GetInfo(CREDIT_CARD_NUMBER)); | 473 full_wallet.GetInfo(CREDIT_CARD_NUMBER)); |
| 475 EXPECT_EQ(ASCIIToUTF16("339"), | 474 EXPECT_EQ(ASCIIToUTF16("339"), |
| 476 full_wallet.GetInfo(CREDIT_CARD_VERIFICATION_CODE)); | 475 full_wallet.GetInfo(CREDIT_CARD_VERIFICATION_CODE)); |
| 477 } | 476 } |
| 478 | 477 |
| 479 } // namespace wallet | 478 } // namespace wallet |
| 480 } // namespace autofill | 479 } // namespace autofill |
| OLD | NEW |