OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_request_coordinator.h" | 5 #import "ios/chrome/browser/payments/payment_request_coordinator.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/test/ios/wait_util.h" | 9 #include "base/test/ios/wait_util.h" |
10 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 ScopedKeyWindow scoped_key_window_; | 80 ScopedKeyWindow scoped_key_window_; |
81 [scoped_key_window_.Get() setRootViewController:base_view_controller]; | 81 [scoped_key_window_.Get() setRootViewController:base_view_controller]; |
82 | 82 |
83 PaymentRequestCoordinator* coordinator = [[PaymentRequestCoordinator alloc] | 83 PaymentRequestCoordinator* coordinator = [[PaymentRequestCoordinator alloc] |
84 initWithBaseViewController:base_view_controller]; | 84 initWithBaseViewController:base_view_controller]; |
85 [coordinator setPaymentRequest:payment_request.get()]; | 85 [coordinator setPaymentRequest:payment_request.get()]; |
86 | 86 |
87 [coordinator start]; | 87 [coordinator start]; |
88 // Short delay to allow animation to complete. | 88 // Short delay to allow animation to complete. |
89 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1)); | 89 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1)); |
90 id persented_view_controller = | 90 id presented_view_controller = |
91 [coordinator baseViewController].presentedViewController; | 91 [coordinator baseViewController].presentedViewController; |
92 EXPECT_TRUE([persented_view_controller | 92 EXPECT_TRUE([presented_view_controller |
93 isMemberOfClass:[UINavigationController class]]); | 93 isMemberOfClass:[UINavigationController class]]); |
94 UINavigationController* navigation_controller = | 94 UINavigationController* navigation_controller = |
95 base::mac::ObjCCastStrict<UINavigationController>( | 95 base::mac::ObjCCastStrict<UINavigationController>( |
96 persented_view_controller); | 96 presented_view_controller); |
97 EXPECT_EQ(1u, navigation_controller.viewControllers.count); | 97 EXPECT_EQ(1u, navigation_controller.viewControllers.count); |
98 id view_controller = navigation_controller.visibleViewController; | 98 id view_controller = navigation_controller.visibleViewController; |
99 EXPECT_TRUE( | 99 EXPECT_TRUE( |
100 [view_controller isMemberOfClass:[PaymentRequestViewController class]]); | 100 [view_controller isMemberOfClass:[PaymentRequestViewController class]]); |
101 | 101 |
102 [coordinator stop]; | 102 [coordinator stop]; |
103 // Delay to allow animation to complete. | 103 // Delay to allow animation to complete. |
104 base::test::ios::SpinRunLoopWithMinDelay(base::TimeDelta::FromSecondsD(2)); | 104 base::test::ios::SpinRunLoopWithMinDelay(base::TimeDelta::FromSecondsD(2)); |
105 | 105 |
106 EXPECT_EQ(nil, [coordinator baseViewController].presentedViewController); | 106 EXPECT_EQ(nil, [coordinator baseViewController].presentedViewController); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 }]; | 269 }]; |
270 [coordinator setDelegate:delegate_mock]; | 270 [coordinator setDelegate:delegate_mock]; |
271 | 271 |
272 [coordinator start]; | 272 [coordinator start]; |
273 // Short delay to allow animation to complete. | 273 // Short delay to allow animation to complete. |
274 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1)); | 274 base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1)); |
275 | 275 |
276 // Call the controller delegate method. | 276 // Call the controller delegate method. |
277 [coordinator paymentRequestViewControllerDidCancel:nil]; | 277 [coordinator paymentRequestViewControllerDidCancel:nil]; |
278 } | 278 } |
OLD | NEW |