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

Unified Diff: ios/chrome/browser/ui/alert_coordinator/input_alert_coordinator_unittest.mm

Issue 2167683002: Creates coordinator for ActionSheet and TextInput (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@alertCoordinator
Patch Set: Keep message property Created 4 years, 5 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/alert_coordinator/input_alert_coordinator_unittest.mm
diff --git a/ios/chrome/browser/ui/alert_coordinator/input_alert_coordinator_unittest.mm b/ios/chrome/browser/ui/alert_coordinator/input_alert_coordinator_unittest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..4aebd39a8a443ad7622e00ba59ff654aae16d283
--- /dev/null
+++ b/ios/chrome/browser/ui/alert_coordinator/input_alert_coordinator_unittest.mm
@@ -0,0 +1,53 @@
+// 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.
+
+#import "ios/chrome/browser/ui/alert_coordinator/input_alert_coordinator.h"
+
+#include "testing/platform_test.h"
+#import "third_party/ocmock/OCMock/OCMock.h"
+#include "third_party/ocmock/gtest_support.h"
+
+TEST(InputAlertCoordinatorTest, AddTextField) {
+ // Setup.
+ UIViewController* viewController =
+ [[[UIViewController alloc] init] autorelease];
+ InputAlertCoordinator* alertCoordinator = [[[InputAlertCoordinator alloc]
+ initWithBaseViewController:viewController
+ title:@"Test"
+ message:nil] autorelease];
+
+ void (^emptyHandler)(UITextField* textField) = ^(UITextField* textField) {
+ };
+ id alert =
+ [OCMockObject partialMockForObject:alertCoordinator.alertController];
+ [[alert expect] addTextFieldWithConfigurationHandler:emptyHandler];
+
+ // Action.
+ [alertCoordinator addTextFieldWithConfigurationHandler:emptyHandler];
+
+ // Test.
+ EXPECT_OCMOCK_VERIFY(alert);
+}
+
+TEST(InputAlertCoordinatorTest, GetTextFields) {
+ // Setup.
+ UIViewController* viewController =
+ [[[UIViewController alloc] init] autorelease];
+ InputAlertCoordinator* alertCoordinator = [[[InputAlertCoordinator alloc]
+ initWithBaseViewController:viewController
+ title:@"Test"
+ message:nil] autorelease];
+
+ NSArray<UITextField*>* array = [NSArray array];
+ id alert =
+ [OCMockObject partialMockForObject:alertCoordinator.alertController];
+ [[[alert expect] andReturn:array] textFields];
+
+ // Action.
+ NSArray<UITextField*>* resultArray = alertCoordinator.textFields;
+
+ // Test.
+ EXPECT_EQ(array, resultArray);
+ EXPECT_OCMOCK_VERIFY(alert);
+}

Powered by Google App Engine
This is Rietveld 408576698