| 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 #import "ios/chrome/browser/ui/payments/full_card_requester.h" | 5 #import "ios/chrome/browser/ui/payments/full_card_requester.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 base::WeakPtrFactory<FakeResultDelegate> weak_ptr_factory_; | 73 base::WeakPtrFactory<FakeResultDelegate> weak_ptr_factory_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(FakeResultDelegate); | 75 DISALLOW_COPY_AND_ASSIGN(FakeResultDelegate); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 class PaymentRequestFullCardRequesterTest : public ChromeWebTest { | 78 class PaymentRequestFullCardRequesterTest : public ChromeWebTest { |
| 79 protected: | 79 protected: |
| 80 PaymentRequestFullCardRequesterTest() | 80 PaymentRequestFullCardRequesterTest() |
| 81 : credit_card_(autofill::test::GetCreditCard()) { | 81 : credit_card_(autofill::test::GetCreditCard()), |
| 82 TestChromeBrowserState::Builder test_cbs_builder; | 82 chrome_browser_state_(TestChromeBrowserState::Builder().Build()) {} |
| 83 chrome_browser_state_ = test_cbs_builder.Build(); | |
| 84 } | |
| 85 | 83 |
| 86 void SetUp() override { | 84 void SetUp() override { |
| 87 ChromeWebTest::SetUp(); | 85 ChromeWebTest::SetUp(); |
| 88 | 86 |
| 89 // Set up what is needed to have an instance of autofill::AutofillManager. | 87 // Set up what is needed to have an instance of autofill::AutofillManager. |
| 90 AutofillAgent* autofill_agent = | 88 AutofillAgent* autofill_agent = |
| 91 [[AutofillAgent alloc] initWithBrowserState:chrome_browser_state_.get() | 89 [[AutofillAgent alloc] initWithBrowserState:chrome_browser_state_.get() |
| 92 webState:web_state()]; | 90 webState:web_state()]; |
| 93 InfoBarManagerImpl::CreateForWebState(web_state()); | 91 InfoBarManagerImpl::CreateForWebState(web_state()); |
| 94 autofill_controller_ = [[AutofillController alloc] | 92 autofill_controller_ = [[AutofillController alloc] |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 176 |
| 179 std::unique_ptr<base::DictionaryValue> response_value = | 177 std::unique_ptr<base::DictionaryValue> response_value = |
| 180 payments::data_util::GetBasicCardResponseFromAutofillCreditCard( | 178 payments::data_util::GetBasicCardResponseFromAutofillCreditCard( |
| 181 credit_card_, base::ASCIIToUTF16("123"), billing_address, "en-US") | 179 credit_card_, base::ASCIIToUTF16("123"), billing_address, "en-US") |
| 182 .ToDictionaryValue(); | 180 .ToDictionaryValue(); |
| 183 std::string stringifiedDetails; | 181 std::string stringifiedDetails; |
| 184 base::JSONWriter::Write(*response_value, &stringifiedDetails); | 182 base::JSONWriter::Write(*response_value, &stringifiedDetails); |
| 185 | 183 |
| 186 full_card_requester.OnInstrumentDetailsReady("visa", stringifiedDetails); | 184 full_card_requester.OnInstrumentDetailsReady("visa", stringifiedDetails); |
| 187 } | 185 } |
| OLD | NEW |