BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / bookmarks / bookmark_tree_browser_cell_unittest.mm
blob48a70b8b836b4a1d3a60659ae6f8b8c1ec58be42
1 // Copyright (c) 2011 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.
5 #import <Cocoa/Cocoa.h>
7 #import "base/mac/scoped_nsobject.h"
8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_tree_browser_cell.h"
9 #include "components/bookmarks/browser/bookmark_model.h"
10 #include "testing/platform_test.h"
12 using bookmarks::BookmarkNode;
14 class BookmarkTreeBrowserCellTest : public PlatformTest {
15  public:
16   BookmarkTreeBrowserCellTest() {
17     // Set up our mocks.
18     GURL gurl;
19     bookmarkNodeMock_.reset(new BookmarkNode(gurl));
20     matrixMock_.reset([[NSMatrix alloc] init]);
21     targetMock_.reset([[NSObject alloc] init]);
22   }
24   scoped_ptr<BookmarkNode> bookmarkNodeMock_;
25   base::scoped_nsobject<NSMatrix> matrixMock_;
26   base::scoped_nsobject<NSObject> targetMock_;
29 TEST_F(BookmarkTreeBrowserCellTest, BasicAllocDealloc) {
30   BookmarkTreeBrowserCell* cell = [[[BookmarkTreeBrowserCell alloc]
31                                     initTextCell:@"TEST STRING"] autorelease];
32   [cell setMatrix:matrixMock_.get()];
33   [cell setTarget:targetMock_.get()];
34   [cell setAction:@selector(mockAction:)];
35   [cell setBookmarkNode:bookmarkNodeMock_.get()];
37   NSMatrix* testMatrix = [cell matrix];
38   EXPECT_EQ(testMatrix, matrixMock_.get());
39   id testTarget = [cell target];
40   EXPECT_EQ(testTarget, targetMock_.get());
41   SEL testAction = [cell action];
42   EXPECT_EQ(testAction, @selector(mockAction:));
43   const BookmarkNode* testBookmarkNode = [cell bookmarkNode];
44   EXPECT_EQ(testBookmarkNode, bookmarkNodeMock_.get());