OLD | NEW |
1 // Copyright 2016 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 #include "base/test/ios/wait_util.h" | 5 #include "base/test/ios/wait_util.h" |
6 #import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h" | 6 #import "ios/chrome/browser/payments/shipping_option_selection_coordinator.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
11 // Tests that invoking start and stop on the coordinator presents and dismisses | 11 // Tests that invoking start and stop on the coordinator presents and dismisses |
12 // the ShippingAddressSelectionViewController, respectively. | 12 // the ShippingOptionSelectionViewController, respectively. |
13 TEST(ShippingAddressSelectionCoordinatorTest, StartAndStop) { | 13 TEST(ShippingOptionSelectionCoordinatorTest, StartAndStop) { |
14 @autoreleasepool { | 14 @autoreleasepool { |
15 UIViewController* base_view_controller = | 15 UIViewController* base_view_controller = |
16 [[[UIViewController alloc] init] autorelease]; | 16 [[[UIViewController alloc] init] autorelease]; |
17 UINavigationController* navigation_controller = | 17 UINavigationController* navigation_controller = |
18 [[[UINavigationController alloc] | 18 [[[UINavigationController alloc] |
19 initWithRootViewController:base_view_controller] autorelease]; | 19 initWithRootViewController:base_view_controller] autorelease]; |
20 ShippingAddressSelectionCoordinator* coordinator = | 20 ShippingOptionSelectionCoordinator* coordinator = |
21 [[[ShippingAddressSelectionCoordinator alloc] | 21 [[[ShippingOptionSelectionCoordinator alloc] |
22 initWithBaseViewController:base_view_controller] autorelease]; | 22 initWithBaseViewController:base_view_controller] autorelease]; |
23 | 23 |
24 EXPECT_EQ(1u, [navigation_controller.viewControllers count]); | 24 EXPECT_EQ(1u, [navigation_controller.viewControllers count]); |
25 | 25 |
26 [coordinator start]; | 26 [coordinator start]; |
27 // Short delay to allow animation to complete. | 27 // Short delay to allow animation to complete. |
28 base::test::ios::SpinRunLoopWithMaxDelay( | 28 base::test::ios::SpinRunLoopWithMaxDelay( |
29 base::TimeDelta::FromSecondsD(1.0)); | 29 base::TimeDelta::FromSecondsD(1.0)); |
30 EXPECT_EQ(2u, [navigation_controller.viewControllers count]); | 30 EXPECT_EQ(2u, [navigation_controller.viewControllers count]); |
31 | 31 |
32 [coordinator stop]; | 32 [coordinator stop]; |
33 // Short delay to allow animation to complete. | 33 // Short delay to allow animation to complete. |
34 base::test::ios::SpinRunLoopWithMaxDelay( | 34 base::test::ios::SpinRunLoopWithMaxDelay( |
35 base::TimeDelta::FromSecondsD(1.0)); | 35 base::TimeDelta::FromSecondsD(1.0)); |
36 EXPECT_EQ(1u, [navigation_controller.viewControllers count]); | 36 EXPECT_EQ(1u, [navigation_controller.viewControllers count]); |
37 } | 37 } |
38 } | 38 } |
39 } | 39 |
| 40 } // namespace |
OLD | NEW |