diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-15 21:58:24 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-15 21:58:24 +0000 |
commit | 4a582032795a0681eaec01a1af4f59972cfe1214 (patch) | |
tree | 094a4ca9b809c4a14586349ed58f859c9b060d6a | |
parent | f54af0416c4462df0cdb8b05f807262acb9f1016 (diff) | |
download | chromium_src-4a582032795a0681eaec01a1af4f59972cfe1214.zip chromium_src-4a582032795a0681eaec01a1af4f59972cfe1214.tar.gz chromium_src-4a582032795a0681eaec01a1af4f59972cfe1214.tar.bz2 |
Have any open folder menu go away if the bookmark bar is hidden.
BUG=37912
TEST=Insure the bookmark bar is showing. Click on a folder in the bookmark bar such that the folder contents are shown in a folder menu. Press <cmd-shift-B> and insure that the folder menu is withdrawn as the bookmark bar is hidden.
Review URL: http://codereview.chromium.org/887004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41642 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 1 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller_unittest.mm | 34 |
2 files changed, 34 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index b12c188..411e08a 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -1693,6 +1693,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { // Animate only if told to and if bar is enabled. if (animate && barIsEnabled_) { + [self closeAllBookmarkFolders]; // Take care of any animation cases we know how to handle. // We know how to handle hidden <-> normal, normal <-> detached.... diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index 1c1ddc7..d0ce683 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -108,7 +108,6 @@ @end - class FakeTheme : public ThemeProvider { public: FakeTheme(NSColor* color) : color_(color) { } @@ -1192,6 +1191,39 @@ TEST_F(BookmarkBarControllerTest, DropDestination) { } } +TEST_F(BookmarkBarControllerTest, CloseFolderOnAnimate) { + BookmarkModel* model = helper_.profile()->GetBookmarkModel(); + const BookmarkNode* parent = model->GetBookmarkBarNode(); + const BookmarkNode* folder = model->AddGroup(parent, + parent->GetChildCount(), + L"group"); + model->AddGroup(parent, parent->GetChildCount(), + L"sibbling group"); + model->AddURL(folder, folder->GetChildCount(), L"title a", + GURL("http://www.google.com/a")); + model->AddURL(folder, folder->GetChildCount(), + L"title super duper long long whoa momma title you betcha", + GURL("http://www.google.com/b")); + BookmarkButton* button = [[bar_ buttons] objectAtIndex:0]; + EXPECT_FALSE([bar_ folderController]); + [bar_ openBookmarkFolderFromButton:button]; + BookmarkBarFolderController* bbfc = [bar_ folderController]; + // The following tells us that the folder menu is showing. We want to make + // sure the folder menu goes away if the bookmark bar is hidden. + EXPECT_TRUE(bbfc); + EXPECT_TRUE([bar_ isVisible]); + + // Hide the bookmark bar. + [bar_ updateAndShowNormalBar:NO + showDetachedBar:YES + withAnimation:YES]; + EXPECT_TRUE([bar_ isAnimationRunning]); + + // Now that we've closed the bookmark bar (with animation) the folder menu + // should have been closed thus releasing the folderController. + EXPECT_FALSE([bar_ folderController]); +} + class BookmarkBarControllerNotificationTest : public CocoaTest { public: BookmarkBarControllerNotificationTest() { |