| 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/shipping_option_selection_view_controller.h
" | 5 #import "ios/chrome/browser/payments/shipping_option_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 "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/autofill/core/browser/test_personal_data_manager.h" | 10 #include "components/autofill/core/browser/test_personal_data_manager.h" |
| 11 #include "components/strings/grit/components_strings.h" | 11 #include "components/strings/grit/components_strings.h" |
| 12 #import "ios/chrome/browser/payments/cells/payments_text_item.h" | 12 #import "ios/chrome/browser/payments/cells/payments_text_item.h" |
| 13 #include "ios/chrome/browser/payments/payment_request.h" | 13 #include "ios/chrome/browser/payments/payment_request.h" |
| 14 #import "ios/chrome/browser/payments/payment_request_test_util.h" | 14 #import "ios/chrome/browser/payments/payment_request_test_util.h" |
| 15 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" | 15 #import "ios/chrome/browser/ui/autofill/cells/status_item.h" |
| 16 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" | 16 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" |
| 17 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" | 17 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" |
| 18 #include "ios/web/public/payments/payment_request.h" | 18 #include "ios/web/public/payments/payment_request.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 #if !defined(__has_feature) || !__has_feature(objc_arc) | 21 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 22 #error "This file requires ARC support." | 22 #error "This file requires ARC support." |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 class PaymentRequestShippingOptionSelectionViewControllerTest | 25 class PaymentRequestShippingOptionSelectionViewControllerTest |
| 26 : public CollectionViewControllerTest { | 26 : public CollectionViewControllerTest { |
| 27 protected: | 27 protected: |
| 28 CollectionViewController* NewController() override NS_RETURNS_RETAINED { | 28 CollectionViewController* InstantiateController() override { |
| 29 payment_request_ = base::MakeUnique<PaymentRequest>( | 29 payment_request_ = base::MakeUnique<PaymentRequest>( |
| 30 payment_request_test_util::CreateTestWebPaymentRequest(), | 30 payment_request_test_util::CreateTestWebPaymentRequest(), |
| 31 &personal_data_manager_); | 31 &personal_data_manager_); |
| 32 | 32 |
| 33 return [[ShippingOptionSelectionViewController alloc] | 33 return [[ShippingOptionSelectionViewController alloc] |
| 34 initWithPaymentRequest:payment_request_.get()]; | 34 initWithPaymentRequest:payment_request_.get()]; |
| 35 } | 35 } |
| 36 | 36 |
| 37 ShippingOptionSelectionViewController* | 37 ShippingOptionSelectionViewController* |
| 38 GetShippingOptionSelectionViewController() { | 38 GetShippingOptionSelectionViewController() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 [GetShippingOptionSelectionViewController() loadModel]; | 86 [GetShippingOptionSelectionViewController() loadModel]; |
| 87 | 87 |
| 88 ASSERT_EQ(1, NumberOfSections()); | 88 ASSERT_EQ(1, NumberOfSections()); |
| 89 // There should be only one item. | 89 // There should be only one item. |
| 90 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0))); | 90 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0))); |
| 91 | 91 |
| 92 // The item should be of type StatusItem. | 92 // The item should be of type StatusItem. |
| 93 item = GetCollectionViewItem(0, 0); | 93 item = GetCollectionViewItem(0, 0); |
| 94 EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]); | 94 EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]); |
| 95 } | 95 } |
| OLD | NEW |