OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/resource_bundle.h" | 5 #include "app/resource_bundle.h" |
6 #include "base/scoped_nsobject.h" | 6 #include "base/scoped_nsobject.h" |
| 7 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
8 #import "chrome/browser/cocoa/bookmark_button_cell.h" | 9 #import "chrome/browser/cocoa/bookmark_button_cell.h" |
9 #import "chrome/browser/cocoa/bookmark_menu.h" | 10 #import "chrome/browser/cocoa/bookmark_menu.h" |
10 #include "chrome/browser/cocoa/browser_test_helper.h" | 11 #include "chrome/browser/cocoa/browser_test_helper.h" |
11 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 12 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
12 #include "grit/app_resources.h" | 13 #include "grit/app_resources.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "testing/platform_test.h" | 15 #include "testing/platform_test.h" |
15 | 16 |
16 // Simple class to remember how many mouseEntered: and mouseExited: | 17 // Simple class to remember how many mouseEntered: and mouseExited: |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 TEST_F(BookmarkButtonCellTest, Awake) { | 152 TEST_F(BookmarkButtonCellTest, Awake) { |
152 scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc] init]); | 153 scoped_nsobject<BookmarkButtonCell> cell([[BookmarkButtonCell alloc] init]); |
153 [cell awakeFromNib]; | 154 [cell awakeFromNib]; |
154 EXPECT_EQ(NSLeftTextAlignment, [cell alignment]); | 155 EXPECT_EQ(NSLeftTextAlignment, [cell alignment]); |
155 } | 156 } |
156 | 157 |
157 // Subfolder arrow details. | 158 // Subfolder arrow details. |
158 TEST_F(BookmarkButtonCellTest, FolderArrow) { | 159 TEST_F(BookmarkButtonCellTest, FolderArrow) { |
159 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); | 160 BookmarkModel* model = helper_.profile()->GetBookmarkModel(); |
160 const BookmarkNode* bar = model->GetBookmarkBarNode(); | 161 const BookmarkNode* bar = model->GetBookmarkBarNode(); |
161 const BookmarkNode* node = model->AddURL(bar, bar->GetChildCount(), L"title", | 162 const BookmarkNode* node = model->AddURL(bar, bar->GetChildCount(), |
| 163 ASCIIToUTF16("title"), |
162 GURL("http://www.google.com")); | 164 GURL("http://www.google.com")); |
163 scoped_nsobject<BookmarkButtonCell> cell( | 165 scoped_nsobject<BookmarkButtonCell> cell( |
164 [[BookmarkButtonCell alloc] initForNode:node | 166 [[BookmarkButtonCell alloc] initForNode:node |
165 contextMenu:nil | 167 contextMenu:nil |
166 cellText:@"small" | 168 cellText:@"small" |
167 cellImage:nil]); | 169 cellImage:nil]); |
168 EXPECT_TRUE(cell.get()); | 170 EXPECT_TRUE(cell.get()); |
169 | 171 |
170 NSSize size = [cell cellSize]; | 172 NSSize size = [cell cellSize]; |
171 // sanity check | 173 // sanity check |
172 EXPECT_GE(size.width, 2); | 174 EXPECT_GE(size.width, 2); |
173 EXPECT_GE(size.height, 2); | 175 EXPECT_GE(size.height, 2); |
174 | 176 |
175 // Once we turn on arrow drawing make sure there is now room for it. | 177 // Once we turn on arrow drawing make sure there is now room for it. |
176 [cell setDrawFolderArrow:YES]; | 178 [cell setDrawFolderArrow:YES]; |
177 NSSize arrowSize = [cell cellSize]; | 179 NSSize arrowSize = [cell cellSize]; |
178 EXPECT_GT(arrowSize.width, size.width); | 180 EXPECT_GT(arrowSize.width, size.width); |
179 } | 181 } |
180 | 182 |
181 } // namespace | 183 } // namespace |
OLD | NEW |