Index: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc |
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc |
index 9b12b4010755717e668ca5c7247aad276f05e364..293f8e9bf10d57ea398b9b1fa2e599dea52ddccb 100644 |
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc |
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc |
@@ -12,6 +12,7 @@ |
#include "chrome/test/base/testing_profile.h" |
#include "components/autofill/browser/autofill_common_test.h" |
#include "components/autofill/browser/autofill_metrics.h" |
+#include "components/autofill/browser/wallet/full_wallet.h" |
#include "components/autofill/browser/wallet/instrument.h" |
#include "components/autofill/browser/wallet/wallet_address.h" |
#include "components/autofill/browser/wallet/wallet_client.h" |
@@ -93,6 +94,11 @@ class TestWalletClient : public wallet::WalletClient { |
const std::string& google_transaction_id, |
const GURL& source_url)); |
+ MOCK_METHOD3(AuthenticateInstrument, |
+ void(const std::string& instrument_id, |
+ const std::string& card_verification_number, |
+ const std::string& obfuscated_gaia_id)); |
+ |
MOCK_METHOD1(GetFullWallet, |
void(const wallet::WalletClient::FullWalletRequest& request)); |
@@ -342,7 +348,7 @@ TEST_F(AutofillDialogControllerTest, AcceptLegalDocuments) { |
wallet_items->AddInstrument(wallet::GetTestMaskedInstrument()); |
wallet_items->AddAddress(wallet::GetTestShippingAddress()); |
controller()->OnDidGetWalletItems(wallet_items.Pass()); |
- controller()->OnSubmit(); |
+ controller()->OnAccept(); |
} |
TEST_F(AutofillDialogControllerTest, SaveAddress) { |
@@ -355,7 +361,7 @@ TEST_F(AutofillDialogControllerTest, SaveAddress) { |
scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems(); |
wallet_items->AddInstrument(wallet::GetTestMaskedInstrument()); |
controller()->OnDidGetWalletItems(wallet_items.Pass()); |
- controller()->OnSubmit(); |
+ controller()->OnAccept(); |
} |
TEST_F(AutofillDialogControllerTest, SaveInstrument) { |
@@ -368,7 +374,7 @@ TEST_F(AutofillDialogControllerTest, SaveInstrument) { |
scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems(); |
wallet_items->AddAddress(wallet::GetTestShippingAddress()); |
controller()->OnDidGetWalletItems(wallet_items.Pass()); |
- controller()->OnSubmit(); |
+ controller()->OnAccept(); |
} |
TEST_F(AutofillDialogControllerTest, SaveInstrumentAndAddress) { |
@@ -379,7 +385,7 @@ TEST_F(AutofillDialogControllerTest, SaveInstrumentAndAddress) { |
SaveInstrumentAndAddress(_, _, _, _)).Times(1); |
controller()->OnDidGetWalletItems(wallet::GetTestWalletItems()); |
- controller()->OnSubmit(); |
+ controller()->OnAccept(); |
} |
TEST_F(AutofillDialogControllerTest, Cancel) { |
@@ -391,4 +397,34 @@ TEST_F(AutofillDialogControllerTest, Cancel) { |
controller()->OnCancel(); |
} |
+TEST_F(AutofillDialogControllerTest, VerifyCvv) { |
+ controller()->set_is_paying_with_wallet(true); |
+ |
+ EXPECT_CALL(*controller()->GetView(), ModelChanged()).Times(2); |
+ EXPECT_CALL(*controller()->GetTestingWalletClient(), |
+ GetFullWallet(_)).Times(1); |
+ EXPECT_CALL(*controller()->GetTestingWalletClient(), |
+ AuthenticateInstrument(_, _, _)).Times(1); |
+ |
+ scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems(); |
+ wallet_items->AddInstrument(wallet::GetTestMaskedInstrument()); |
+ wallet_items->AddAddress(wallet::GetTestShippingAddress()); |
+ controller()->OnDidGetWalletItems(wallet_items.Pass()); |
+ controller()->OnAccept(); |
+ |
+ scoped_ptr<base::ListValue> list(new base::ListValue()); |
+ list->AppendString("verify_cvv"); |
+ |
+ base::DictionaryValue dict; |
+ dict.Set("required_action", list.release()); |
+ |
+ controller()->OnDidGetFullWallet(wallet::FullWallet::CreateFullWallet(dict)); |
+ EXPECT_TRUE(controller()->IsSubmitPausedOn(wallet::VERIFY_CVV)); |
+ EXPECT_FALSE(controller()->SectionIsActive(SECTION_EMAIL)); |
+ EXPECT_FALSE(controller()->SectionIsActive(SECTION_SHIPPING)); |
+ EXPECT_TRUE(controller()->SectionIsActive(SECTION_CC_BILLING)); |
+ |
+ controller()->OnAccept(); |
+} |
+ |
} // namespace autofill |