| Index: ios/chrome/browser/ui/payments/country_selection_coordinator_unittest.mm
|
| diff --git a/ios/chrome/browser/ui/payments/country_selection_coordinator_unittest.mm b/ios/chrome/browser/ui/payments/country_selection_coordinator_unittest.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..646c547396a26ddd8e90c8d279b0ddc164a6e5a8
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/ui/payments/country_selection_coordinator_unittest.mm
|
| @@ -0,0 +1,38 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#import "ios/chrome/browser/ui/payments/country_selection_coordinator.h"
|
| +
|
| +#include "base/mac/foundation_util.h"
|
| +#include "base/memory/ptr_util.h"
|
| +#include "base/test/ios/wait_util.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +#include "testing/platform_test.h"
|
| +
|
| +class PaymentRequestCountrySelectionCoordinatorTest : public PlatformTest {};
|
| +
|
| +// Tests that invoking start and stop on the coordinator presents and dismisses
|
| +// the payment request picker view controller, respectively.
|
| +TEST_F(PaymentRequestCountrySelectionCoordinatorTest, StartAndStop) {
|
| + UIViewController* base_view_controller = [[UIViewController alloc] init];
|
| + UINavigationController* navigation_controller =
|
| + [[UINavigationController alloc]
|
| + initWithRootViewController:base_view_controller];
|
| +
|
| + CountrySelectionCoordinator* coordinator =
|
| + [[CountrySelectionCoordinator alloc]
|
| + initWithBaseViewController:base_view_controller];
|
| +
|
| + EXPECT_EQ(1u, navigation_controller.viewControllers.count);
|
| +
|
| + [coordinator start];
|
| + // Short delay to allow animation to complete.
|
| + base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0));
|
| + EXPECT_EQ(2u, navigation_controller.viewControllers.count);
|
| +
|
| + [coordinator stop];
|
| + // Short delay to allow animation to complete.
|
| + base::test::ios::SpinRunLoopWithMaxDelay(base::TimeDelta::FromSecondsD(1.0));
|
| + EXPECT_EQ(1u, navigation_controller.viewControllers.count);
|
| +}
|
|
|