OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/scoped_nsobject.h" | 5 #include "base/scoped_nsobject.h" |
6 #import "chrome/browser/cocoa/bookmark_button_cell.h" | 6 #import "chrome/browser/cocoa/bookmark_button_cell.h" |
7 #import "chrome/browser/cocoa/bookmark_menu.h" | 7 #import "chrome/browser/cocoa/bookmark_menu.h" |
8 #include "chrome/browser/cocoa/browser_test_helper.h" | 8 #include "chrome/browser/cocoa/browser_test_helper.h" |
9 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 EXPECT_EQ(button.get()->exits_, 3); | 114 EXPECT_EQ(button.get()->exits_, 3); |
115 } | 115 } |
116 | 116 |
117 // Confirms a cell created in a nib is initialized properly | 117 // Confirms a cell created in a nib is initialized properly |
118 TEST_F(BookmarkButtonCellTest, Awake) { | 118 TEST_F(BookmarkButtonCellTest, Awake) { |
119 scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc] init]); | 119 scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc] init]); |
120 [cell awakeFromNib]; | 120 [cell awakeFromNib]; |
121 EXPECT_EQ(NSLeftTextAlignment, [cell alignment]); | 121 EXPECT_EQ(NSLeftTextAlignment, [cell alignment]); |
122 } | 122 } |
123 | 123 |
| 124 // Subfolder arrow details. |
| 125 TEST_F(BookmarkButtonCellTest, FolderArrow) { |
| 126 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); |
| 127 const BookmarkNode* bar = model->GetBookmarkBarNode(); |
| 128 const BookmarkNode* node = model->AddURL(bar, bar->GetChildCount(), L"title", |
| 129 GURL("http://www.google.com")); |
| 130 scoped_nsobject<BookmarkButtonCell> cell( |
| 131 [[BookmarkButtonCell alloc] initForNode:node |
| 132 contextMenu:nil |
| 133 cellText:@"small" |
| 134 cellImage:nil]); |
| 135 EXPECT_TRUE(cell.get()); |
| 136 |
| 137 NSSize size = [cell cellSize]; |
| 138 // sanity check |
| 139 EXPECT_GE(size.width, 2); |
| 140 EXPECT_GE(size.height, 2); |
| 141 |
| 142 // Once we turn on arrow drawing make sure there is now room for it. |
| 143 [cell setDrawFolderArrow:YES]; |
| 144 NSSize arrowSize = [cell size]; |
| 145 EXPECT_GT(arrowSize.width, size.width); |
| 146 } |
| 147 |
124 } // namespace | 148 } // namespace |
OLD | NEW |