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

Side by Side Diff: ios/chrome/browser/ui/ntp/most_visited_cell_unittest.mm

Issue 2590473002: Upstream Chrome on iOS source code [5/11]. (Closed)
Patch Set: Created 4 years 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
(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 #include "base/mac/scoped_nsobject.h"
6 #import "ios/chrome/browser/ui/ntp/most_visited_cell.h"
7 #include "testing/platform_test.h"
8
9 static NSString* title = @"Most Visited Cell Title";
10 const GURL URL = GURL("http://example.com");
11
12 // Fixture to test MostVisitedCell.
13 class MostVisitedCellTest : public PlatformTest {
14 protected:
15 base::scoped_nsobject<MostVisitedCell> cell_;
16 };
17
18 TEST_F(MostVisitedCellTest, TestConstructor) {
19 CGRect rect = CGRectMake(0, 0, 100, 100);
20 cell_.reset([[MostVisitedCell alloc] initWithFrame:rect]);
21 [cell_ setURL:URL];
22 EXPECT_TRUE(cell_.get());
23 UIGraphicsBeginImageContext([cell_ bounds].size);
24 [cell_ drawRect:[cell_ bounds]];
25 UIGraphicsEndImageContext();
26 EXPECT_EQ(URL, [cell_ URL]);
27 }
28
29 TEST_F(MostVisitedCellTest, ValidateTitle) {
30 CGRect rect = CGRectMake(0, 0, 100, 100);
31 cell_.reset([[MostVisitedCell alloc] initWithFrame:rect]);
32 [cell_ setText:title];
33 EXPECT_EQ(title, [cell_ accessibilityLabel]);
34 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/ntp/most_visited_cell.mm ('k') | ios/chrome/browser/ui/ntp/most_visited_layout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698