From 8166fb9bab0a8a235adc4045d2fab74ff34d6019 Mon Sep 17 00:00:00 2001 From: "ahutter@chromium.org" Date: Wed, 10 Apr 2013 23:57:00 +0000 Subject: Don't send risk params on GetWalletItems BUG= 229933 Review URL: https://chromiumcodereview.appspot.com/14100007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193507 0039d316-1c4b-4281-b951-d872f2087c98 --- .../autofill/browser/wallet/wallet_client.cc | 17 +------ components/autofill/browser/wallet/wallet_client.h | 6 +-- .../browser/wallet/wallet_client_unittest.cc | 56 ++++------------------ 3 files changed, 13 insertions(+), 66 deletions(-) (limited to 'components/autofill/browser/wallet') diff --git a/components/autofill/browser/wallet/wallet_client.cc b/components/autofill/browser/wallet/wallet_client.cc index a9764bc..7717c27 100644 --- a/components/autofill/browser/wallet/wallet_client.cc +++ b/components/autofill/browser/wallet/wallet_client.cc @@ -326,14 +326,11 @@ void WalletClient::GetFullWallet(const FullWalletRequest& full_wallet_request) { encryption_escrow_client_.EncryptOneTimePad(one_time_pad_); } -void WalletClient::GetWalletItems( - const GURL& source_url, - const std::vector& risk_capabilities) { +void WalletClient::GetWalletItems(const GURL& source_url) { if (HasRequestInProgress()) { pending_requests_.push(base::Bind(&WalletClient::GetWalletItems, base::Unretained(this), - source_url, - risk_capabilities)); + source_url)); return; } @@ -342,19 +339,9 @@ void WalletClient::GetWalletItems( base::DictionaryValue request_dict; request_dict.SetString(kApiKeyKey, google_apis::GetAPIKey()); - request_dict.SetString(kRiskParamsKey, delegate_->GetRiskData()); request_dict.SetString(kMerchantDomainKey, source_url.GetWithEmptyPath().spec()); - scoped_ptr risk_capabilities_list(new base::ListValue()); - for (std::vector::const_iterator it = - risk_capabilities.begin(); - it != risk_capabilities.end(); - ++it) { - risk_capabilities_list->AppendString(RiskCapabilityToString(*it)); - } - request_dict.Set(kRiskCapabilitiesKey, risk_capabilities_list.release()); - std::string post_body; base::JSONWriter::Write(&request_dict, &post_body); diff --git a/components/autofill/browser/wallet/wallet_client.h b/components/autofill/browser/wallet/wallet_client.h index 2bbdca7..31ec90a 100644 --- a/components/autofill/browser/wallet/wallet_client.h +++ b/components/autofill/browser/wallet/wallet_client.h @@ -167,10 +167,8 @@ class WalletClient // GetWalletItems retrieves the user's online wallet. The WalletItems // returned may require additional action such as presenting legal documents - // to the user to be accepted. |risk_capabilities| are the Risk challenges - // supported by the users of WalletClient. - void GetWalletItems(const GURL& source_url, - const std::vector& risk_capabilities); + // to the user to be accepted. + void GetWalletItems(const GURL& source_url); // The GetWalletItems call to the Online Wallet backend may require the user // to accept various legal documents before a FullWallet can be generated. diff --git a/components/autofill/browser/wallet/wallet_client_unittest.cc b/components/autofill/browser/wallet/wallet_client_unittest.cc index 6229847..5d63ba4 100644 --- a/components/autofill/browser/wallet/wallet_client_unittest.cc +++ b/components/autofill/browser/wallet/wallet_client_unittest.cc @@ -335,21 +335,7 @@ const char kGetFullWalletWithRiskCapabilitesValidRequest[] = const char kGetWalletItemsValidRequest[] = "{" - "\"merchant_domain\":\"https://example.com/\"," - "\"risk_params\":\"risky business\"," - "\"supported_risk_challenge\":" - "[" - "]" - "}"; - -const char kGetWalletItemsWithRiskCapabilitiesValidRequest[] = - "{" - "\"merchant_domain\":\"https://example.com/\"," - "\"risk_params\":\"risky business\"," - "\"supported_risk_challenge\":" - "[" - "\"RELOGIN\"" - "]" + "\"merchant_domain\":\"https://example.com/\"" "}"; const char kSaveAddressValidRequest[] = @@ -825,8 +811,7 @@ TEST_F(WalletClientTest, NetworkFailureOnExpectedResponse) { delegate_.ExpectBaselineMetrics(NO_ESCROW_REQUEST, HAS_WALLET_REQUEST); delegate_.ExpectWalletErrorMetric(AutofillMetrics::WALLET_NETWORK_ERROR); - wallet_client_->GetWalletItems(GURL(kMerchantUrl), - std::vector()); + wallet_client_->GetWalletItems(GURL(kMerchantUrl)); net::TestURLFetcher* fetcher = factory_.GetFetcherByID(0); ASSERT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); @@ -1125,8 +1110,7 @@ TEST_F(WalletClientTest, GetWalletItems) { 1); delegate_.ExpectBaselineMetrics(NO_ESCROW_REQUEST, HAS_WALLET_REQUEST); - wallet_client_->GetWalletItems(GURL(kMerchantUrl), - std::vector()); + wallet_client_->GetWalletItems(GURL(kMerchantUrl)); VerifyAndFinishRequest(net::HTTP_OK, kGetWalletItemsValidRequest, @@ -1134,23 +1118,6 @@ TEST_F(WalletClientTest, GetWalletItems) { EXPECT_EQ(1U, delegate_.wallet_items_received()); } -TEST_F(WalletClientTest, GetWalletItemsWithRiskCapabilites) { - delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::GET_WALLET_ITEMS, - 1); - delegate_.ExpectBaselineMetrics(NO_ESCROW_REQUEST, HAS_WALLET_REQUEST); - - std::vector risk_capabilities; - risk_capabilities.push_back(WalletClient::RELOGIN); - - wallet_client_->GetWalletItems(GURL(kMerchantUrl), - risk_capabilities); - - VerifyAndFinishRequest(net::HTTP_OK, - kGetWalletItemsWithRiskCapabilitiesValidRequest, - kGetWalletItemsValidResponse); - EXPECT_EQ(1U, delegate_.wallet_items_received()); -} - TEST_F(WalletClientTest, SaveAddressSucceeded) { EXPECT_CALL(delegate_, OnDidSaveAddress("saved_address_id", @@ -1834,8 +1801,7 @@ TEST_F(WalletClientTest, HasRequestInProgress) { 1); delegate_.ExpectBaselineMetrics(NO_ESCROW_REQUEST, HAS_WALLET_REQUEST); - wallet_client_->GetWalletItems(GURL(kMerchantUrl), - std::vector()); + wallet_client_->GetWalletItems(GURL(kMerchantUrl)); EXPECT_TRUE(wallet_client_->HasRequestInProgress()); VerifyAndFinishRequest(net::HTTP_OK, @@ -1847,15 +1813,13 @@ TEST_F(WalletClientTest, HasRequestInProgress) { TEST_F(WalletClientTest, PendingRequest) { EXPECT_EQ(0U, wallet_client_->pending_requests_.size()); - std::vector risk_capabilities; - // Shouldn't queue the first request. delegate_.ExpectBaselineMetrics(NO_ESCROW_REQUEST, HAS_WALLET_REQUEST); - wallet_client_->GetWalletItems(GURL(kMerchantUrl), risk_capabilities); + wallet_client_->GetWalletItems(GURL(kMerchantUrl)); EXPECT_EQ(0U, wallet_client_->pending_requests_.size()); testing::Mock::VerifyAndClear(delegate_.metric_logger()); - wallet_client_->GetWalletItems(GURL(kMerchantUrl), risk_capabilities); + wallet_client_->GetWalletItems(GURL(kMerchantUrl)); EXPECT_EQ(1U, wallet_client_->pending_requests_.size()); delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::GET_WALLET_ITEMS, @@ -1886,11 +1850,9 @@ TEST_F(WalletClientTest, CancelRequests) { 0); delegate_.ExpectBaselineMetrics(NO_ESCROW_REQUEST, HAS_WALLET_REQUEST); - std::vector risk_capabilities; - - wallet_client_->GetWalletItems(GURL(kMerchantUrl), risk_capabilities); - wallet_client_->GetWalletItems(GURL(kMerchantUrl), risk_capabilities); - wallet_client_->GetWalletItems(GURL(kMerchantUrl), risk_capabilities); + wallet_client_->GetWalletItems(GURL(kMerchantUrl)); + wallet_client_->GetWalletItems(GURL(kMerchantUrl)); + wallet_client_->GetWalletItems(GURL(kMerchantUrl)); EXPECT_EQ(2U, wallet_client_->pending_requests_.size()); wallet_client_->CancelRequests(); -- cgit v1.1