OLD | NEW |
(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/authentication/signin_promo_item.h" |
| 6 |
| 7 #import "ios/chrome/browser/ui/authentication/signin_promo_view.h" |
| 8 #import "testing/gtest_mac.h" |
| 9 #import "third_party/ocmock/OCMock/OCMock.h" |
| 10 #include "third_party/ocmock/gtest_support.h" |
| 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 16 // Tests that SigninPromoItem creates and configures correctly SigninPromoCell. |
| 17 TEST(SigninPromoItemTest, ConfigureCell) { |
| 18 id<SigninPromoViewConfigurator> configurator = |
| 19 OCMStrictProtocolMock(@protocol(SigninPromoViewConfigurator)); |
| 20 SigninPromoItem* item = |
| 21 [[SigninPromoItem alloc] initWithType:0 configurator:configurator]; |
| 22 |
| 23 id cell = [[[item cellClass] alloc] init]; |
| 24 ASSERT_TRUE([cell isMemberOfClass:[SigninPromoCell class]]); |
| 25 |
| 26 SigninPromoCell* signInCell = cell; |
| 27 EXPECT_NE(nil, signInCell.signinPromoView); |
| 28 EXPECT_TRUE( |
| 29 [signInCell.signinPromoView isMemberOfClass:[SigninPromoView class]]); |
| 30 SigninPromoView* signinPromoView = signInCell.signinPromoView; |
| 31 OCMExpect([configurator configureSigninPromoView:signinPromoView]); |
| 32 [item configureCell:signInCell]; |
| 33 EXPECT_NE(nil, signinPromoView.textLabel.text); |
| 34 EXPECT_OCMOCK_VERIFY(configurator); |
| 35 } |
OLD | NEW |