OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
9 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 9 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 11 #include "chrome/browser/ui/cocoa/l10n_util.h" |
11 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
12 #include "components/bookmarks/browser/bookmark_model.h" | 13 #include "components/bookmarks/browser/bookmark_model.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 #include "ui/base/material_design/material_design_controller.h" | 16 #include "ui/base/material_design/material_design_controller.h" |
16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
18 #include "ui/resources/grit/ui_resources.h" | 19 #include "ui/resources/grit/ui_resources.h" |
19 | 20 |
20 using bookmarks::BookmarkModel; | 21 using bookmarks::BookmarkModel; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 [cell mouseExited:event]; | 149 [cell mouseExited:event]; |
149 EXPECT_EQ(button.get()->enters_, 1); | 150 EXPECT_EQ(button.get()->enters_, 1); |
150 EXPECT_EQ(button.get()->exits_, 3); | 151 EXPECT_EQ(button.get()->exits_, 3); |
151 } | 152 } |
152 | 153 |
153 // Confirms a cell created in a nib is initialized properly | 154 // Confirms a cell created in a nib is initialized properly |
154 TEST_F(BookmarkButtonCellTest, Awake) { | 155 TEST_F(BookmarkButtonCellTest, Awake) { |
155 base::scoped_nsobject<BookmarkButtonCell> cell( | 156 base::scoped_nsobject<BookmarkButtonCell> cell( |
156 [[BookmarkButtonCell alloc] init]); | 157 [[BookmarkButtonCell alloc] init]); |
157 [cell awakeFromNib]; | 158 [cell awakeFromNib]; |
158 EXPECT_EQ(NSLeftTextAlignment, [cell alignment]); | 159 EXPECT_EQ(NSNaturalTextAlignment, [cell alignment]); |
159 } | 160 } |
160 | 161 |
161 // Subfolder arrow details. | 162 // Subfolder arrow details. |
162 TEST_F(BookmarkButtonCellTest, FolderArrow) { | 163 TEST_F(BookmarkButtonCellTest, FolderArrow) { |
163 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile()); | 164 BookmarkModel* model = BookmarkModelFactory::GetForBrowserContext(profile()); |
164 const BookmarkNode* bar = model->bookmark_bar_node(); | 165 const BookmarkNode* bar = model->bookmark_bar_node(); |
165 const BookmarkNode* node = model->AddURL(bar, bar->child_count(), | 166 const BookmarkNode* node = model->AddURL(bar, bar->child_count(), |
166 base::ASCIIToUTF16("title"), | 167 base::ASCIIToUTF16("title"), |
167 GURL("http://www.google.com")); | 168 GURL("http://www.google.com")); |
168 base::scoped_nsobject<BookmarkButtonCell> cell( | 169 base::scoped_nsobject<BookmarkButtonCell> cell( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ASSERT_TRUE(bookmark_cell.get()); | 203 ASSERT_TRUE(bookmark_cell.get()); |
203 | 204 |
204 EXPECT_EQ(1, [gradient_cell verticalTextOffset]); | 205 EXPECT_EQ(1, [gradient_cell verticalTextOffset]); |
205 EXPECT_EQ(-1, [bookmark_cell verticalTextOffset]); | 206 EXPECT_EQ(-1, [bookmark_cell verticalTextOffset]); |
206 | 207 |
207 EXPECT_NE([bookmark_cell verticalTextOffset], | 208 EXPECT_NE([bookmark_cell verticalTextOffset], |
208 [gradient_cell verticalTextOffset]); | 209 [gradient_cell verticalTextOffset]); |
209 } | 210 } |
210 | 211 |
211 } // namespace | 212 } // namespace |
OLD | NEW |