| 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]]);
|
| -}
|
|
|