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

Side by Side Diff: ios/chrome/browser/ui/settings/cells/signin_promo_item_unittest.mm

Issue 2749703003: Adding mediator for Sign-in promo (Closed)
Patch Set: Update tests Created 3 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/chrome/browser/ui/settings/cells/signin_promo_item.h"
6
7 #import <CoreGraphics/CoreGraphics.h>
8 #import <UIKit/UIKit.h>
9
10 #import "ios/third_party/material_components_ios/src/components/Buttons/src/Mate rialButtons.h"
11 #import "testing/gtest_mac.h"
12
13 #if !defined(__has_feature) || !__has_feature(objc_arc)
14 #error "This file requires ARC support."
15 #endif
16
17 // Tests that the profile image, the profile name and the profile email are set
18 // properly after a call to |configureCell:|.
19 TEST(SigninPromoItemTest, ConfigureCell) {
20 SigninPromoItem* item = [[SigninPromoItem alloc] initWithType:0];
21 UIImage* image = [[UIImage alloc] init];
22
23 item.profileImage = image;
24 item.profileName = @"John Doe";
25 item.profileEmail = @"johndoe@gmail.com";
26
27 id cell = [[[item cellClass] alloc] init];
28 ASSERT_TRUE([cell isMemberOfClass:[SigninPromoCell class]]);
29
30 SigninPromoCell* signInCell = cell;
31 EXPECT_FALSE(signInCell.imageView.image);
32
33 [item configureCell:signInCell];
34
35 EXPECT_NSEQ(image, signInCell.imageView.image);
36 NSString* upperCaseProfileName = [item.profileName uppercaseString];
37 NSRange profileNameRange = [signInCell.signinButton.titleLabel.text
38 rangeOfString:upperCaseProfileName];
39 EXPECT_NE(profileNameRange.length, 0u);
40 NSRange profileEmailRange =
41 [signInCell.notMeButton.titleLabel.text rangeOfString:item.profileEmail];
42 EXPECT_NE(profileEmailRange.length, 0u);
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698