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