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