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

Side by Side Diff: ios/chrome/browser/ui/bookmarks/cells/bookmark_text_field_item_unittest.mm

Issue 2588713002: Upstream Chrome on iOS source code [4/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 #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_text_field_item.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "testing/gtest_mac.h"
9 #include "third_party/ocmock/OCMock/OCMock.h"
10
11 #if !defined(__has_feature) || !__has_feature(objc_arc)
12 #error "This file requires ARC support."
13 #endif
14
15 namespace {
16
17 TEST(BookmarkTextFieldItemTest, DelegateGetsTextFieldEvents) {
18 BookmarkTextFieldItem* item = [[BookmarkTextFieldItem alloc] initWithType:0];
19 BookmarkTextFieldCell* cell =
20 [[BookmarkTextFieldCell alloc] initWithFrame:CGRectZero];
21 id mockDelegate =
22 [OCMockObject mockForProtocol:@protocol(BookmarkTextFieldItemDelegate)];
23
24 item.delegate = mockDelegate;
25 [item configureCell:cell];
26 EXPECT_EQ(mockDelegate, cell.textField.delegate);
27
28 [[mockDelegate expect] textDidChangeForItem:item];
29 cell.textField.text = @"Foo";
30 }
31
32 TEST(BookmarkTextFieldItemTest, TextFieldGetsText) {
33 BookmarkTextFieldItem* item = [[BookmarkTextFieldItem alloc] initWithType:0];
34 BookmarkTextFieldCell* cell =
35 [[BookmarkTextFieldCell alloc] initWithFrame:CGRectZero];
36
37 item.text = @"Foo";
38 [item configureCell:cell];
39 EXPECT_NSEQ(@"Foo", cell.textField.text);
40 }
41
42 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698