Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: chrome/browser/autofill/wallet/wallet_items_unittest.cc

Issue 11777007: Adds wallet::RequiredAction for when we start interacting with Online Wallet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ahutter@ review Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/wallet/wallet_items.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/wallet/wallet_items_unittest.cc
diff --git a/chrome/browser/autofill/wallet/wallet_items_unittest.cc b/chrome/browser/autofill/wallet/wallet_items_unittest.cc
index 2c6747f12b314e1358d61bddf0b262abcccd7d61..247b978a44ac5aac7f6ad314f049c6d0b585f6ec 100644
--- a/chrome/browser/autofill/wallet/wallet_items_unittest.cc
+++ b/chrome/browser/autofill/wallet/wallet_items_unittest.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
+#include "chrome/browser/autofill/wallet/required_action.h"
#include "chrome/browser/autofill/wallet/wallet_items.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -213,7 +214,22 @@ const char kWalletItemsWithRequiredActions[] =
" \"google_transaction_id\":\"google_transaction_id\","
" \"required_action\":"
" ["
- " \"required_action\""
+ " \" setup_wallet\","
+ " \"AcCePt_ToS \","
+ " \" \\tGAIA_auth \\n\\r\","
+ " \"INVALID_form_field\""
+ " ]"
+ "}";
+
+const char kWalletItemsWithInvalidRequiredActions[] =
+ "{"
+ " \"google_transaction_id\":\"google_transaction_id\","
+ " \"required_action\":"
+ " ["
+ " \"cvc_risk_CHALLENGE\","
+ " \"UPGRADE_MIN_ADDRESS\","
+ " \"update_EXPIRATION_date\","
+ " \" 忍者の正体 \""
" ]"
"}";
@@ -385,15 +401,31 @@ TEST_F(WalletItemsTest, CreateLegalDocument) {
TEST_F(WalletItemsTest, CreateWalletItemsWithRequiredActions) {
SetUpDictionary(kWalletItemsWithRequiredActions);
- std::vector<std::string> required_actions;
- required_actions.push_back("required_action");
+
+ std::vector<RequiredAction> required_actions;
+ required_actions.push_back(SETUP_WALLET);
+ required_actions.push_back(ACCEPT_TOS);
+ required_actions.push_back(GAIA_AUTH);
+ required_actions.push_back(INVALID_FORM_FIELD);
+
WalletItems expected(required_actions, "google_transaction_id", "", "");
ASSERT_EQ(expected, *WalletItems::CreateWalletItems(*dict));
+
+ DCHECK(!required_actions.empty());
+ required_actions.pop_back();
+ WalletItems different_required_actions(
+ required_actions, "google_transaction_id", "", "");
+ ASSERT_NE(expected, different_required_actions);
+}
+
+TEST_F(WalletItemsTest, CreateWalletItemsWithInvalidRequiredActions) {
+ SetUpDictionary(kWalletItemsWithInvalidRequiredActions);
+ ASSERT_EQ(NULL, WalletItems::CreateWalletItems(*dict).get());
}
TEST_F(WalletItemsTest, CreateWalletItems) {
SetUpDictionary(kWalletItems);
- std::vector<std::string> required_actions;
+ std::vector<RequiredAction> required_actions;
WalletItems expected(required_actions,
"google_transaction_id",
"default_instrument_id",
« no previous file with comments | « chrome/browser/autofill/wallet/wallet_items.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698