Index: ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm |
diff --git a/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9812c38bc7893b6142805904c39f2a66de7a1ac9 |
--- /dev/null |
+++ b/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm |
@@ -0,0 +1,36 @@ |
+// 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/settings/cells/encryption_item.h" |
+ |
+#include "testing/gtest/include/gtest/gtest.h" |
+#include "testing/gtest_mac.h" |
+ |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+namespace { |
+ |
+// Tests that the text label, enabled status and accessory type are set properly |
+// after a call to |configureCell:|. |
+TEST(EncryptionItemTest, ConfigureCell) { |
+ EncryptionItem* item = [[EncryptionItem alloc] initWithType:0]; |
+ EncryptionCell* cell = [[[item cellClass] alloc] init]; |
+ EXPECT_TRUE([cell isMemberOfClass:[EncryptionCell class]]); |
+ EXPECT_NSEQ(nil, cell.textLabel.text); |
+ NSString* text = @"Test text"; |
+ UIColor* enabledColor = cell.textLabel.textColor; |
+ |
+ item.text = text; |
+ item.enabled = NO; |
+ item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; |
+ [item configureCell:cell]; |
+ |
+ EXPECT_NSEQ(text, cell.textLabel.text); |
+ EXPECT_NE(enabledColor, cell.textLabel.textColor); |
+ EXPECT_EQ(MDCCollectionViewCellAccessoryCheckmark, cell.accessoryType); |
+} |
+ |
+} // namespace |