Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: ios/chrome/browser/ui/payments/country_selection_coordinator_unittest.mm

Issue 2896623002: [Payment Request] Country selection coordinator (Closed)
Patch Set: Addressed comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}

Powered by Google App Engine
This is Rietveld 408576698