| OLD | NEW |
| 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_request_state.h" | 5 #include "components/payments/content/payment_request_state.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 num_on_selected_information_changed_called_++; | 48 num_on_selected_information_changed_called_++; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // PaymentRequestState::Delegate: | 51 // PaymentRequestState::Delegate: |
| 52 void OnPaymentResponseAvailable(mojom::PaymentResponsePtr response) override { | 52 void OnPaymentResponseAvailable(mojom::PaymentResponsePtr response) override { |
| 53 payment_response_ = std::move(response); | 53 payment_response_ = std::move(response); |
| 54 }; | 54 }; |
| 55 void OnShippingOptionIdSelected(std::string shipping_option_id) override {} | 55 void OnShippingOptionIdSelected(std::string shipping_option_id) override {} |
| 56 void OnShippingAddressSelected(mojom::PaymentAddressPtr address) override {} | 56 void OnShippingAddressSelected(mojom::PaymentAddressPtr address) override {} |
| 57 | 57 |
| 58 PaymentRequestDelegate* GetPaymentRequestDelegate() override { |
| 59 return nullptr; |
| 60 } |
| 61 |
| 58 void RecreateStateWithOptionsAndDetails( | 62 void RecreateStateWithOptionsAndDetails( |
| 59 mojom::PaymentOptionsPtr options, | 63 mojom::PaymentOptionsPtr options, |
| 60 mojom::PaymentDetailsPtr details, | 64 mojom::PaymentDetailsPtr details, |
| 61 std::vector<mojom::PaymentMethodDataPtr> method_data) { | 65 std::vector<mojom::PaymentMethodDataPtr> method_data) { |
| 62 // The spec will be based on the |options| and |details| passed in. | 66 // The spec will be based on the |options| and |details| passed in. |
| 63 spec_ = base::MakeUnique<PaymentRequestSpec>( | 67 spec_ = base::MakeUnique<PaymentRequestSpec>( |
| 64 std::move(options), std::move(details), std::move(method_data), nullptr, | 68 std::move(options), std::move(details), std::move(method_data), nullptr, |
| 65 "en-US"); | 69 "en-US"); |
| 66 state_ = base::MakeUnique<PaymentRequestState>( | 70 state_ = base::MakeUnique<PaymentRequestState>( |
| 67 spec_.get(), this, "en-US", &test_personal_data_manager_); | 71 spec_.get(), this, "en-US", &test_personal_data_manager_); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 EXPECT_TRUE(state()->is_ready_to_pay()); | 395 EXPECT_TRUE(state()->is_ready_to_pay()); |
| 392 state()->GeneratePaymentResponse(); | 396 state()->GeneratePaymentResponse(); |
| 393 | 397 |
| 394 // Check that the name was set, but not the other values. | 398 // Check that the name was set, but not the other values. |
| 395 EXPECT_EQ("John H. Doe", response()->payer_name.value()); | 399 EXPECT_EQ("John H. Doe", response()->payer_name.value()); |
| 396 EXPECT_FALSE(response()->payer_phone.has_value()); | 400 EXPECT_FALSE(response()->payer_phone.has_value()); |
| 397 EXPECT_FALSE(response()->payer_email.has_value()); | 401 EXPECT_FALSE(response()->payer_email.has_value()); |
| 398 } | 402 } |
| 399 | 403 |
| 400 } // namespace payments | 404 } // namespace payments |
| OLD | NEW |