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

Side by Side Diff: chrome/browser/cocoa/tab_controller_unittest.mm

Issue 184003: Don't show favicons or throbbers for the New Tab page on the Mac.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/tab_controller.mm ('k') | chrome/browser/cocoa/tab_strip_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/scoped_nsautorelease_pool.h" 7 #include "base/scoped_nsautorelease_pool.h"
8 #import "base/scoped_nsobject.h" 8 #import "base/scoped_nsobject.h"
9 #import "chrome/browser/cocoa/tab_controller.h" 9 #import "chrome/browser/cocoa/tab_controller.h"
10 #import "chrome/browser/cocoa/tab_controller_target.h" 10 #import "chrome/browser/cocoa/tab_controller_target.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 scoped_nsobject<TabController> controller([[TabController alloc] init]); 219 scoped_nsobject<TabController> controller([[TabController alloc] init]);
220 [[window contentView] addSubview:[controller view]]; 220 [[window contentView] addSubview:[controller view]];
221 int cap = [controller iconCapacity]; 221 int cap = [controller iconCapacity];
222 EXPECT_GT(cap, 0); 222 EXPECT_GT(cap, 0);
223 223
224 // Tab is minimum width, both icon and close box should be hidden. 224 // Tab is minimum width, both icon and close box should be hidden.
225 NSRect frame = [[controller view] frame]; 225 NSRect frame = [[controller view] frame];
226 frame.size.width = [TabController minTabWidth]; 226 frame.size.width = [TabController minTabWidth];
227 [[controller view] setFrame:frame]; 227 [[controller view] setFrame:frame];
228 EXPECT_FALSE([controller shouldShowIcon]); 228 EXPECT_FALSE([controller shouldShowIcon]);
229 EXPECT_FALSE([controller shouldShowCloseBox]); 229 EXPECT_FALSE([controller shouldShowCloseButton]);
230 230
231 // Setting the icon when tab is at min width should not show icon (bug 18359). 231 // Setting the icon when tab is at min width should not show icon (bug 18359).
232 scoped_nsobject<NSView> newIcon( 232 scoped_nsobject<NSView> newIcon(
233 [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 16, 16)]); 233 [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 16, 16)]);
234 [controller setIconView:newIcon.get()]; 234 [controller setIconView:newIcon.get()];
235 EXPECT_TRUE([newIcon isHidden]); 235 EXPECT_TRUE([newIcon isHidden]);
236 236
237 // Tab is at selected minimum width. Since it's selected, the close box 237 // Tab is at selected minimum width. Since it's selected, the close box
238 // should be visible. 238 // should be visible.
239 [controller setSelected:YES]; 239 [controller setSelected:YES];
240 frame = [[controller view] frame]; 240 frame = [[controller view] frame];
241 frame.size.width = [TabController minSelectedTabWidth]; 241 frame.size.width = [TabController minSelectedTabWidth];
242 [[controller view] setFrame:frame]; 242 [[controller view] setFrame:frame];
243 EXPECT_FALSE([controller shouldShowIcon]); 243 EXPECT_FALSE([controller shouldShowIcon]);
244 EXPECT_TRUE([newIcon isHidden]); 244 EXPECT_TRUE([newIcon isHidden]);
245 EXPECT_TRUE([controller shouldShowCloseBox]); 245 EXPECT_TRUE([controller shouldShowCloseButton]);
246 246
247 // Test expanding the tab to max width and ensure the icon and close box 247 // Test expanding the tab to max width and ensure the icon and close box
248 // get put back, even when de-selected. 248 // get put back, even when de-selected.
249 frame.size.width = [TabController maxTabWidth]; 249 frame.size.width = [TabController maxTabWidth];
250 [[controller view] setFrame:frame]; 250 [[controller view] setFrame:frame];
251 EXPECT_TRUE([controller shouldShowIcon]); 251 EXPECT_TRUE([controller shouldShowIcon]);
252 EXPECT_FALSE([newIcon isHidden]); 252 EXPECT_FALSE([newIcon isHidden]);
253 EXPECT_TRUE([controller shouldShowCloseBox]); 253 EXPECT_TRUE([controller shouldShowCloseButton]);
254 [controller setSelected:NO]; 254 [controller setSelected:NO];
255 EXPECT_TRUE([controller shouldShowIcon]); 255 EXPECT_TRUE([controller shouldShowIcon]);
256 EXPECT_TRUE([controller shouldShowCloseBox]); 256 EXPECT_TRUE([controller shouldShowCloseButton]);
257 257
258 cap = [controller iconCapacity]; 258 cap = [controller iconCapacity];
259 EXPECT_GT(cap, 0); 259 EXPECT_GT(cap, 0);
260 } 260 }
261 261
262 } // namespace 262 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/tab_controller.mm ('k') | chrome/browser/cocoa/tab_strip_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698