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

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

Issue 2826713002: [Payment Request] Refactors the remaining selector view controllers (Closed)
Patch Set: Addressed comment Created 3 years, 8 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
« no previous file with comments | « ios/chrome/browser/payments/shipping_option_selection_view_controller_actions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/payments/shipping_option_selection_view_controller_unittest.mm
diff --git a/ios/chrome/browser/payments/shipping_option_selection_view_controller_unittest.mm b/ios/chrome/browser/payments/shipping_option_selection_view_controller_unittest.mm
deleted file mode 100644
index aa808caa1553136bc731035f51333c0e909b2f2b..0000000000000000000000000000000000000000
--- a/ios/chrome/browser/payments/shipping_option_selection_view_controller_unittest.mm
+++ /dev/null
@@ -1,94 +0,0 @@
-// 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/shipping_option_selection_view_controller.h"
-
-#include "base/mac/foundation_util.h"
-#include "base/memory/ptr_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "components/autofill/core/browser/test_personal_data_manager.h"
-#include "components/strings/grit/components_strings.h"
-#import "ios/chrome/browser/payments/cells/payments_text_item.h"
-#include "ios/chrome/browser/payments/payment_request.h"
-#import "ios/chrome/browser/payments/payment_request_test_util.h"
-#import "ios/chrome/browser/ui/autofill/cells/status_item.h"
-#import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h"
-#include "ios/web/public/payments/payment_request.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
-class PaymentRequestShippingOptionSelectionViewControllerTest
- : public CollectionViewControllerTest {
- protected:
- CollectionViewController* InstantiateController() override {
- payment_request_ = base::MakeUnique<PaymentRequest>(
- payment_request_test_util::CreateTestWebPaymentRequest(),
- &personal_data_manager_);
-
- return [[ShippingOptionSelectionViewController alloc]
- initWithPaymentRequest:payment_request_.get()];
- }
-
- ShippingOptionSelectionViewController*
- GetShippingOptionSelectionViewController() {
- return base::mac::ObjCCastStrict<ShippingOptionSelectionViewController>(
- controller());
- }
-
- autofill::TestPersonalDataManager personal_data_manager_;
- std::unique_ptr<PaymentRequest> payment_request_;
-};
-
-// Tests that the correct number of items are displayed after loading the model
-// and that the correct item appears to be selected.
-TEST_F(PaymentRequestShippingOptionSelectionViewControllerTest, TestModel) {
- CreateController();
- CheckController();
- CheckTitleWithId(IDS_PAYMENTS_SHIPPING_OPTION_LABEL);
-
- [GetShippingOptionSelectionViewController() loadModel];
-
- ASSERT_EQ(1, NumberOfSections());
- // One item for each of shipping options.
- ASSERT_EQ(2U, static_cast<unsigned int>(NumberOfItemsInSection(0)));
-
- // The next two items should be of type PaymentsTextItem. The first one
- // should appear to be selected.
- id item = GetCollectionViewItem(0, 0);
- EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]);
- PaymentsTextItem* text_item = item;
- EXPECT_EQ(MDCCollectionViewCellAccessoryCheckmark, text_item.accessoryType);
-
- item = GetCollectionViewItem(0, 1);
- EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]);
- text_item = item;
- EXPECT_EQ(MDCCollectionViewCellAccessoryNone, text_item.accessoryType);
-
- // Test the error state.
- [GetShippingOptionSelectionViewController() setErrorMessage:@"Lorem ipsum"];
- [GetShippingOptionSelectionViewController() loadModel];
-
- ASSERT_EQ(1, NumberOfSections());
- // There should be 3 items now in total.
- ASSERT_EQ(3U, static_cast<unsigned int>(NumberOfItemsInSection(0)));
-
- // The first item should also be of type TextAndMessageItem.
- item = GetCollectionViewItem(0, 0);
- EXPECT_TRUE([item isMemberOfClass:[PaymentsTextItem class]]);
-
- // Test the pending state.
- [GetShippingOptionSelectionViewController() setPending:YES];
- [GetShippingOptionSelectionViewController() loadModel];
-
- ASSERT_EQ(1, NumberOfSections());
- // There should be only one item.
- ASSERT_EQ(1U, static_cast<unsigned int>(NumberOfItemsInSection(0)));
-
- // The item should be of type StatusItem.
- item = GetCollectionViewItem(0, 0);
- EXPECT_TRUE([item isMemberOfClass:[StatusItem class]]);
-}
« no previous file with comments | « ios/chrome/browser/payments/shipping_option_selection_view_controller_actions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698