diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 20:58:41 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 20:58:41 +0000 |
commit | 9db1d46d0d31b0aea57099f55f4566404d2e0fd3 (patch) | |
tree | 3561c24a2944c5dceb0581952473c7c6598b0f43 /chrome | |
parent | 6e8afff24ed38abebc7537d97e1735ede5ca7755 (diff) | |
download | chromium_src-9db1d46d0d31b0aea57099f55f4566404d2e0fd3.zip chromium_src-9db1d46d0d31b0aea57099f55f4566404d2e0fd3.tar.gz chromium_src-9db1d46d0d31b0aea57099f55f4566404d2e0fd3.tar.bz2 |
Ensure we don't show the icon when setting the icon view explicitly.
BUG=18359
TEST=create a ton of tabs, tabs that are still loading or have favicons should not show the throbber/icon once the tab is too small even though it's still going. Ensure that favicons still show up when tab is correctly sized.
Review URL: http://codereview.chromium.org/174238
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/tab_controller.mm | 4 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_controller_unittest.mm | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/tab_controller.mm b/chrome/browser/cocoa/tab_controller.mm index bb9f0c3..cff9f81 100644 --- a/chrome/browser/cocoa/tab_controller.mm +++ b/chrome/browser/cocoa/tab_controller.mm @@ -58,6 +58,8 @@ // Called when the tab's nib is done loading and all outlets are hooked up. - (void)awakeFromNib { + // Ensure we don't show favicon if the tab is already too small to begin with. + [self updateVisibility]; [(id)iconView_ setImage:nsimage_cache::ImageNamed(@"nav.pdf")]; [[self view] addSubview:backgroundButton_ positioned:NSWindowBelow @@ -107,6 +109,8 @@ [iconView_ removeFromSuperview]; iconView_ = iconView; [iconView_ setFrame:currentFrame]; + // Ensure we don't show favicon if the tab is already too small to begin with. + [self updateVisibility]; [[self view] addSubview:iconView_]; } diff --git a/chrome/browser/cocoa/tab_controller_unittest.mm b/chrome/browser/cocoa/tab_controller_unittest.mm index b38ae91..cd7fdeb 100644 --- a/chrome/browser/cocoa/tab_controller_unittest.mm +++ b/chrome/browser/cocoa/tab_controller_unittest.mm @@ -228,6 +228,12 @@ TEST_F(TabControllerTest, ShouldShowIcon) { EXPECT_FALSE([controller shouldShowIcon]); EXPECT_FALSE([controller shouldShowCloseBox]); + // Setting the icon when tab is at min width should not show icon (bug 18359). + scoped_nsobject<NSView> newIcon( + [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 16, 16)]); + [controller setIconView:newIcon.get()]; + EXPECT_TRUE([newIcon isHidden]); + // Tab is at selected minimum width. Since it's selected, the close box // should be visible. [controller setSelected:YES]; @@ -235,6 +241,7 @@ TEST_F(TabControllerTest, ShouldShowIcon) { frame.size.width = [TabController minSelectedTabWidth]; [[controller view] setFrame:frame]; EXPECT_FALSE([controller shouldShowIcon]); + EXPECT_TRUE([newIcon isHidden]); EXPECT_TRUE([controller shouldShowCloseBox]); // Test expanding the tab to max width and ensure the icon and close box @@ -242,6 +249,7 @@ TEST_F(TabControllerTest, ShouldShowIcon) { frame.size.width = [TabController maxTabWidth]; [[controller view] setFrame:frame]; EXPECT_TRUE([controller shouldShowIcon]); + EXPECT_FALSE([newIcon isHidden]); EXPECT_TRUE([controller shouldShowCloseBox]); [controller setSelected:NO]; EXPECT_TRUE([controller shouldShowIcon]); |