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

Side by Side Diff: components/payments/content/payment_response_helper_unittest.cc

Issue 2803443003: [Payments] Added region load failure tolerance and tests to PR editor. (Closed)
Patch Set: Removed unneeded include. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/payments/content/payment_response_helper.h" 5 #include "components/payments/content/payment_response_helper.h"
6 6
7 #include <memory>
8 #include <string>
7 #include <utility> 9 #include <utility>
10 #include <vector>
8 11
9 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
10 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
11 #include "components/autofill/core/browser/autofill_profile.h" 14 #include "components/autofill/core/browser/autofill_profile.h"
12 #include "components/autofill/core/browser/autofill_test_utils.h" 15 #include "components/autofill/core/browser/autofill_test_utils.h"
13 #include "components/autofill/core/browser/credit_card.h" 16 #include "components/autofill/core/browser/credit_card.h"
14 #include "components/autofill/core/browser/test_personal_data_manager.h" 17 #include "components/autofill/core/browser/test_personal_data_manager.h"
15 #include "components/payments/content/payment_request.mojom.h" 18 #include "components/payments/content/payment_request.mojom.h"
16 #include "components/payments/content/payment_request_spec.h" 19 #include "components/payments/content/payment_request_spec.h"
17 #include "components/payments/core/autofill_payment_instrument.h" 20 #include "components/payments/core/autofill_payment_instrument.h"
(...skipping 22 matching lines...) Expand all
40 bool IsIncognito() const override { return false; } 43 bool IsIncognito() const override { return false; }
41 44
42 void DoFullCardRequest( 45 void DoFullCardRequest(
43 const autofill::CreditCard& credit_card, 46 const autofill::CreditCard& credit_card,
44 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> 47 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate>
45 result_delegate) override { 48 result_delegate) override {
46 result_delegate->OnFullCardRequestSucceeded(credit_card, 49 result_delegate->OnFullCardRequestSucceeded(credit_card,
47 base::ASCIIToUTF16("123")); 50 base::ASCIIToUTF16("123"));
48 } 51 }
49 52
53 std::unique_ptr<const ::i18n::addressinput::Source> GetAddressInputSource()
54 override {
55 return nullptr;
56 }
57
58 std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage()
59 override {
60 return nullptr;
61 }
62
50 private: 63 private:
51 autofill::PersonalDataManager* personal_data_manager_; 64 autofill::PersonalDataManager* personal_data_manager_;
52 std::string locale_; 65 std::string locale_;
53 DISALLOW_COPY_AND_ASSIGN(FakePaymentRequestDelegate); 66 DISALLOW_COPY_AND_ASSIGN(FakePaymentRequestDelegate);
54 }; 67 };
55 68
56 class PaymentResponseHelperTest : public testing::Test, 69 class PaymentResponseHelperTest : public testing::Test,
57 public PaymentResponseHelper::Delegate { 70 public PaymentResponseHelper::Delegate {
58 protected: 71 protected:
59 PaymentResponseHelperTest() 72 PaymentResponseHelperTest()
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 PaymentResponseHelper helper("en-US", spec(), test_instrument(), 273 PaymentResponseHelper helper("en-US", spec(), test_instrument(),
261 test_address(), test_address(), this); 274 test_address(), test_address(), this);
262 275
263 // Check that the name was set, but not the other values. 276 // Check that the name was set, but not the other values.
264 EXPECT_EQ("John H. Doe", response()->payer_name.value()); 277 EXPECT_EQ("John H. Doe", response()->payer_name.value());
265 EXPECT_FALSE(response()->payer_phone.has_value()); 278 EXPECT_FALSE(response()->payer_phone.has_value());
266 EXPECT_FALSE(response()->payer_email.has_value()); 279 EXPECT_FALSE(response()->payer_email.has_value());
267 } 280 }
268 281
269 } // namespace payments 282 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_request_state.cc ('k') | components/payments/core/payment_request_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698