| 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/payments/payment_request_view_controller.h" | 5 #import "ios/chrome/browser/payments/payment_request_view_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "components/autofill/core/browser/autofill_profile.h" | 9 #include "components/autofill/core/browser/autofill_profile.h" |
| 10 #include "components/autofill/core/browser/autofill_test_utils.h" | 10 #include "components/autofill/core/browser/autofill_test_utils.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class PaymentRequestViewControllerTest : public CollectionViewControllerTest { | 32 class PaymentRequestViewControllerTest : public CollectionViewControllerTest { |
| 33 protected: | 33 protected: |
| 34 PaymentRequestViewControllerTest() | 34 PaymentRequestViewControllerTest() |
| 35 : autofill_profile_(autofill::test::GetFullProfile()), | 35 : autofill_profile_(autofill::test::GetFullProfile()), |
| 36 credit_card_(autofill::test::GetCreditCard()) { | 36 credit_card_(autofill::test::GetCreditCard()) { |
| 37 // Add testing profile and credit card to autofill::TestPersonalDataManager. | 37 // Add testing profile and credit card to autofill::TestPersonalDataManager. |
| 38 personal_data_manager_.AddTestingProfile(&autofill_profile_); | 38 personal_data_manager_.AddTestingProfile(&autofill_profile_); |
| 39 personal_data_manager_.AddTestingCreditCard(&credit_card_); | 39 personal_data_manager_.AddTestingCreditCard(&credit_card_); |
| 40 } | 40 } |
| 41 | 41 |
| 42 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 42 CollectionViewController* InstantiateController() override { |
| 43 payment_request_ = base::MakeUnique<PaymentRequest>( | 43 payment_request_ = base::MakeUnique<PaymentRequest>( |
| 44 payment_request_test_util::CreateTestWebPaymentRequest(), | 44 payment_request_test_util::CreateTestWebPaymentRequest(), |
| 45 &personal_data_manager_); | 45 &personal_data_manager_); |
| 46 | 46 |
| 47 return [[PaymentRequestViewController alloc] | 47 return [[PaymentRequestViewController alloc] |
| 48 initWithPaymentRequest:payment_request_.get()]; | 48 initWithPaymentRequest:payment_request_.get()]; |
| 49 } | 49 } |
| 50 | 50 |
| 51 PaymentRequestViewController* GetPaymentRequestViewController() { | 51 PaymentRequestViewController* GetPaymentRequestViewController() { |
| 52 return base::mac::ObjCCastStrict<PaymentRequestViewController>( | 52 return base::mac::ObjCCastStrict<PaymentRequestViewController>( |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 [GetPaymentRequestViewController() loadModel]; | 194 [GetPaymentRequestViewController() loadModel]; |
| 195 | 195 |
| 196 ASSERT_EQ(1, NumberOfSections()); | 196 ASSERT_EQ(1, NumberOfSections()); |
| 197 // There should be only one item. | 197 // There should be only one item. |
| 198 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0))); | 198 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0))); |
| 199 | 199 |
| 200 // The item should be of type StatusItem. | 200 // The item should be of type StatusItem. |
| 201 id item = GetCollectionViewItem(0, 0); | 201 id item = GetCollectionViewItem(0, 0); |
| 202 EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]); | 202 EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]); |
| 203 } | 203 } |
| OLD | NEW |