Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm

Issue 842005: Bookmark bar menu/folder button text is left-aligned, not centered.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm
===================================================================
--- chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm (revision 41344)
+++ chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm (working copy)
@@ -38,6 +38,7 @@
public:
BrowserTestHelper helper_;
scoped_nsobject<BookmarkBarController> parentBarController_;
+ const BookmarkNode* longTitleNode_; // owned by model
BookmarkBarFolderControllerTest() {
BookmarkModel* model = helper_.profile()->GetBookmarkModel();
@@ -52,9 +53,10 @@
L"subgroup");
model->AddURL(folderA, folderA->GetChildCount(), L"title a",
GURL("http://www.google.com/a"));
- model->AddURL(folderA, folderA->GetChildCount(),
- L"title super duper long long whoa momma title you betcha",
- GURL("http://www.google.com/b"));
+ longTitleNode_ = model->AddURL(
+ folderA, folderA->GetChildCount(),
+ L"title super duper long long whoa momma title you betcha",
+ GURL("http://www.google.com/b"));
model->AddURL(folderB, folderB->GetChildCount(), L"t",
GURL("http://www.google.com/c"));
@@ -67,6 +69,13 @@
[parentBarController_ loaded:model];
}
+ // Remove the bookmark with the long title.
+ void RemoveLongTitleNode() {
+ BookmarkModel* model = helper_.profile()->GetBookmarkModel();
+ model->Remove(longTitleNode_->GetParent(),
+ longTitleNode_->GetParent()->IndexOfChild(longTitleNode_));
+ }
+
// Return a simple BookmarkBarFolderController.
BookmarkBarFolderController* SimpleBookmarkBarFolderController() {
BookmarkButton* parentButton = [[parentBarController_ buttons]
@@ -231,6 +240,25 @@
EXPECT_TRUE([bbfc childFolderWillClose]);
}
+// Make sure bookmark folders have variable widths.
+TEST_F(BookmarkBarFolderControllerTest, ChildFolderWidth) {
+ scoped_nsobject<BookmarkBarFolderController> bbfc;
+
+ bbfc.reset(SimpleBookmarkBarFolderController());
+ EXPECT_TRUE(bbfc.get());
+ CGFloat wideWidth = NSWidth([[bbfc window] frame]);
+
+ RemoveLongTitleNode();
+ bbfc.reset(SimpleBookmarkBarFolderController());
+ EXPECT_TRUE(bbfc.get());
+ CGFloat thinWidth = NSWidth([[bbfc window] frame]);
+
+ // Make sure window size changed as expected.
+ EXPECT_GT(wideWidth, thinWidth);
+}
+
+
+
// TODO(jrg): draggingEntered: and draggingExited: trigger timers so
// they are hard to test. Factor out "fire timers" into routines
// which can be overridden to fire immediately to make behavior
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_folder_controller.mm ('k') | chrome/browser/cocoa/bookmark_button_cell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698