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

Side by Side Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item_unittest.mm

Issue 2697573002: Modify article item in ContentSuggestions (Closed)
Patch Set: Fix tests Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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/content_suggestions/content_suggestions_article_i tem.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 #include "url/gurl.h"
8 9
9 #if !defined(__has_feature) || !__has_feature(objc_arc) 10 #if !defined(__has_feature) || !__has_feature(objc_arc)
10 #error "This file requires ARC support." 11 #error "This file requires ARC support."
11 #endif 12 #endif
12 13
13 namespace { 14 namespace {
14 15
15 // Tests that configureCell: set all the fields of the cell. 16 // Tests that configureCell: set all the fields of the cell.
16 TEST(ContentSuggestionsArticleItemTest, CellIsConfigured) { 17 TEST(ContentSuggestionsArticleItemTest, CellIsConfigured) {
17 NSString* title = @"testTitle"; 18 NSString* title = @"testTitle";
18 NSString* subtitle = @"testSubtitle"; 19 NSString* subtitle = @"testSubtitle";
19 UIImage* image = [[UIImage alloc] init]; 20 UIImage* image = [[UIImage alloc] init];
21 GURL url = GURL("http://chromium.org");
20 ContentSuggestionsArticleItem* item = 22 ContentSuggestionsArticleItem* item =
21 [[ContentSuggestionsArticleItem alloc] initWithType:0 23 [[ContentSuggestionsArticleItem alloc] initWithType:0
22 title:title 24 title:title
23 subtitle:subtitle 25 subtitle:subtitle
24 image:image]; 26 image:image
27 url:url];
25 ContentSuggestionsArticleCell* cell = [[[item cellClass] alloc] init]; 28 ContentSuggestionsArticleCell* cell = [[[item cellClass] alloc] init];
26 EXPECT_EQ([ContentSuggestionsArticleCell class], [cell class]); 29 EXPECT_EQ([ContentSuggestionsArticleCell class], [cell class]);
30 EXPECT_EQ(url, item.articleURL);
27 31
28 [item configureCell:cell]; 32 [item configureCell:cell];
29 EXPECT_EQ(title, cell.titleLabel.text); 33 EXPECT_EQ(title, cell.titleLabel.text);
30 EXPECT_EQ(subtitle, cell.subtitleLabel.text); 34 EXPECT_EQ(subtitle, cell.subtitleLabel.text);
31 EXPECT_EQ(image, cell.imageView.image); 35 EXPECT_EQ(image, cell.imageView.image);
32 } 36 }
33 37
34 } // namespace 38 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698