OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/payments/payment_request_error_view_controller.h" |
| 6 |
| 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/memory/ptr_util.h" |
| 9 #import "ios/chrome/browser/payments/cells/payments_text_item.h" |
| 10 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h
" |
| 11 #include "ios/chrome/grit/ios_strings.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 |
| 14 class PaymentRequestErrorViewControllerTest |
| 15 : public CollectionViewControllerTest { |
| 16 protected: |
| 17 CollectionViewController* NewController() override NS_RETURNS_RETAINED { |
| 18 return [[PaymentRequestErrorViewController alloc] init]; |
| 19 } |
| 20 |
| 21 PaymentRequestErrorViewController* GetPaymentRequestErrorViewController() { |
| 22 return base::mac::ObjCCastStrict<PaymentRequestErrorViewController>( |
| 23 controller()); |
| 24 } |
| 25 }; |
| 26 |
| 27 // Tests that the correct number of items are displayed after loading the model. |
| 28 TEST_F(PaymentRequestErrorViewControllerTest, TestModel) { |
| 29 CreateController(); |
| 30 CheckController(); |
| 31 CheckTitleWithId(IDS_IOS_PAYMENT_REQUEST_TITLE); |
| 32 |
| 33 [GetPaymentRequestErrorViewController() loadModel]; |
| 34 |
| 35 ASSERT_EQ(1, NumberOfSections()); |
| 36 // There should be one item for the error message. |
| 37 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0))); |
| 38 |
| 39 // They item should be of type PriceItem. |
| 40 id item = GetCollectionViewItem(0, 0); |
| 41 EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]); |
| 42 } |
OLD | NEW |