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

Unified Diff: components/autofill/content/browser/wallet/wallet_client_unittest.cc

Issue 23033016: Remove autocheckout code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
Index: components/autofill/content/browser/wallet/wallet_client_unittest.cc
diff --git a/components/autofill/content/browser/wallet/wallet_client_unittest.cc b/components/autofill/content/browser/wallet/wallet_client_unittest.cc
index 031e5cd958b16f8843d92325c516c1fcae3d743c..69879ead13059a0346b87ccf40e21ad04545637b 100644
--- a/components/autofill/content/browser/wallet/wallet_client_unittest.cc
+++ b/components/autofill/content/browser/wallet/wallet_client_unittest.cc
@@ -13,7 +13,6 @@
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "chrome/test/base/testing_profile.h"
-#include "components/autofill/content/browser/autocheckout_steps.h"
#include "components/autofill/content/browser/wallet/full_wallet.h"
#include "components/autofill/content/browser/wallet/instrument.h"
#include "components/autofill/content/browser/wallet/wallet_client.h"
@@ -21,7 +20,6 @@
#include "components/autofill/content/browser/wallet/wallet_items.h"
#include "components/autofill/content/browser/wallet/wallet_test_util.h"
#include "components/autofill/core/browser/autofill_metrics.h"
-#include "components/autofill/core/common/autocheckout_status.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "net/base/escape.h"
#include "net/base/net_errors.h"
@@ -469,30 +467,6 @@ const char kSaveInstrumentAndAddressValidRequest[] =
"\"use_minimal_addresses\":false"
"}";
-const char kSendAutocheckoutStatusOfSuccessValidRequest[] =
- "{"
- "\"google_transaction_id\":\"google_transaction_id\","
- "\"merchant_domain\":\"https://example.com/\","
- "\"success\":true"
- "}";
-
-const char kSendAutocheckoutStatusWithStatisticsValidRequest[] =
- "{"
- "\"google_transaction_id\":\"google_transaction_id\","
- "\"merchant_domain\":\"https://example.com/\","
- "\"steps\":[{\"step_description\":\"1_AUTOCHECKOUT_STEP_SHIPPING\""
- ",\"time_taken\":100}],"
- "\"success\":true"
- "}";
-
-const char kSendAutocheckoutStatusOfFailureValidRequest[] =
- "{"
- "\"google_transaction_id\":\"google_transaction_id\","
- "\"merchant_domain\":\"https://example.com/\","
- "\"reason\":\"CANNOT_PROCEED\","
- "\"success\":false"
- "}";
-
const char kUpdateAddressValidRequest[] =
"{"
"\"merchant_domain\":\"https://example.com/\","
@@ -825,15 +799,12 @@ class WalletClientTest : public testing::Test {
" }"
"}";
EXPECT_CALL(delegate_, OnWalletError(expected_error_type)).Times(1);
- delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::SEND_STATUS, 1);
+ delegate_.ExpectLogWalletApiCallDuration(
+ AutofillMetrics::GET_WALLET_ITEMS, 1);
delegate_.ExpectBaselineMetrics();
delegate_.ExpectWalletErrorMetric(expected_autofill_metric);
- std::vector<AutocheckoutStatistic> statistics;
- wallet_client_->SendAutocheckoutStatus(autofill::SUCCESS,
- GURL(kMerchantUrl),
- statistics,
- "google_transaction_id");
+ wallet_client_->GetWalletItems(GURL(kMerchantUrl));
std::string buyer_error;
if (!buyer_error_type_string.empty()) {
buyer_error = base::StringPrintf("\"buyer_error_type\":\"%s\",",
@@ -843,7 +814,7 @@ class WalletClientTest : public testing::Test {
error_type_string.c_str(),
buyer_error.c_str());
VerifyAndFinishRequest(net::HTTP_INTERNAL_SERVER_ERROR,
- kSendAutocheckoutStatusOfSuccessValidRequest,
+ kGetWalletItemsValidRequest,
response);
}
@@ -969,36 +940,17 @@ TEST_F(WalletClientTest, WalletErrorCodes) {
TEST_F(WalletClientTest, WalletErrorResponseMissing) {
EXPECT_CALL(delegate_, OnWalletError(
WalletClient::UNKNOWN_ERROR)).Times(1);
- delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::SEND_STATUS, 1);
+ delegate_.ExpectLogWalletApiCallDuration(
+ AutofillMetrics::GET_WALLET_ITEMS, 1);
delegate_.ExpectBaselineMetrics();
delegate_.ExpectWalletErrorMetric(AutofillMetrics::WALLET_UNKNOWN_ERROR);
- std::vector<AutocheckoutStatistic> statistics;
- wallet_client_->SendAutocheckoutStatus(autofill::SUCCESS,
- GURL(kMerchantUrl),
- statistics,
- "google_transaction_id");
+ wallet_client_->GetWalletItems(GURL(kMerchantUrl));
VerifyAndFinishRequest(net::HTTP_INTERNAL_SERVER_ERROR,
- kSendAutocheckoutStatusOfSuccessValidRequest,
+ kGetWalletItemsValidRequest,
kErrorTypeMissingInResponse);
}
-TEST_F(WalletClientTest, NetworkFailureOnExpectedVoidResponse) {
- EXPECT_CALL(delegate_, OnWalletError(WalletClient::NETWORK_ERROR)).Times(1);
- delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::SEND_STATUS, 1);
- delegate_.ExpectBaselineMetrics();
- delegate_.ExpectWalletErrorMetric(AutofillMetrics::WALLET_NETWORK_ERROR);
-
- std::vector<AutocheckoutStatistic> statistics;
- wallet_client_->SendAutocheckoutStatus(autofill::SUCCESS,
- GURL(kMerchantUrl),
- statistics,
- "google_transaction_id");
- VerifyAndFinishRequest(net::HTTP_UNAUTHORIZED,
- kSendAutocheckoutStatusOfSuccessValidRequest,
- std::string());
-}
-
TEST_F(WalletClientTest, NetworkFailureOnExpectedResponse) {
EXPECT_CALL(delegate_, OnWalletError(WalletClient::NETWORK_ERROR)).Times(1);
delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::GET_WALLET_ITEMS,
@@ -1014,17 +966,14 @@ TEST_F(WalletClientTest, NetworkFailureOnExpectedResponse) {
TEST_F(WalletClientTest, RequestError) {
EXPECT_CALL(delegate_, OnWalletError(WalletClient::BAD_REQUEST)).Times(1);
- delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::SEND_STATUS, 1);
+ delegate_.ExpectLogWalletApiCallDuration(
+ AutofillMetrics::GET_WALLET_ITEMS, 1);
delegate_.ExpectBaselineMetrics();
delegate_.ExpectWalletErrorMetric(AutofillMetrics::WALLET_BAD_REQUEST);
- std::vector<AutocheckoutStatistic> statistics;
- wallet_client_->SendAutocheckoutStatus(autofill::SUCCESS,
- GURL(kMerchantUrl),
- statistics,
- "google_transaction_id");
+ wallet_client_->GetWalletItems(GURL(kMerchantUrl));
VerifyAndFinishRequest(net::HTTP_BAD_REQUEST,
- kSendAutocheckoutStatusOfSuccessValidRequest,
+ kGetWalletItemsValidRequest,
std::string());
}
@@ -1662,39 +1611,6 @@ TEST_F(WalletClientTest, UpdateInstrumentMalformedResponse) {
kUpdateMalformedResponse);
}
-TEST_F(WalletClientTest, SendAutocheckoutOfStatusSuccess) {
- delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::SEND_STATUS, 1);
- delegate_.ExpectBaselineMetrics();
-
- AutocheckoutStatistic statistic;
- statistic.page_number = 1;
- statistic.steps.push_back(AUTOCHECKOUT_STEP_SHIPPING);
- statistic.time_taken = base::TimeDelta::FromMilliseconds(100);
- std::vector<AutocheckoutStatistic> statistics;
- statistics.push_back(statistic);
- wallet_client_->SendAutocheckoutStatus(autofill::SUCCESS,
- GURL(kMerchantUrl),
- statistics,
- "google_transaction_id");
- VerifyAndFinishRequest(net::HTTP_OK,
- kSendAutocheckoutStatusWithStatisticsValidRequest,
- ")]}"); // Invalid JSON. Should be ignored.
-}
-
-TEST_F(WalletClientTest, SendAutocheckoutStatusOfFailure) {
- delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::SEND_STATUS, 1);
- delegate_.ExpectBaselineMetrics();
-
- std::vector<AutocheckoutStatistic> statistics;
- wallet_client_->SendAutocheckoutStatus(autofill::CANNOT_PROCEED,
- GURL(kMerchantUrl),
- statistics,
- "google_transaction_id");
- VerifyAndFinishRequest(net::HTTP_OK,
- kSendAutocheckoutStatusOfFailureValidRequest,
- ")]}"); // Invalid JSON. Should be ignored.
-}
-
TEST_F(WalletClientTest, HasRequestInProgress) {
EXPECT_FALSE(wallet_client_->HasRequestInProgress());
delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::GET_WALLET_ITEMS,

Powered by Google App Engine
This is Rietveld 408576698