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

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: Even more deletes, and Ilya review. 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 5e230c9321f80ab9c66576c3539b0062fed155bc..b07faced447af8c0df96772737f0dc4a2c4f1f38 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"
@@ -487,30 +485,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/\","
@@ -843,15 +817,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\",",
@@ -861,7 +832,7 @@ class WalletClientTest : public testing::Test {
error_type_string.c_str(),
buyer_error.c_str());
VerifyAndFinishRequest(net::HTTP_INTERNAL_SERVER_ERROR,
- kSendAutocheckoutStatusOfSuccessValidRequest,
+ kGetWalletItemsValidRequest,
response);
}
@@ -987,36 +958,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,
@@ -1032,17 +984,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());
}
@@ -1703,39 +1652,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