OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/memory/scoped_nsobject.h" | 5 #include "base/memory/scoped_nsobject.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/bookmarks/bookmark_model.h" | 7 #include "chrome/browser/bookmarks/bookmark_model.h" |
8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" | 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" |
10 #include "chrome/browser/ui/cocoa/browser_test_helper.h" | 10 #include "chrome/browser/ui/cocoa/browser_test_helper.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 EXPECT_EQ(button.get()->exits_, 3); | 147 EXPECT_EQ(button.get()->exits_, 3); |
148 } | 148 } |
149 | 149 |
150 // Confirms a cell created in a nib is initialized properly | 150 // Confirms a cell created in a nib is initialized properly |
151 TEST_F(BookmarkButtonCellTest, Awake) { | 151 TEST_F(BookmarkButtonCellTest, Awake) { |
152 scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc] init]); | 152 scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc] init]); |
153 [cell awakeFromNib]; | 153 [cell awakeFromNib]; |
154 EXPECT_EQ(NSLeftTextAlignment, [cell alignment]); | 154 EXPECT_EQ(NSLeftTextAlignment, [cell alignment]); |
155 } | 155 } |
156 | 156 |
157 // Subfolder arrow details. | |
158 TEST_F(BookmarkButtonCellTest, FolderArrow) { | |
159 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | |
160 const BookmarkNode* bar = model->bookmark_bar_node(); | |
161 const BookmarkNode* node = model->AddURL(bar, bar->child_count(), | |
162 ASCIIToUTF16("title"), | |
163 GURL("http://www.google.com")); | |
164 scoped_nsobject<BookmarkButtonCell> cell( | |
165 [[BookmarkButtonCell alloc] initForNode:node | |
166 contextMenu:nil | |
167 cellText:@"small" | |
168 cellImage:nil]); | |
169 EXPECT_TRUE(cell.get()); | |
170 | |
171 NSSize size = [cell cellSize]; | |
172 // sanity check | |
173 EXPECT_GE(size.width, 2); | |
174 EXPECT_GE(size.height, 2); | |
175 | |
176 // Once we turn on arrow drawing make sure there is now room for it. | |
177 [cell setDrawFolderArrow:YES]; | |
178 NSSize arrowSize = [cell cellSize]; | |
179 EXPECT_GT(arrowSize.width, size.width); | |
180 } | |
181 | |
182 } // namespace | 157 } // namespace |
OLD | NEW |