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

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

Issue 165499: Updates to clean up default theme and add hover states (Closed) Base URL: http://src.chromium.org/svn/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
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 #include "base/scoped_nsobject.h" 5 #include "base/scoped_nsobject.h"
6 #include "base/scoped_nsautorelease_pool.h" 6 #include "base/scoped_nsautorelease_pool.h"
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/cocoa/browser_test_helper.h" 9 #include "chrome/browser/cocoa/browser_test_helper.h"
10 #include "chrome/browser/cocoa/browser_window_controller.h" 10 #include "chrome/browser/cocoa/browser_window_controller.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 @implementation BrowserWindowControllerResizePong 173 @implementation BrowserWindowControllerResizePong
174 @end 174 @end
175 175
176 // Test to make sure resizing and relaying-out subviews works correctly. 176 // Test to make sure resizing and relaying-out subviews works correctly.
177 TEST_F(BrowserWindowControllerTest, TestResizeViews) { 177 TEST_F(BrowserWindowControllerTest, TestResizeViews) {
178 TabStripView* tabstrip = [controller_ tabStripView]; 178 TabStripView* tabstrip = [controller_ tabStripView];
179 NSView* contentView = [[tabstrip window] contentView]; 179 NSView* contentView = [[tabstrip window] contentView];
180 NSView* toolbar = [controller_ toolbarView]; 180 NSView* toolbar = [controller_ toolbarView];
181 NSView* infobar = [controller_ infoBarContainerView]; 181 NSView* infobar = [controller_ infoBarContainerView];
182 NSView* contentArea = [controller_ tabContentArea];
183 182
184 // We need to muck with the views a bit to put us in a consistent state before 183 // We need to muck with the views a bit to put us in a consistent state before
185 // we start resizing. In particular, we need to move the tab strip to be 184 // we start resizing. In particular, we need to move the tab strip to be
186 // immediately above the content area, since we layout views to be directly 185 // immediately above the content area, since we layout views to be directly
187 // under the tab strip. We also explicitly set the contentView's frame to be 186 // under the tab strip. We also explicitly set the contentView's frame to be
188 // 800x600. 187 // 800x600.
189 [contentView setFrame:NSMakeRect(0, 0, 800, 600)]; 188 [contentView setFrame:NSMakeRect(0, 0, 800, 600)];
190 NSRect tabstripFrame = [tabstrip frame]; 189 NSRect tabstripFrame = [tabstrip frame];
191 tabstripFrame.origin.y = NSMaxY([contentView frame]); 190 tabstripFrame.origin.y = NSMaxY([contentView frame]);
192 [tabstrip setFrame:tabstripFrame]; 191 [tabstrip setFrame:tabstripFrame];
193 192
194 // Make sure each view is as tall as we expect. 193 // Make sure each view is as tall as we expect.
195 ASSERT_EQ(39, NSHeight([toolbar frame])); 194 ASSERT_EQ(36, NSHeight([toolbar frame]));
196 ASSERT_EQ(0, NSHeight([infobar frame])); 195 ASSERT_EQ(0, NSHeight([infobar frame]));
197 196
197
198 // TODO(rohitrao):rewrite and reenable
199 #if 0
200 NSView* contentArea = [controller_ tabContentArea];
201
198 // Force a layout and check each view's frame. 202 // Force a layout and check each view's frame.
199 // contentView should be at 0,0 800x600 203 // contentView should be at 0,0 800x600
200 // contentArea should be at 0,0 800x561 204 // contentArea should be at 0,0 800x561
201 // infobar should be at 0,561 800x0 205 // infobar should be at 0,561 800x0
202 // toolbar should be at 0,561 800x39 206 // toolbar should be at 0,561 800x39
203 [controller_ layoutSubviews]; 207 [controller_ layoutSubviews];
204 EXPECT_TRUE(NSEqualRects([contentView frame], NSMakeRect(0, 0, 800, 600))); 208 EXPECT_TRUE(NSEqualRects([contentView frame], NSMakeRect(0, 0, 800, 600)));
205 EXPECT_TRUE(NSEqualRects([contentArea frame], NSMakeRect(0, 0, 800, 561))); 209 EXPECT_TRUE(NSEqualRects([contentArea frame], NSMakeRect(0, 0, 800, 561)));
206 EXPECT_TRUE(NSEqualRects([infobar frame], NSMakeRect(0, 561, 800, 0))); 210 EXPECT_TRUE(NSEqualRects([infobar frame], NSMakeRect(0, 561, 800, 0)));
207 EXPECT_TRUE(NSEqualRects([toolbar frame], NSMakeRect(0, 561, 800, 39))); 211 EXPECT_TRUE(NSEqualRects([toolbar frame], NSMakeRect(0, 561, 800, 39)));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // contentArea should be at 0,30 800x531 252 // contentArea should be at 0,30 800x531
249 // infobar should be at 0,561 800x0 253 // infobar should be at 0,561 800x0
250 // toolbar should be at 0,561 800x39 254 // toolbar should be at 0,561 800x39
251 [controller_ resizeView:infobar newHeight:0]; 255 [controller_ resizeView:infobar newHeight:0];
252 [controller_ resizeView:toolbar newHeight:39]; 256 [controller_ resizeView:toolbar newHeight:39];
253 EXPECT_TRUE(NSEqualRects([contentView frame], NSMakeRect(0, 0, 800, 600))); 257 EXPECT_TRUE(NSEqualRects([contentView frame], NSMakeRect(0, 0, 800, 600)));
254 EXPECT_TRUE(NSEqualRects([download frame], NSMakeRect(0, 0, 800, 30))); 258 EXPECT_TRUE(NSEqualRects([download frame], NSMakeRect(0, 0, 800, 30)));
255 EXPECT_TRUE(NSEqualRects([contentArea frame], NSMakeRect(0, 30, 800, 531))); 259 EXPECT_TRUE(NSEqualRects([contentArea frame], NSMakeRect(0, 30, 800, 531)));
256 EXPECT_TRUE(NSEqualRects([infobar frame], NSMakeRect(0, 561, 800, 0))); 260 EXPECT_TRUE(NSEqualRects([infobar frame], NSMakeRect(0, 561, 800, 0)));
257 EXPECT_TRUE(NSEqualRects([toolbar frame], NSMakeRect(0, 561, 800, 39))); 261 EXPECT_TRUE(NSEqualRects([toolbar frame], NSMakeRect(0, 561, 800, 39)));
262 #endif
258 } 263 }
259 264
260 TEST_F(BrowserWindowControllerTest, TestTopLeftForBubble) { 265 TEST_F(BrowserWindowControllerTest, TestTopLeftForBubble) {
261 NSPoint p = [controller_ topLeftForBubble]; 266 NSPoint p = [controller_ topLeftForBubble];
262 NSRect all = [[controller_ window] frame]; 267 NSRect all = [[controller_ window] frame];
263 268
264 // As a sanity check make sure the point is vaguely in the top left 269 // As a sanity check make sure the point is vaguely in the top left
265 // of the window. 270 // of the window.
266 EXPECT_GT(p.y, all.origin.y + (all.size.height/2)); 271 EXPECT_GT(p.y, all.origin.y + (all.size.height/2));
267 EXPECT_LT(p.x, all.origin.x + (all.size.width/2)); 272 EXPECT_LT(p.x, all.origin.x + (all.size.width/2));
268 } 273 }
269 274
270 275
271 /* TODO(???): test other methods of BrowserWindowController */ 276 /* TODO(???): test other methods of BrowserWindowController */
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/browser_window_controller.mm ('k') | chrome/browser/cocoa/download_item_cell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698