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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/mac/scoped_nsobject.h" | 6 #include "base/mac/scoped_nsobject.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" | 9 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" |
10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 [[buttons objectAtIndex:i+1] frame])); | 234 [[buttons objectAtIndex:i+1] frame])); |
235 } | 235 } |
236 Class cellClass = [BookmarkBarFolderButtonCell class]; | 236 Class cellClass = [BookmarkBarFolderButtonCell class]; |
237 for (BookmarkButton* button in buttons) { | 237 for (BookmarkButton* button in buttons) { |
238 NSRect r = [[bbfc folderView] convertRect:[button frame] fromView:button]; | 238 NSRect r = [[bbfc folderView] convertRect:[button frame] fromView:button]; |
239 // TODO(jrg): remove this adjustment. | 239 // TODO(jrg): remove this adjustment. |
240 NSRect bigger = NSInsetRect([[bbfc folderView] frame], -2, 0); | 240 NSRect bigger = NSInsetRect([[bbfc folderView] frame], -2, 0); |
241 EXPECT_TRUE(NSContainsRect(bigger, r)); | 241 EXPECT_TRUE(NSContainsRect(bigger, r)); |
242 EXPECT_TRUE([[button cell] isKindOfClass:cellClass]); | 242 EXPECT_TRUE([[button cell] isKindOfClass:cellClass]); |
243 } | 243 } |
244 | |
245 // Confirm folder buttons have no tooltip. The important thing | |
246 // really is that we insure folders and non-folders are treated | |
247 // differently; not sure of any other generic way to do this. | |
248 for (BookmarkButton* button in buttons) { | |
249 if ([button isFolder]) | |
250 EXPECT_FALSE([button toolTip]); | |
251 else | |
252 EXPECT_TRUE([button toolTip]); | |
253 } | |
254 } | 244 } |
255 | 245 |
256 // Make sure closing of the window releases the controller. | 246 // Make sure closing of the window releases the controller. |
257 // (e.g. valgrind shouldn't complain if we do this). | 247 // (e.g. valgrind shouldn't complain if we do this). |
258 TEST_F(BookmarkBarFolderControllerTest, ReleaseOnClose) { | 248 TEST_F(BookmarkBarFolderControllerTest, ReleaseOnClose) { |
259 base::scoped_nsobject<BookmarkBarFolderController> bbfc; | 249 base::scoped_nsobject<BookmarkBarFolderController> bbfc; |
260 bbfc.reset(SimpleBookmarkBarFolderController()); | 250 bbfc.reset(SimpleBookmarkBarFolderController()); |
261 EXPECT_TRUE(bbfc.get()); | 251 EXPECT_TRUE(bbfc.get()); |
262 | 252 |
263 [bbfc retain]; // stop the scoped_nsobject from doing anything | 253 [bbfc retain]; // stop the scoped_nsobject from doing anything |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 DeleteBookmark([folder parentButton], profile()); | 1666 DeleteBookmark([folder parentButton], profile()); |
1677 EXPECT_FALSE([folder folderController]); | 1667 EXPECT_FALSE([folder folderController]); |
1678 } | 1668 } |
1679 | 1669 |
1680 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so | 1670 // TODO(jrg): draggingEntered: and draggingExited: trigger timers so |
1681 // they are hard to test. Factor out "fire timers" into routines | 1671 // they are hard to test. Factor out "fire timers" into routines |
1682 // which can be overridden to fire immediately to make behavior | 1672 // which can be overridden to fire immediately to make behavior |
1683 // confirmable. | 1673 // confirmable. |
1684 // There is a similar problem with mouseEnteredButton: and | 1674 // There is a similar problem with mouseEnteredButton: and |
1685 // mouseExitedButton:. | 1675 // mouseExitedButton:. |
OLD | NEW |