Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: ios/chrome/browser/payments/payment_items_display_view_controller_unittest.mm

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/chrome/browser/payments/payment_items_display_view_controller.h"
6
7 #include <vector>
8
9 #include "base/mac/foundation_util.h"
10 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h "
11 #include "ios/chrome/grit/ios_strings.h"
12 #include "ios/web/public/payments/payment_request.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace {
16
17 class PaymentItemsDisplayViewControllerTest
18 : public CollectionViewControllerTest {
19 protected:
20 CollectionViewController* NewController() override NS_RETURNS_RETAINED {
21 return [[PaymentItemsDisplayViewController alloc]
22 initWithPayButtonEnabled:YES];
23 }
24
25 PaymentItemsDisplayViewController* PaymentItemsController() {
26 return base::mac::ObjCCastStrict<PaymentItemsDisplayViewController>(
27 controller());
28 }
29 };
30
31 // Tests that the correct number of items are displayed after loading the model.
32 TEST_F(PaymentItemsDisplayViewControllerTest, TestModel) {
33 CreateController();
34 CheckController();
35 CheckTitleWithId(IDS_IOS_PAYMENT_REQUEST_PAYMENT_ITEMS_TITLE);
36
37 std::vector<web::PaymentItem> paymentItems;
38 web::PaymentItem paymentItem;
39 paymentItems.push_back(paymentItem);
40 paymentItems.push_back(paymentItem);
41 paymentItems.push_back(paymentItem);
42
43 [PaymentItemsController() setTotal:paymentItem];
44 [PaymentItemsController() setPaymentItems:paymentItems];
45 [PaymentItemsController() loadModel];
46
47 ASSERT_EQ(1, NumberOfSections());
48 // There should be an item for each of the line items in paymentItems plus 1
49 // for the total.
50 EXPECT_EQ(paymentItems.size() + 1,
51 static_cast<unsigned int>(NumberOfItemsInSection(0)));
52 }
53
54 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698