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