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

Unified Diff: ios/chrome/browser/payments/payment_request_error_view_controller_unittest.mm

Issue 2701923003: [Payment Request] Error message screen (Closed)
Patch Set: ARCified Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/payments/payment_request_error_view_controller_unittest.mm
diff --git a/ios/chrome/browser/payments/payment_request_error_view_controller_unittest.mm b/ios/chrome/browser/payments/payment_request_error_view_controller_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..153e643795211fbbaf909a11e49c433dd5148ef5
--- /dev/null
+++ b/ios/chrome/browser/payments/payment_request_error_view_controller_unittest.mm
@@ -0,0 +1,42 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/payments/payment_request_error_view_controller.h"
+
+#include "base/mac/foundation_util.h"
+#include "base/memory/ptr_util.h"
+#import "ios/chrome/browser/payments/cells/payments_text_item.h"
+#import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h"
+#include "ios/chrome/grit/ios_strings.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class PaymentRequestErrorViewControllerTest
+ : public CollectionViewControllerTest {
+ protected:
+ CollectionViewController* NewController() override NS_RETURNS_RETAINED {
+ return [[PaymentRequestErrorViewController alloc] init];
+ }
+
+ PaymentRequestErrorViewController* GetPaymentRequestErrorViewController() {
+ return base::mac::ObjCCastStrict<PaymentRequestErrorViewController>(
+ controller());
+ }
+};
+
+// Tests that the correct number of items are displayed after loading the model.
+TEST_F(PaymentRequestErrorViewControllerTest, TestModel) {
+ CreateController();
+ CheckController();
+ CheckTitleWithId(IDS_IOS_PAYMENT_REQUEST_TITLE);
+
+ [GetPaymentRequestErrorViewController() loadModel];
+
+ ASSERT_EQ(1, NumberOfSections());
+ // There should be one item for the error message.
+ ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0)));
+
+ // They item should be of type PriceItem.
+ id item = GetCollectionViewItem(0, 0);
+ EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]);
+}

Powered by Google App Engine
This is Rietveld 408576698