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