| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/ui/suggestions/suggestions_item.h" | 5 #import "ios/chrome/browser/ui/suggestions/suggestions_item.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
| 10 namespace { | 13 namespace { |
| 11 | 14 |
| 12 // Tests that configureCell: set all the fields of the cell. | 15 // Tests that configureCell: set all the fields of the cell. |
| 13 TEST(SuggestionsItemTest, CellIsConfigured) { | 16 TEST(SuggestionsItemTest, CellIsConfigured) { |
| 14 NSString* title = @"testTitle"; | 17 NSString* title = @"testTitle"; |
| 15 NSString* subtitle = @"testSubtitle"; | 18 NSString* subtitle = @"testSubtitle"; |
| 16 SuggestionsItem* item = | 19 SuggestionsItem* item = |
| 17 [[SuggestionsItem alloc] initWithType:0 title:title subtitle:subtitle]; | 20 [[SuggestionsItem alloc] initWithType:0 title:title subtitle:subtitle]; |
| 18 SuggestionsCell* cell = [[[item cellClass] alloc] init]; | 21 SuggestionsCell* cell = [[[item cellClass] alloc] init]; |
| 19 EXPECT_TRUE([cell isMemberOfClass:[SuggestionsCell class]]); | 22 EXPECT_TRUE([cell isMemberOfClass:[SuggestionsCell class]]); |
| 20 | 23 |
| 21 [item configureCell:cell]; | 24 [item configureCell:cell]; |
| 22 EXPECT_EQ(title, [cell.titleButton titleForState:UIControlStateNormal]); | 25 EXPECT_EQ(title, [cell.titleButton titleForState:UIControlStateNormal]); |
| 23 EXPECT_EQ(subtitle, cell.detailTextLabel.text); | 26 EXPECT_EQ(subtitle, cell.detailTextLabel.text); |
| 24 } | 27 } |
| 25 | 28 |
| 26 } // namespace | 29 } // namespace |
| OLD | NEW |