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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 EXPECT_EQ(2u, navigation_controller.viewControllers.count); | 45 EXPECT_EQ(2u, navigation_controller.viewControllers.count); |
46 | 46 |
47 [coordinator stop]; | 47 [coordinator stop]; |
48 // Short delay to allow animation to complete. | 48 // Short delay to allow animation to complete. |
49 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); | 49 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0)); |
50 EXPECT_EQ(1u, navigation_controller.viewControllers.count); | 50 EXPECT_EQ(1u, navigation_controller.viewControllers.count); |
51 } | 51 } |
52 | 52 |
53 // Tests that calling the view controller delegate method which notifies the | 53 // Tests that calling the view controller delegate method which notifies the |
54 // coordinator that the user has confirmed the payment request invokes the | 54 // coordinator that the user has confirmed the payment request invokes the |
55 // the corresponding coordinator delegate method. | 55 // corresponding coordinator delegate method. |
56 TEST(PaymentItemsDisplayCoordinatorTest, DidConfirm) { | 56 TEST(PaymentItemsDisplayCoordinatorTest, DidConfirm) { |
57 std::unique_ptr<PaymentRequest> payment_request = | 57 std::unique_ptr<PaymentRequest> payment_request = |
58 payment_request_test_util::CreateTestPaymentRequest(); | 58 payment_request_test_util::CreateTestPaymentRequest(); |
59 | 59 |
60 UIViewController* base_view_controller = | 60 UIViewController* base_view_controller = |
61 [[[UIViewController alloc] init] autorelease]; | 61 [[[UIViewController alloc] init] autorelease]; |
62 UINavigationController* navigation_controller = | 62 UINavigationController* navigation_controller = |
63 [[[UINavigationController alloc] | 63 [[[UINavigationController alloc] |
64 initWithRootViewController:base_view_controller] autorelease]; | 64 initWithRootViewController:base_view_controller] autorelease]; |
65 | 65 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 EXPECT_EQ(2u, navigation_controller.viewControllers.count); | 122 EXPECT_EQ(2u, navigation_controller.viewControllers.count); |
123 | 123 |
124 // Call the controller delegate method. | 124 // Call the controller delegate method. |
125 PaymentItemsDisplayViewController* view_controller = | 125 PaymentItemsDisplayViewController* view_controller = |
126 base::mac::ObjCCastStrict<PaymentItemsDisplayViewController>( | 126 base::mac::ObjCCastStrict<PaymentItemsDisplayViewController>( |
127 navigation_controller.visibleViewController); | 127 navigation_controller.visibleViewController); |
128 [coordinator paymentItemsDisplayViewControllerDidReturn:view_controller]; | 128 [coordinator paymentItemsDisplayViewControllerDidReturn:view_controller]; |
129 | 129 |
130 EXPECT_OCMOCK_VERIFY(delegate); | 130 EXPECT_OCMOCK_VERIFY(delegate); |
131 } | 131 } |
OLD | NEW |