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

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc

Issue 23724019: Rework OpaqueBrowserFrameViewLayout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sky fixes Created 7 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/ui/views/frame/opaque_browser_frame_view_layout.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/views/tab_icon_view.h" 9 #include "chrome/browser/ui/views/tab_icon_view.h"
10 #include "chrome/browser/ui/views/tabs/tab.h" 10 #include "chrome/browser/ui/views/tabs/tab.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // titles, and a tabstrip. 235 // titles, and a tabstrip.
236 root_view_->Layout(); 236 root_view_->Layout();
237 237
238 ExpectBasicWindowBounds(); 238 ExpectBasicWindowBounds();
239 239
240 // After some visual inspection, it really does look like the tabstrip is 240 // After some visual inspection, it really does look like the tabstrip is
241 // initally positioned out of our view. 241 // initally positioned out of our view.
242 EXPECT_EQ("-1,13 398x29", 242 EXPECT_EQ("-1,13 398x29",
243 layout_manager_->GetBoundsForTabStrip( 243 layout_manager_->GetBoundsForTabStrip(
244 delegate_->GetTabstripPreferredSize(), kWidth).ToString()); 244 delegate_->GetTabstripPreferredSize(), kWidth).ToString());
245 EXPECT_EQ("226x73", layout_manager_->GetMinimumSize(kWidth).ToString()); 245 EXPECT_EQ("261x73", layout_manager_->GetMinimumSize(kWidth).ToString());
246 246
247 // A normal window with no window icon still produces icon bounds for 247 // A normal window with no window icon still produces icon bounds for
248 // Windows, which has a hidden icon that a user can double click on to close 248 // Windows, which has a hidden icon that a user can double click on to close
249 // the window. 249 // the window.
250 EXPECT_EQ("6,4 17x17", layout_manager_->IconBounds().ToString()); 250 EXPECT_EQ("6,4 17x17", layout_manager_->IconBounds().ToString());
251 } 251 }
252 252
253 TEST_F(OpaqueBrowserFrameViewLayoutTest, BasicWindowMaximized) { 253 TEST_F(OpaqueBrowserFrameViewLayoutTest, BasicWindowMaximized) {
254 // Tests the layout of a default chrome window with no avatars, no window 254 // Tests the layout of a default chrome window with no avatars, no window
255 // titles, and a tabstrip, but maximized this time. 255 // titles, and a tabstrip, but maximized this time.
256 delegate_->SetWindowState(TestLayoutDelegate::STATE_MAXIMIZED); 256 delegate_->SetWindowState(TestLayoutDelegate::STATE_MAXIMIZED);
257 root_view_->Layout(); 257 root_view_->Layout();
258 258
259 // Note how the bonds start at the exact top of the window while maximized 259 // Note how the bonds start at the exact top of the window while maximized
260 // while they start 1 pixel below when unmaximized. 260 // while they start 1 pixel below when unmaximized.
261 EXPECT_EQ("0,0 0x0", maximize_button_->bounds().ToString()); 261 EXPECT_EQ("0,0 0x0", maximize_button_->bounds().ToString());
262 EXPECT_EQ("403,0 26x18", minimize_button_->bounds().ToString()); 262 EXPECT_EQ("403,0 26x18", minimize_button_->bounds().ToString());
263 EXPECT_EQ("429,0 25x18", restore_button_->bounds().ToString()); 263 EXPECT_EQ("429,0 25x18", restore_button_->bounds().ToString());
264 EXPECT_EQ("454,0 46x18", close_button_->bounds().ToString()); 264 EXPECT_EQ("454,0 46x18", close_button_->bounds().ToString());
265 265
266 EXPECT_EQ("-6,-3 393x29", 266 EXPECT_EQ("-5,-3 392x29",
267 layout_manager_->GetBoundsForTabStrip( 267 layout_manager_->GetBoundsForTabStrip(
268 delegate_->GetTabstripPreferredSize(), kWidth).ToString()); 268 delegate_->GetTabstripPreferredSize(), kWidth).ToString());
269 EXPECT_EQ("231x61", layout_manager_->GetMinimumSize(kWidth).ToString()); 269 EXPECT_EQ("262x61", layout_manager_->GetMinimumSize(kWidth).ToString());
270 270
271 // In the maximized case, OpaqueBrowserFrameView::NonClientHitTest() uses 271 // In the maximized case, OpaqueBrowserFrameView::NonClientHitTest() uses
272 // this rect, extended to the top left corner of the window. 272 // this rect, extended to the top left corner of the window.
273 EXPECT_EQ("2,0 17x17", layout_manager_->IconBounds().ToString()); 273 EXPECT_EQ("2,0 17x17", layout_manager_->IconBounds().ToString());
274 } 274 }
275 275
276 TEST_F(OpaqueBrowserFrameViewLayoutTest, WithWindowTitleAndIcon) { 276 TEST_F(OpaqueBrowserFrameViewLayoutTest, WithWindowTitleAndIcon) {
277 // Tests the layout of pop up windows. 277 // Tests the layout of pop up windows.
278 delegate_->SetWindowTitle(ASCIIToUTF16("Window Title")); 278 delegate_->SetWindowTitle(ASCIIToUTF16("Window Title"));
279 AddWindowTitleIcons(); 279 AddWindowTitleIcons();
(...skipping 12 matching lines...) Expand all
292 AddAvatarButton(); 292 AddAvatarButton();
293 root_view_->Layout(); 293 root_view_->Layout();
294 294
295 ExpectBasicWindowBounds(); 295 ExpectBasicWindowBounds();
296 296
297 // Check the location of the avatar 297 // Check the location of the avatar
298 EXPECT_EQ("7,11 40x29", menu_button_->bounds().ToString()); 298 EXPECT_EQ("7,11 40x29", menu_button_->bounds().ToString());
299 EXPECT_EQ("45,13 352x29", 299 EXPECT_EQ("45,13 352x29",
300 layout_manager_->GetBoundsForTabStrip( 300 layout_manager_->GetBoundsForTabStrip(
301 delegate_->GetTabstripPreferredSize(), kWidth).ToString()); 301 delegate_->GetTabstripPreferredSize(), kWidth).ToString());
302 EXPECT_EQ("226x73", layout_manager_->GetMinimumSize(kWidth).ToString()); 302 EXPECT_EQ("261x73", layout_manager_->GetMinimumSize(kWidth).ToString());
303 } 303 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698