Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / bookmarks / bookmark_tree_browser_cell_unittest.mm
blob7450904724e85b6a742482b454c0ea98ad9bdb7f
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 #include "chrome/browser/bookmarks/bookmark_model.h"
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_tree_browser_cell.h"
10 #include "testing/platform_test.h"
12 class BookmarkTreeBrowserCellTest : public PlatformTest {
13  public:
14   BookmarkTreeBrowserCellTest() {
15     // Set up our mocks.
16     GURL gurl;
17     bookmarkNodeMock_.reset(new BookmarkNode(gurl));
18     matrixMock_.reset([[NSMatrix alloc] init]);
19     targetMock_.reset([[NSObject alloc] init]);
20   }
22   scoped_ptr<BookmarkNode> bookmarkNodeMock_;
23   base::scoped_nsobject<NSMatrix> matrixMock_;
24   base::scoped_nsobject<NSObject> targetMock_;
27 TEST_F(BookmarkTreeBrowserCellTest, BasicAllocDealloc) {
28   BookmarkTreeBrowserCell* cell = [[[BookmarkTreeBrowserCell alloc]
29                                     initTextCell:@"TEST STRING"] autorelease];
30   [cell setMatrix:matrixMock_.get()];
31   [cell setTarget:targetMock_.get()];
32   [cell setAction:@selector(mockAction:)];
33   [cell setBookmarkNode:bookmarkNodeMock_.get()];
35   NSMatrix* testMatrix = [cell matrix];
36   EXPECT_EQ(testMatrix, matrixMock_.get());
37   id testTarget = [cell target];
38   EXPECT_EQ(testTarget, targetMock_.get());
39   SEL testAction = [cell action];
40   EXPECT_EQ(testAction, @selector(mockAction:));
41   const BookmarkNode* testBookmarkNode = [cell bookmarkNode];
42   EXPECT_EQ(testBookmarkNode, bookmarkNodeMock_.get());