| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_items_display_coordinator.h" | 5 #import "ios/chrome/browser/payments/payment_items_display_coordinator.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/test/ios/wait_util.h" | 8 #include "base/test/ios/wait_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/credit_card.h" | 10 #include "components/autofill/core/browser/credit_card.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 EXPECT_EQ(2u, navigation_controller.viewControllers.count); | 48 EXPECT_EQ(2u, navigation_controller.viewControllers.count); |
| 49 | 49 |
| 50 [coordinator stop]; | 50 [coordinator stop]; |
| 51 // Short delay to allow animation to complete. | 51 // Short delay to allow animation to complete. |
| 52 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); | 52 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); |
| 53 EXPECT_EQ(1u, navigation_controller.viewControllers.count); | 53 EXPECT_EQ(1u, navigation_controller.viewControllers.count); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Tests that calling the view controller delegate method which notifies the | 56 // Tests that calling the view controller delegate method which notifies the |
| 57 // coordinator that the user has confirmed the payment request invokes the | 57 // coordinator that the user has confirmed the payment request invokes the |
| 58 // the corresponding coordinator delegate method. | 58 // corresponding coordinator delegate method. |
| 59 TEST(PaymentItemsDisplayCoordinatorTest, DidConfirm) { | 59 TEST(PaymentItemsDisplayCoordinatorTest, DidConfirm) { |
| 60 std::unique_ptr<PaymentRequest> payment_request = | 60 std::unique_ptr<PaymentRequest> payment_request = |
| 61 payment_request_test_util::CreateTestPaymentRequest(); | 61 payment_request_test_util::CreateTestPaymentRequest(); |
| 62 | 62 |
| 63 UIViewController* base_view_controller = [[UIViewController alloc] init]; | 63 UIViewController* base_view_controller = [[UIViewController alloc] init]; |
| 64 UINavigationController* navigation_controller = | 64 UINavigationController* navigation_controller = |
| 65 [[UINavigationController alloc] | 65 [[UINavigationController alloc] |
| 66 initWithRootViewController:base_view_controller]; | 66 initWithRootViewController:base_view_controller]; |
| 67 | 67 |
| 68 PaymentItemsDisplayCoordinator* coordinator = | 68 PaymentItemsDisplayCoordinator* coordinator = |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 EXPECT_EQ(2u, navigation_controller.viewControllers.count); | 123 EXPECT_EQ(2u, navigation_controller.viewControllers.count); |
| 124 | 124 |
| 125 // Call the controller delegate method. | 125 // Call the controller delegate method. |
| 126 PaymentItemsDisplayViewController* view_controller = | 126 PaymentItemsDisplayViewController* view_controller = |
| 127 base::mac::ObjCCastStrict<PaymentItemsDisplayViewController>( | 127 base::mac::ObjCCastStrict<PaymentItemsDisplayViewController>( |
| 128 navigation_controller.visibleViewController); | 128 navigation_controller.visibleViewController); |
| 129 [coordinator paymentItemsDisplayViewControllerDidReturn:view_controller]; | 129 [coordinator paymentItemsDisplayViewControllerDidReturn:view_controller]; |
| 130 | 130 |
| 131 EXPECT_OCMOCK_VERIFY(delegate); | 131 EXPECT_OCMOCK_VERIFY(delegate); |
| 132 } | 132 } |
| OLD | NEW |