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_article_item.h" | 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_i
tem.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 #if !defined(__has_feature) || !__has_feature(objc_arc) | 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
10 #error "This file requires ARC support." | 10 #error "This file requires ARC support." |
11 #endif | 11 #endif |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 // Tests that configureCell: set all the fields of the cell. | 15 // Tests that configureCell: set all the fields of the cell. |
16 TEST(SuggestionsArticleItemTest, CellIsConfigured) { | 16 TEST(ContentSuggestionsArticleItemTest, CellIsConfigured) { |
17 NSString* title = @"testTitle"; | 17 NSString* title = @"testTitle"; |
18 NSString* subtitle = @"testSubtitle"; | 18 NSString* subtitle = @"testSubtitle"; |
19 UIImage* image = [[UIImage alloc] init]; | 19 UIImage* image = [[UIImage alloc] init]; |
20 SuggestionsArticleItem* item = | 20 ContentSuggestionsArticleItem* item = |
21 [[SuggestionsArticleItem alloc] initWithType:0 | 21 [[ContentSuggestionsArticleItem alloc] initWithType:0 |
22 title:title | 22 title:title |
23 subtitle:subtitle | 23 subtitle:subtitle |
24 image:image]; | 24 image:image]; |
25 SuggestionsArticleCell* cell = [[[item cellClass] alloc] init]; | 25 ContentSuggestionsArticleCell* cell = [[[item cellClass] alloc] init]; |
26 EXPECT_TRUE([cell isMemberOfClass:[SuggestionsArticleCell class]]); | 26 EXPECT_EQ([ContentSuggestionsArticleCell class], [cell class]); |
27 | 27 |
28 [item configureCell:cell]; | 28 [item configureCell:cell]; |
29 EXPECT_EQ(title, cell.titleLabel.text); | 29 EXPECT_EQ(title, cell.titleLabel.text); |
30 EXPECT_EQ(subtitle, cell.subtitleLabel.text); | 30 EXPECT_EQ(subtitle, cell.subtitleLabel.text); |
31 EXPECT_EQ(image, cell.imageView.image); | 31 EXPECT_EQ(image, cell.imageView.image); |
32 } | 32 } |
33 | 33 |
34 } // namespace | 34 } // namespace |
OLD | NEW |