OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/chrome/browser/ui/settings/cells/autofill_edit_item.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "testing/gtest_mac.h" |
| 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 14 namespace { |
| 15 |
| 16 // Tests that the label and text field are set properly after a call to |
| 17 // |configureCell:|. |
| 18 TEST(AutofillEditItemTest, ConfigureCell) { |
| 19 AutofillEditItem* item = [[AutofillEditItem alloc] initWithType:0]; |
| 20 NSString* name = @"Name"; |
| 21 NSString* value = @"Value"; |
| 22 BOOL enabled = NO; |
| 23 |
| 24 item.textFieldName = name; |
| 25 item.textFieldValue = value; |
| 26 item.textFieldEnabled = enabled; |
| 27 |
| 28 id cell = [[[item cellClass] alloc] init]; |
| 29 ASSERT_TRUE([cell isMemberOfClass:[AutofillEditCell class]]); |
| 30 |
| 31 AutofillEditCell* autofillEditCell = cell; |
| 32 EXPECT_EQ(0U, autofillEditCell.textLabel.text.length); |
| 33 EXPECT_EQ(0U, autofillEditCell.textField.text.length); |
| 34 EXPECT_TRUE(autofillEditCell.textField.enabled); |
| 35 |
| 36 [item configureCell:cell]; |
| 37 EXPECT_NSEQ(name, autofillEditCell.textLabel.text); |
| 38 EXPECT_NSEQ(value, autofillEditCell.textField.text); |
| 39 EXPECT_FALSE(autofillEditCell.textField.enabled); |
| 40 } |
| 41 |
| 42 } // namespace |
OLD | NEW |