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

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

Issue 2686623007: [ObjC ARC] Converts ios/chrome/browser/ui/ntp:unit_tests to ARC. (Closed)
Patch Set: 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 2016 The Chromium Authors. All rights reserved. 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 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 #include "base/mac/scoped_nsobject.h"
6 #import "ios/chrome/browser/ui/ntp/most_visited_cell.h" 5 #import "ios/chrome/browser/ui/ntp/most_visited_cell.h"
7 #include "testing/platform_test.h" 6 #include "testing/platform_test.h"
8 7
8 #if !defined(__has_feature) || !__has_feature(objc_arc)
9 #error "This file requires ARC support."
10 #endif
11
9 static NSString* title = @"Most Visited Cell Title"; 12 static NSString* title = @"Most Visited Cell Title";
10 const GURL URL = GURL("http://example.com"); 13 const GURL URL = GURL("http://example.com");
11 14
12 // Fixture to test MostVisitedCell. 15 // Fixture to test MostVisitedCell.
13 class MostVisitedCellTest : public PlatformTest { 16 class MostVisitedCellTest : public PlatformTest {
14 protected: 17 protected:
15 base::scoped_nsobject<MostVisitedCell> cell_; 18 MostVisitedCell* cell_;
16 }; 19 };
17 20
18 TEST_F(MostVisitedCellTest, TestConstructor) { 21 TEST_F(MostVisitedCellTest, TestConstructor) {
19 CGRect rect = CGRectMake(0, 0, 100, 100); 22 CGRect rect = CGRectMake(0, 0, 100, 100);
20 cell_.reset([[MostVisitedCell alloc] initWithFrame:rect]); 23 cell_ = [[MostVisitedCell alloc] initWithFrame:rect];
21 [cell_ setURL:URL]; 24 [cell_ setURL:URL];
22 EXPECT_TRUE(cell_.get()); 25 EXPECT_TRUE(cell_);
23 UIGraphicsBeginImageContext([cell_ bounds].size); 26 UIGraphicsBeginImageContext([cell_ bounds].size);
24 [cell_ drawRect:[cell_ bounds]]; 27 [cell_ drawRect:[cell_ bounds]];
25 UIGraphicsEndImageContext(); 28 UIGraphicsEndImageContext();
26 EXPECT_EQ(URL, [cell_ URL]); 29 EXPECT_EQ(URL, [cell_ URL]);
27 } 30 }
28 31
29 TEST_F(MostVisitedCellTest, ValidateTitle) { 32 TEST_F(MostVisitedCellTest, ValidateTitle) {
30 CGRect rect = CGRectMake(0, 0, 100, 100); 33 CGRect rect = CGRectMake(0, 0, 100, 100);
31 cell_.reset([[MostVisitedCell alloc] initWithFrame:rect]); 34 cell_ = [[MostVisitedCell alloc] initWithFrame:rect];
32 [cell_ setText:title]; 35 [cell_ setText:title];
33 EXPECT_EQ(title, [cell_ accessibilityLabel]); 36 EXPECT_EQ(title, [cell_ accessibilityLabel]);
34 } 37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698