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

Unified Diff: ios/chrome/browser/payments/shipping_address_selection_coordinator_unittest.mm

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 4 years 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/payments/shipping_address_selection_coordinator_unittest.mm
diff --git a/ios/chrome/browser/payments/shipping_address_selection_coordinator_unittest.mm b/ios/chrome/browser/payments/shipping_address_selection_coordinator_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..64f17b09051de45e95abc7f745294534d78f4fb9
--- /dev/null
+++ b/ios/chrome/browser/payments/shipping_address_selection_coordinator_unittest.mm
@@ -0,0 +1,39 @@
+// Copyright 2016 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.
+
+#include "base/test/ios/wait_util.h"
+#import "ios/chrome/browser/payments/shipping_address_selection_coordinator.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+// Tests that invoking start and stop on the coordinator presents and dismisses
+// the ShippingAddressSelectionViewController, respectively.
+TEST(ShippingAddressSelectionCoordinatorTest, StartAndStop) {
+ @autoreleasepool {
+ UIViewController* base_view_controller =
+ [[[UIViewController alloc] init] autorelease];
+ UINavigationController* navigation_controller =
+ [[[UINavigationController alloc]
+ initWithRootViewController:base_view_controller] autorelease];
+ ShippingAddressSelectionCoordinator* coordinator =
+ [[[ShippingAddressSelectionCoordinator alloc]
+ initWithBaseViewController:base_view_controller] autorelease];
+
+ 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