diff options
author | ahutter@chromium.org <ahutter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-23 02:23:17 +0000 |
---|---|---|
committer | ahutter@chromium.org <ahutter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-23 02:23:17 +0000 |
commit | 6341ebb0cf082de50b1d854bee302f23cfc7e3c0 (patch) | |
tree | df27f03ec2d27b5c1a4c2bc6bfde919b4fa5fa0f /chrome/browser/autofill | |
parent | c7e8befa574673d15e9b615fb8d252aa50d77dad (diff) | |
download | chromium_src-6341ebb0cf082de50b1d854bee302f23cfc7e3c0.zip chromium_src-6341ebb0cf082de50b1d854bee302f23cfc7e3c0.tar.gz chromium_src-6341ebb0cf082de50b1d854bee302f23cfc7e3c0.tar.bz2 |
Adding merchant_domain to all Wallet requests.
In addition, changes DictionaryValues keys to constants and adds missing risk params to UpgradeInstrument calls.
BUG=177486
Review URL: https://chromiumcodereview.appspot.com/12330051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r-- | chrome/browser/autofill/wallet/wallet_client.cc | 143 | ||||
-rw-r--r-- | chrome/browser/autofill/wallet/wallet_client.h | 12 | ||||
-rw-r--r-- | chrome/browser/autofill/wallet/wallet_client_unittest.cc | 58 |
3 files changed, 143 insertions, 70 deletions
diff --git a/chrome/browser/autofill/wallet/wallet_client.cc b/chrome/browser/autofill/wallet/wallet_client.cc index 3e2db7a..49778a3 100644 --- a/chrome/browser/autofill/wallet/wallet_client.cc +++ b/chrome/browser/autofill/wallet/wallet_client.cc @@ -44,6 +44,29 @@ std::string AutocheckoutStatusToString(autofill::AutocheckoutStatus status) { return "NOT_POSSIBLE"; } +// Keys for JSON communication with the Online Wallet server. +const char kAcceptedLegalDocumentKey[] = "accepted_legal_document"; +const char kApiKeyKey[] = "api_key"; +const char kAuthResultKey[] = "auth_result"; +const char kCartKey[] = "cart"; +const char kEncryptedOtpKey[] = "encrypted_otp"; +const char kGoogleTransactionIdKey[] = "google_transaction_id"; +const char kInstrumentIdKey[] = "instrument_id"; +const char kInstrumentKey[] = "instrument"; +const char kInstrumentEscrowHandleKey[] = "instrument_escrow_handle"; +const char kInstrumentPhoneNumberKey[] = "instrument_phone_number"; +const char kMerchantDomainKey[] = "merchant_domain"; +const char kReasonKey[] = "reason"; +const char kRiskParamsKey[] = "risk_params"; +const char kSelectedAddressIdKey[] = "selected_address_id"; +const char kSelectedInstrumentIdKey[] = "selected_instrument_id"; +const char kSessionMaterialKey[] = "session_material"; +const char kShippingAddressIdKey[] = "shipping_address_id"; +const char kShippingAddressKey[] = "shipping_address"; +const char kSuccessKey[] = "success"; +const char kUpgradedBillingAddressKey[] = "upgraded_billing_address"; +const char kUpgradedInstrumentIdKey[] = "upgraded_instrument_id"; + } // namespace namespace autofill { @@ -63,20 +86,23 @@ WalletClient::~WalletClient() {} void WalletClient::AcceptLegalDocuments( const std::vector<std::string>& document_ids, const std::string& google_transaction_id, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer) { DCHECK_EQ(NO_PENDING_REQUEST, request_type_); request_type_ = ACCEPT_LEGAL_DOCUMENTS; base::DictionaryValue request_dict; - request_dict.SetString("api_key", google_apis::GetAPIKey()); - request_dict.SetString("google_transaction_id", google_transaction_id); + request_dict.SetString(kApiKeyKey, google_apis::GetAPIKey()); + request_dict.SetString(kGoogleTransactionIdKey, google_transaction_id); + request_dict.SetString(kMerchantDomainKey, + source_url.GetWithEmptyPath().spec()); ListValue* docs_list = new ListValue(); for (std::vector<std::string>::const_iterator it = document_ids.begin(); it != document_ids.end(); ++it) { docs_list->AppendString(*it); } - request_dict.Set("accepted_legal_document", docs_list); + request_dict.Set(kAcceptedLegalDocumentKey, docs_list); std::string post_body; base::JSONWriter::Write(&request_dict, &post_body); @@ -95,9 +121,9 @@ void WalletClient::AuthenticateInstrument( request_type_ = AUTHENTICATE_INSTRUMENT; observer_ = observer; - pending_request_body_.SetString("api_key", google_apis::GetAPIKey()); - pending_request_body_.SetString("risk_params", GetRiskParams()); - pending_request_body_.SetString("instrument_id", instrument_id); + pending_request_body_.SetString(kApiKeyKey, google_apis::GetAPIKey()); + pending_request_body_.SetString(kRiskParamsKey, GetRiskParams()); + pending_request_body_.SetString(kInstrumentIdKey, instrument_id); encryption_escrow_client_.EscrowCardVerificationNumber( card_verification_number, @@ -107,7 +133,7 @@ void WalletClient::AuthenticateInstrument( void WalletClient::GetFullWallet(const std::string& instrument_id, const std::string& address_id, - const std::string& merchant_domain, + const GURL& source_url, const Cart& cart, const std::string& google_transaction_id, base::WeakPtr<WalletClientObserver> observer) { @@ -117,14 +143,15 @@ void WalletClient::GetFullWallet(const std::string& instrument_id, request_type_ = GET_FULL_WALLET; observer_ = observer; - pending_request_body_.SetString("api_key", google_apis::GetAPIKey()); - pending_request_body_.SetString("risk_params", GetRiskParams()); - pending_request_body_.SetString("selected_instrument_id", instrument_id); - pending_request_body_.SetString("selected_address_id", address_id); - pending_request_body_.SetString("merchant_domain", merchant_domain); - pending_request_body_.SetString("google_transaction_id", + pending_request_body_.SetString(kApiKeyKey, google_apis::GetAPIKey()); + pending_request_body_.SetString(kRiskParamsKey, GetRiskParams()); + pending_request_body_.SetString(kSelectedInstrumentIdKey, instrument_id); + pending_request_body_.SetString(kSelectedAddressIdKey, address_id); + pending_request_body_.SetString(kMerchantDomainKey, + source_url.GetWithEmptyPath().spec()); + pending_request_body_.SetString(kGoogleTransactionIdKey, google_transaction_id); - pending_request_body_.Set("cart", cart.ToDictionary().release()); + pending_request_body_.Set(kCartKey, cart.ToDictionary().release()); crypto::RandBytes(&(one_time_pad_[0]), one_time_pad_.size()); encryption_escrow_client_.EncryptOneTimePad(one_time_pad_, @@ -132,13 +159,16 @@ void WalletClient::GetFullWallet(const std::string& instrument_id, } void WalletClient::GetWalletItems( + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer) { DCHECK_EQ(NO_PENDING_REQUEST, request_type_); request_type_ = GET_WALLET_ITEMS; base::DictionaryValue request_dict; - request_dict.SetString("api_key", google_apis::GetAPIKey()); - request_dict.SetString("risk_params", GetRiskParams()); + request_dict.SetString(kApiKeyKey, google_apis::GetAPIKey()); + request_dict.SetString(kRiskParamsKey, GetRiskParams()); + request_dict.SetString(kMerchantDomainKey, + source_url.GetWithEmptyPath().spec()); std::string post_body; base::JSONWriter::Write(&request_dict, &post_body); @@ -147,15 +177,18 @@ void WalletClient::GetWalletItems( } void WalletClient::SaveAddress(const Address& shipping_address, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer) { DCHECK_EQ(NO_PENDING_REQUEST, request_type_); request_type_ = SAVE_ADDRESS; base::DictionaryValue request_dict; - request_dict.SetString("api_key", google_apis::GetAPIKey()); - request_dict.SetString("risk_params", GetRiskParams()); + request_dict.SetString(kApiKeyKey, google_apis::GetAPIKey()); + request_dict.SetString(kRiskParamsKey, GetRiskParams()); + request_dict.SetString(kMerchantDomainKey, + source_url.GetWithEmptyPath().spec()); - request_dict.Set("shipping_address", + request_dict.Set(kShippingAddressKey, shipping_address.ToDictionaryWithID().release()); std::string post_body; @@ -167,6 +200,7 @@ void WalletClient::SaveAddress(const Address& shipping_address, void WalletClient::SaveInstrument( const Instrument& instrument, const std::string& obfuscated_gaia_id, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer) { DCHECK_EQ(NO_PENDING_REQUEST, request_type_); DCHECK(observer); @@ -174,11 +208,14 @@ void WalletClient::SaveInstrument( request_type_ = SAVE_INSTRUMENT; observer_ = observer; - pending_request_body_.SetString("api_key", google_apis::GetAPIKey()); - pending_request_body_.SetString("risk_params", GetRiskParams()); + pending_request_body_.SetString(kApiKeyKey, google_apis::GetAPIKey()); + pending_request_body_.SetString(kRiskParamsKey, GetRiskParams()); + pending_request_body_.SetString(kMerchantDomainKey, + source_url.GetWithEmptyPath().spec()); - pending_request_body_.Set("instrument", instrument.ToDictionary().release()); - pending_request_body_.SetString("instrument_phone_number", + pending_request_body_.Set(kInstrumentKey, + instrument.ToDictionary().release()); + pending_request_body_.SetString(kInstrumentPhoneNumberKey, instrument.address().phone_number()); encryption_escrow_client_.EscrowInstrumentInformation( @@ -191,6 +228,7 @@ void WalletClient::SaveInstrumentAndAddress( const Instrument& instrument, const Address& address, const std::string& obfuscated_gaia_id, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer) { DCHECK_EQ(NO_PENDING_REQUEST, request_type_); DCHECK(observer); @@ -198,14 +236,17 @@ void WalletClient::SaveInstrumentAndAddress( request_type_ = SAVE_INSTRUMENT_AND_ADDRESS; observer_ = observer; - pending_request_body_.SetString("api_key", google_apis::GetAPIKey()); - pending_request_body_.SetString("risk_params", GetRiskParams()); + pending_request_body_.SetString(kApiKeyKey, google_apis::GetAPIKey()); + pending_request_body_.SetString(kRiskParamsKey, GetRiskParams()); + pending_request_body_.SetString(kMerchantDomainKey, + source_url.GetWithEmptyPath().spec()); - pending_request_body_.Set("instrument", instrument.ToDictionary().release()); - pending_request_body_.SetString("instrument_phone_number", + pending_request_body_.Set(kInstrumentKey, + instrument.ToDictionary().release()); + pending_request_body_.SetString(kInstrumentPhoneNumberKey, instrument.address().phone_number()); - pending_request_body_.Set("shipping_address", + pending_request_body_.Set(kShippingAddressKey, address.ToDictionaryWithID().release()); encryption_escrow_client_.EscrowInstrumentInformation( @@ -216,21 +257,22 @@ void WalletClient::SaveInstrumentAndAddress( void WalletClient::SendAutocheckoutStatus( autofill::AutocheckoutStatus status, - const std::string& merchant_domain, + const GURL& source_url, const std::string& google_transaction_id, base::WeakPtr<WalletClientObserver> observer) { DCHECK_EQ(NO_PENDING_REQUEST, request_type_); request_type_ = SEND_STATUS; base::DictionaryValue request_dict; - request_dict.SetString("api_key", google_apis::GetAPIKey()); + request_dict.SetString(kApiKeyKey, google_apis::GetAPIKey()); bool success = status == autofill::SUCCESS; - request_dict.SetBoolean("success", success); - request_dict.SetString("hostname", merchant_domain); + request_dict.SetBoolean(kSuccessKey, success); + request_dict.SetString(kMerchantDomainKey, + source_url.GetWithEmptyPath().spec()); if (!success) { - request_dict.SetString("reason", AutocheckoutStatusToString(status)); + request_dict.SetString(kReasonKey, AutocheckoutStatusToString(status)); } - request_dict.SetString("google_transaction_id", google_transaction_id); + request_dict.SetString(kGoogleTransactionIdKey, google_transaction_id); std::string post_body; base::JSONWriter::Write(&request_dict, &post_body); @@ -241,16 +283,21 @@ void WalletClient::SendAutocheckoutStatus( void WalletClient::UpdateInstrument( const std::string& instrument_id, const Address& billing_address, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer) { DCHECK_EQ(NO_PENDING_REQUEST, request_type_); request_type_ = UPDATE_INSTRUMENT; base::DictionaryValue request_dict; - request_dict.SetString("api_key", google_apis::GetAPIKey()); - request_dict.SetString("upgraded_instrument_id", instrument_id); - request_dict.SetString("instrument_phone_number", + request_dict.SetString(kApiKeyKey, google_apis::GetAPIKey()); + request_dict.SetString(kRiskParamsKey, GetRiskParams()); + request_dict.SetString(kMerchantDomainKey, + source_url.GetWithEmptyPath().spec()); + + request_dict.SetString(kUpgradedInstrumentIdKey, instrument_id); + request_dict.SetString(kInstrumentPhoneNumberKey, billing_address.phone_number()); - request_dict.Set("upgraded_billing_address", + request_dict.Set(kUpgradedBillingAddressKey, billing_address.ToDictionaryWithoutID().release()); std::string post_body; @@ -344,7 +391,7 @@ void WalletClient::OnURLFetchComplete( case AUTHENTICATE_INSTRUMENT: { std::string auth_result; - if (response_dict->GetString("auth_result", &auth_result)) { + if (response_dict->GetString(kAuthResultKey, &auth_result)) { std::string trimmed; TrimWhitespaceASCII(auth_result, TRIM_ALL, @@ -391,7 +438,7 @@ void WalletClient::OnURLFetchComplete( case SAVE_ADDRESS: { std::string shipping_address_id; - if (response_dict->GetString("shipping_address_id", + if (response_dict->GetString(kShippingAddressIdKey, &shipping_address_id)) { if (observer_) observer_->OnDidSaveAddress(shipping_address_id); @@ -403,7 +450,7 @@ void WalletClient::OnURLFetchComplete( case SAVE_INSTRUMENT: { std::string instrument_id; - if (response_dict->GetString("instrument_id", &instrument_id)) { + if (response_dict->GetString(kInstrumentIdKey, &instrument_id)) { if (observer_) observer_->OnDidSaveInstrument(instrument_id); } else { @@ -414,9 +461,9 @@ void WalletClient::OnURLFetchComplete( case SAVE_INSTRUMENT_AND_ADDRESS: { std::string instrument_id; - response_dict->GetString("instrument_id", &instrument_id); + response_dict->GetString(kInstrumentIdKey, &instrument_id); std::string shipping_address_id; - response_dict->GetString("shipping_address_id", + response_dict->GetString(kShippingAddressIdKey, &shipping_address_id); if (!instrument_id.empty() && !shipping_address_id.empty()) { if (observer_) { @@ -431,7 +478,7 @@ void WalletClient::OnURLFetchComplete( case UPDATE_INSTRUMENT: { std::string instrument_id; - response_dict->GetString("instrument_id", &instrument_id); + response_dict->GetString(kInstrumentIdKey, &instrument_id); if (!instrument_id.empty()) { if (observer_) observer_->OnDidUpdateInstrument(instrument_id); @@ -457,8 +504,8 @@ void WalletClient::OnDidEncryptOneTimePad( const std::string& encrypted_one_time_pad, const std::string& session_material) { DCHECK_EQ(GET_FULL_WALLET, request_type_); - pending_request_body_.SetString("encrypted_otp", encrypted_one_time_pad); - pending_request_body_.SetString("session_material", session_material); + pending_request_body_.SetString(kEncryptedOtpKey, encrypted_one_time_pad); + pending_request_body_.SetString(kSessionMaterialKey, session_material); std::string post_body; base::JSONWriter::Write(&pending_request_body_, &post_body); @@ -472,7 +519,7 @@ void WalletClient::OnDidEscrowInstrumentInformation( DCHECK(request_type_ == SAVE_INSTRUMENT || request_type_ == SAVE_INSTRUMENT_AND_ADDRESS); - pending_request_body_.SetString("instrument_escrow_handle", escrow_handle); + pending_request_body_.SetString(kInstrumentEscrowHandleKey, escrow_handle); std::string post_body; base::JSONWriter::Write(&pending_request_body_, &post_body); @@ -484,7 +531,7 @@ void WalletClient::OnDidEscrowInstrumentInformation( void WalletClient::OnDidEscrowCardVerificationNumber( const std::string& escrow_handle) { DCHECK_EQ(AUTHENTICATE_INSTRUMENT, request_type_); - pending_request_body_.SetString("instrument_escrow_handle", escrow_handle); + pending_request_body_.SetString(kInstrumentEscrowHandleKey, escrow_handle); std::string post_body; base::JSONWriter::Write(&pending_request_body_, &post_body); diff --git a/chrome/browser/autofill/wallet/wallet_client.h b/chrome/browser/autofill/wallet/wallet_client.h index 5272bae..93b3ff8 100644 --- a/chrome/browser/autofill/wallet/wallet_client.h +++ b/chrome/browser/autofill/wallet/wallet_client.h @@ -72,7 +72,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. - void GetWalletItems(base::WeakPtr<WalletClientObserver> observer); + void GetWalletItems(const GURL& source_url, + base::WeakPtr<WalletClientObserver> observer); // The GetWalletItems call to the Online Wallet backend may require the user // to accept various legal documents before a FullWallet can be generated. @@ -80,6 +81,7 @@ class WalletClient // to the GetWalletItems call. void AcceptLegalDocuments(const std::vector<std::string>& document_ids, const std::string& google_transaction_id, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer); // Authenticates that |card_verification_number| is for the backing instrument @@ -98,24 +100,27 @@ class WalletClient // |google_transaction_id| is the same one that GetWalletItems returns. void GetFullWallet(const std::string& instrument_id, const std::string& address_id, - const std::string& merchant_domain, + const GURL& source_url, const Cart& cart, const std::string& google_transaction_id, base::WeakPtr<WalletClientObserver> observer); // SaveAddress saves a new shipping address. void SaveAddress(const Address& address, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer); // SaveInstrument saves a new instrument. void SaveInstrument(const Instrument& instrument, const std::string& obfuscated_gaia_id, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer); // SaveInstrumentAndAddress saves a new instrument and address. void SaveInstrumentAndAddress(const Instrument& instrument, const Address& shipping_address, const std::string& obfuscated_gaia_id, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer); // SendAutocheckoutStatus is used for tracking the success of Autocheckout @@ -123,7 +128,7 @@ class WalletClient // where the purchase occured, and |google_transaction_id| is the same as the // one provided by GetWalletItems. void SendAutocheckoutStatus(autofill::AutocheckoutStatus status, - const std::string& merchant_domain, + const GURL& source_url, const std::string& google_transaction_id, base::WeakPtr<WalletClientObserver> observer); @@ -134,6 +139,7 @@ class WalletClient // fail. void UpdateInstrument(const std::string& instrument_id, const Address& billing_address, + const GURL& source_url, base::WeakPtr<WalletClientObserver> observer); // Whether there is a currently running request (i.e. |request_| != NULL). diff --git a/chrome/browser/autofill/wallet/wallet_client_unittest.cc b/chrome/browser/autofill/wallet/wallet_client_unittest.cc index 99a37b9..68b9687 100644 --- a/chrome/browser/autofill/wallet/wallet_client_unittest.cc +++ b/chrome/browser/autofill/wallet/wallet_client_unittest.cc @@ -31,6 +31,7 @@ namespace { const char kGoogleTransactionId[] = "google-transaction-id"; +const char kMerchantUrl[] = "https://example.com/path?key=value"; const char kGetFullWalletValidResponse[] = "{" @@ -188,7 +189,8 @@ const char kAcceptLegalDocumentsValidRequest[] = "\"doc_1\"," "\"doc_2\"" "]," - "\"google_transaction_id\":\"google-transaction-id\"" + "\"google_transaction_id\":\"google-transaction-id\"," + "\"merchant_domain\":\"https://example.com/\"" "}"; const char kAuthenticateInstrumentValidRequest[] = @@ -207,7 +209,7 @@ const char kGetFullWalletValidRequest[] = "}," "\"encrypted_otp\":\"encrypted_one_time_pad\"," "\"google_transaction_id\":\"google_transaction_id\"," - "\"merchant_domain\":\"merchant_domain\"," + "\"merchant_domain\":\"https://example.com/\"," "\"risk_params\":\"\"," "\"selected_address_id\":\"shipping_address_id\"," "\"selected_instrument_id\":\"instrument_id\"," @@ -216,11 +218,13 @@ const char kGetFullWalletValidRequest[] = const char kGetWalletItemsValidRequest[] = "{" + "\"merchant_domain\":\"https://example.com/\"," "\"risk_params\":\"\"" "}"; const char kSaveAddressValidRequest[] = "{" + "\"merchant_domain\":\"https://example.com/\"," "\"risk_params\":\"\"," "\"shipping_address\":" "{" @@ -269,6 +273,7 @@ const char kSaveInstrumentValidRequest[] = "}," "\"instrument_escrow_handle\":\"escrow_handle\"," "\"instrument_phone_number\":\"phone_number\"," + "\"merchant_domain\":\"https://example.com/\"," "\"risk_params\":\"\"" "}"; @@ -300,6 +305,7 @@ const char kSaveInstrumentAndAddressValidRequest[] = "}," "\"instrument_escrow_handle\":\"escrow_handle\"," "\"instrument_phone_number\":\"phone_number\"," + "\"merchant_domain\":\"https://example.com/\"," "\"risk_params\":\"\"," "\"shipping_address\":" "{" @@ -323,14 +329,14 @@ const char kSaveInstrumentAndAddressValidRequest[] = const char kSendAutocheckoutStatusOfSuccessValidRequest[] = "{" "\"google_transaction_id\":\"google_transaction_id\"," - "\"hostname\":\"hostname\"," + "\"merchant_domain\":\"https://example.com/\"," "\"success\":true" "}"; const char kSendAutocheckoutStatusOfFailureValidRequest[] = "{" "\"google_transaction_id\":\"google_transaction_id\"," - "\"hostname\":\"hostname\"," + "\"merchant_domain\":\"https://example.com/\"," "\"reason\":\"CANNOT_PROCEED\"," "\"success\":false" "}"; @@ -338,6 +344,8 @@ const char kSendAutocheckoutStatusOfFailureValidRequest[] = const char kUpdateInstrumentValidRequest[] = "{" "\"instrument_phone_number\":\"phone_number\"," + "\"merchant_domain\":\"https://example.com/\"," + "\"risk_params\":\"\"," "\"upgraded_billing_address\":" "{" "\"address_line\":" @@ -458,7 +466,7 @@ TEST_F(WalletClientTest, WalletErrorOnExpectedVoidResponse) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.SendAutocheckoutStatus(autofill::SUCCESS, - "", + GURL(kMerchantUrl), "", observer.AsWeakPtr()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); @@ -476,7 +484,7 @@ TEST_F(WalletClientTest, WalletErrorOnExpectedResponse) { net::TestURLFetcherFactory factory; WalletClient wallet_client(profile_.GetRequestContext()); - wallet_client.GetWalletItems(observer.AsWeakPtr()); + wallet_client.GetWalletItems(GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); ASSERT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_INTERNAL_SERVER_ERROR); @@ -491,7 +499,7 @@ TEST_F(WalletClientTest, NetworkFailureOnExpectedVoidResponse) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.SendAutocheckoutStatus(autofill::SUCCESS, - "", + GURL(kMerchantUrl), "", observer.AsWeakPtr()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); @@ -507,7 +515,7 @@ TEST_F(WalletClientTest, NetworkFailureOnExpectedResponse) { net::TestURLFetcherFactory factory; WalletClient wallet_client(profile_.GetRequestContext()); - wallet_client.GetWalletItems(observer.AsWeakPtr()); + wallet_client.GetWalletItems(GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); ASSERT_TRUE(fetcher); fetcher->set_response_code(net::HTTP_UNAUTHORIZED); @@ -522,7 +530,7 @@ TEST_F(WalletClientTest, RequestError) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.SendAutocheckoutStatus(autofill::SUCCESS, - "", + GURL(kMerchantUrl), "", observer.AsWeakPtr()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); @@ -539,7 +547,7 @@ TEST_F(WalletClientTest, GetFullWalletSuccess) { Cart cart("currency_code", "currency_code"); wallet_client.GetFullWallet("instrument_id", "shipping_address_id", - "merchant_domain", + GURL(kMerchantUrl), cart, "google_transaction_id", observer.AsWeakPtr()); @@ -569,7 +577,7 @@ TEST_F(WalletClientTest, GetFullWalletEncryptionDown) { Cart cart("currency_code", "currency_code"); wallet_client.GetFullWallet("instrument_id", "shipping_address_id", - "merchant_domain", + GURL(kMerchantUrl), cart, "google_transaction_id", observer.AsWeakPtr()); @@ -593,7 +601,7 @@ TEST_F(WalletClientTest, GetFullWalletEncryptionMalformed) { Cart cart("currency_code", "currency_code"); wallet_client.GetFullWallet("instrument_id", "shipping_address_id", - "merchant_domain", + GURL(kMerchantUrl), cart, "google_transaction_id", observer.AsWeakPtr()); @@ -618,7 +626,7 @@ TEST_F(WalletClientTest, GetFullWalletMalformedResponse) { Cart cart("currency_code", "currency_code"); wallet_client.GetFullWallet("instrument_id", "shipping_address_id", - "merchant_domain", + GURL(kMerchantUrl), cart, "google_transaction_id", observer.AsWeakPtr()); @@ -649,6 +657,7 @@ TEST_F(WalletClientTest, AcceptLegalDocuments) { doc_ids.push_back("doc_2"); wallet_client.AcceptLegalDocuments(doc_ids, kGoogleTransactionId, + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); ASSERT_TRUE(fetcher); @@ -773,7 +782,7 @@ TEST_F(WalletClientTest, GetWalletItems) { net::TestURLFetcherFactory factory; WalletClient wallet_client(profile_.GetRequestContext()); - wallet_client.GetWalletItems(observer.AsWeakPtr()); + wallet_client.GetWalletItems(GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); ASSERT_TRUE(fetcher); EXPECT_EQ(kGetWalletItemsValidRequest, GetData(fetcher)); @@ -793,7 +802,7 @@ TEST_F(WalletClientTest, SaveAddressSucceeded) { scoped_ptr<Address> address = GetTestShippingAddress(); WalletClient wallet_client(profile_.GetRequestContext()); - wallet_client.SaveAddress(*address, observer.AsWeakPtr()); + wallet_client.SaveAddress(*address, GURL(kMerchantUrl), observer.AsWeakPtr()); VerifyAndFinishRequest(factory, net::HTTP_OK, kSaveAddressValidRequest, @@ -809,7 +818,7 @@ TEST_F(WalletClientTest, SaveAddressFailedMalformedResponse) { scoped_ptr<Address> address = GetTestShippingAddress(); WalletClient wallet_client(profile_.GetRequestContext()); - wallet_client.SaveAddress(*address, observer.AsWeakPtr()); + wallet_client.SaveAddress(*address, GURL(kMerchantUrl), observer.AsWeakPtr()); VerifyAndFinishRequest(factory, net::HTTP_OK, kSaveAddressValidRequest, @@ -827,6 +836,7 @@ TEST_F(WalletClientTest, SaveInstrumentSucceeded) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.SaveInstrument(*instrument, "obfuscated_gaia_id", + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* encryption_fetcher = factory.GetFetcherByID(1); @@ -853,6 +863,7 @@ TEST_F(WalletClientTest, SaveInstrumentEscrowDown) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.SaveInstrument(*instrument, "obfuscated_gaia_id", + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* encryption_fetcher = factory.GetFetcherByID(1); @@ -873,6 +884,7 @@ TEST_F(WalletClientTest, SaveInstrumentEscrowMalformed) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.SaveInstrument(*instrument, "obfuscated_gaia_id", + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* encryption_fetcher = factory.GetFetcherByID(1); @@ -893,6 +905,7 @@ TEST_F(WalletClientTest, SaveInstrumentFailedMalformedResponse) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.SaveInstrument(*instrument, "obfuscated_gaia_id", + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* encryption_fetcher = factory.GetFetcherByID(1); @@ -923,6 +936,7 @@ TEST_F(WalletClientTest, SaveInstrumentAndAddressSucceeded) { wallet_client.SaveInstrumentAndAddress(*instrument, *address, "obfuscated_gaia_id", + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* encryption_fetcher = factory.GetFetcherByID(1); @@ -951,6 +965,7 @@ TEST_F(WalletClientTest, SaveInstrumentAndAddressEscrowDown) { wallet_client.SaveInstrumentAndAddress(*instrument, *address, "obfuscated_gaia_id", + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* encryption_fetcher = factory.GetFetcherByID(1); @@ -974,6 +989,7 @@ TEST_F(WalletClientTest, SaveInstrumentAndAddressEscrowMalformed) { wallet_client.SaveInstrumentAndAddress(*instrument, *address, "obfuscated_gaia_id", + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* encryption_fetcher = factory.GetFetcherByID(1); @@ -997,6 +1013,7 @@ TEST_F(WalletClientTest, SaveInstrumentAndAddressFailedAddressMissing) { wallet_client.SaveInstrumentAndAddress(*instrument, *address, "obfuscated_gaia_id", + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* encryption_fetcher = factory.GetFetcherByID(1); @@ -1025,6 +1042,7 @@ TEST_F(WalletClientTest, SaveInstrumentAndAddressFailedInstrumentMissing) { wallet_client.SaveInstrumentAndAddress(*instrument, *address, "obfuscated_gaia_id", + GURL(kMerchantUrl), observer.AsWeakPtr()); net::TestURLFetcher* encryption_fetcher = factory.GetFetcherByID(1); @@ -1050,6 +1068,7 @@ TEST_F(WalletClientTest, UpdateInstrumentSucceeded) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.UpdateInstrument("instrument_id", *address, + GURL(kMerchantUrl), observer.AsWeakPtr()); VerifyAndFinishRequest(factory, net::HTTP_OK, @@ -1068,6 +1087,7 @@ TEST_F(WalletClientTest, UpdateInstrumentMalformedResponse) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.UpdateInstrument("instrument_id", *address, + GURL(kMerchantUrl), observer.AsWeakPtr()); VerifyAndFinishRequest(factory, net::HTTP_OK, @@ -1083,7 +1103,7 @@ TEST_F(WalletClientTest, SendAutocheckoutOfStatusSuccess) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.SendAutocheckoutStatus(autofill::SUCCESS, - "hostname", + GURL(kMerchantUrl), "google_transaction_id", observer.AsWeakPtr()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); @@ -1101,7 +1121,7 @@ TEST_F(WalletClientTest, SendAutocheckoutStatusOfFailure) { WalletClient wallet_client(profile_.GetRequestContext()); wallet_client.SendAutocheckoutStatus(autofill::CANNOT_PROCEED, - "hostname", + GURL(kMerchantUrl), "google_transaction_id", observer.AsWeakPtr()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); @@ -1118,7 +1138,7 @@ TEST_F(WalletClientTest, HasRequestInProgress) { WalletClient wallet_client(profile_.GetRequestContext()); EXPECT_FALSE(wallet_client.HasRequestInProgress()); - wallet_client.GetWalletItems(observer.AsWeakPtr()); + wallet_client.GetWalletItems(GURL(kMerchantUrl), observer.AsWeakPtr()); EXPECT_TRUE(wallet_client.HasRequestInProgress()); net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |