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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 [GetPaymentRequestViewController() loadModel]; | 174 [GetPaymentRequestViewController() loadModel]; |
175 | 175 |
176 // The only item in the Payment section should be of type | 176 // The only item in the Payment section should be of type |
177 // CollectionViewDetailItem. | 177 // CollectionViewDetailItem. |
178 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(2))); | 178 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(2))); |
179 id item = GetCollectionViewItem(2, 0); | 179 id item = GetCollectionViewItem(2, 0); |
180 EXPECT_TRUE([item isMemberOfClass:[CollectionViewDetailItem class]]); | 180 EXPECT_TRUE([item isMemberOfClass:[CollectionViewDetailItem class]]); |
181 CollectionViewDetailItem* detail_item = item; | 181 CollectionViewDetailItem* detail_item = item; |
182 EXPECT_EQ(MDCCollectionViewCellAccessoryNone, detail_item.accessoryType); | 182 EXPECT_EQ(MDCCollectionViewCellAccessoryNone, detail_item.accessoryType); |
183 } | 183 } |
| 184 |
| 185 // Tests that the correct items are displayed after loading the model, when |
| 186 // the view is in pending state. |
| 187 TEST_F(PaymentRequestViewControllerTest, TestModelPendingState) { |
| 188 CreateController(); |
| 189 CheckController(); |
| 190 |
| 191 [GetPaymentRequestViewController() setPending:YES]; |
| 192 [GetPaymentRequestViewController() loadModel]; |
| 193 |
| 194 ASSERT_EQ(1, NumberOfSections()); |
| 195 // There should be only one item. |
| 196 ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0))); |
| 197 |
| 198 // The item should be of type StatusItem. |
| 199 id item = GetCollectionViewItem(0, 0); |
| 200 EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]); |
| 201 } |
OLD | NEW |