| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/shipping_address_selection_view_controller.
h" | 5 #import "ios/chrome/browser/payments/shipping_address_selection_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 16 matching lines...) Expand all Loading... |
| 27 : public CollectionViewControllerTest { | 27 : public CollectionViewControllerTest { |
| 28 protected: | 28 protected: |
| 29 PaymentRequestShippingAddressSelectionViewControllerTest() | 29 PaymentRequestShippingAddressSelectionViewControllerTest() |
| 30 : autofill_profile1_(autofill::test::GetFullProfile()), | 30 : autofill_profile1_(autofill::test::GetFullProfile()), |
| 31 autofill_profile2_(autofill::test::GetFullProfile2()) { | 31 autofill_profile2_(autofill::test::GetFullProfile2()) { |
| 32 // Add testing profiles to autofill::TestPersonalDataManager. | 32 // Add testing profiles to autofill::TestPersonalDataManager. |
| 33 personal_data_manager_.AddTestingProfile(&autofill_profile1_); | 33 personal_data_manager_.AddTestingProfile(&autofill_profile1_); |
| 34 personal_data_manager_.AddTestingProfile(&autofill_profile2_); | 34 personal_data_manager_.AddTestingProfile(&autofill_profile2_); |
| 35 } | 35 } |
| 36 | 36 |
| 37 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 37 CollectionViewController* InstantiateController() override { |
| 38 payment_request_ = base::MakeUnique<PaymentRequest>( | 38 payment_request_ = base::MakeUnique<PaymentRequest>( |
| 39 payment_request_test_util::CreateTestWebPaymentRequest(), | 39 payment_request_test_util::CreateTestWebPaymentRequest(), |
| 40 &personal_data_manager_); | 40 &personal_data_manager_); |
| 41 | 41 |
| 42 return [[ShippingAddressSelectionViewController alloc] | 42 return [[ShippingAddressSelectionViewController alloc] |
| 43 initWithPaymentRequest:payment_request_.get()]; | 43 initWithPaymentRequest:payment_request_.get()]; |
| 44 } | 44 } |
| 45 | 45 |
| 46 ShippingAddressSelectionViewController* | 46 ShippingAddressSelectionViewController* |
| 47 GetShippingAddressSelectionViewController() { | 47 GetShippingAddressSelectionViewController() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 [GetShippingAddressSelectionViewController() loadModel]; | 103 [GetShippingAddressSelectionViewController() loadModel]; |
| 104 | 104 |
| 105 ASSERT_EQ(1, NumberOfSections()); | 105 ASSERT_EQ(1, NumberOfSections()); |
| 106 // There should be only one item. | 106 // There should be only one item. |
| 107 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0))); | 107 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0))); |
| 108 | 108 |
| 109 // The item should be of type StatusItem. | 109 // The item should be of type StatusItem. |
| 110 item = GetCollectionViewItem(0, 0); | 110 item = GetCollectionViewItem(0, 0); |
| 111 EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]); | 111 EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]); |
| 112 } | 112 } |
| OLD | NEW |