OLD | NEW |
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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/ui/views/profiles/avatar_label.h" | 10 #include "chrome/browser/ui/views/profiles/avatar_label.h" |
11 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 11 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
12 #include "chrome/browser/ui/views/tab_icon_view.h" | 12 #include "chrome/browser/ui/views/tab_icon_view.h" |
13 #include "chrome/browser/ui/views/tabs/tab.h" | 13 #include "chrome/browser/ui/views/tabs/tab.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "components/signin/core/common/profile_management_switches.h" | |
16 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
17 #include "ui/gfx/image/image_skia_rep.h" | 16 #include "ui/gfx/image/image_skia_rep.h" |
18 #include "ui/gfx/text_constants.h" | 17 #include "ui/gfx/text_constants.h" |
19 #include "ui/views/controls/button/image_button.h" | 18 #include "ui/views/controls/button/image_button.h" |
20 #include "ui/views/controls/button/menu_button.h" | 19 #include "ui/views/controls/button/menu_button.h" |
21 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
22 #include "ui/views/test/views_test_base.h" | 21 #include "ui/views/test/views_test_base.h" |
23 | 22 |
24 using views::Widget; | 23 using views::Widget; |
25 | 24 |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 delegate_->GetTabstripPreferredSize(), kWidth).ToString()); | 506 delegate_->GetTabstripPreferredSize(), kWidth).ToString()); |
508 EXPECT_EQ("251x61", layout_manager_->GetMinimumSize(kWidth).ToString()); | 507 EXPECT_EQ("251x61", layout_manager_->GetMinimumSize(kWidth).ToString()); |
509 | 508 |
510 // A normal window with no window icon still produces icon bounds for | 509 // A normal window with no window icon still produces icon bounds for |
511 // Windows, which has a hidden icon that a user can double click on to close | 510 // Windows, which has a hidden icon that a user can double click on to close |
512 // the window. | 511 // the window. |
513 EXPECT_EQ("2,0 17x17", layout_manager_->IconBounds().ToString()); | 512 EXPECT_EQ("2,0 17x17", layout_manager_->IconBounds().ToString()); |
514 } | 513 } |
515 | 514 |
516 TEST_F(OpaqueBrowserFrameViewLayoutTest, WindowWithNewAvatar) { | 515 TEST_F(OpaqueBrowserFrameViewLayoutTest, WindowWithNewAvatar) { |
517 switches::EnableNewProfileManagementForTesting( | 516 CommandLine::ForCurrentProcess()->AppendSwitch( |
518 CommandLine::ForCurrentProcess()); | 517 switches::kNewProfileManagement); |
519 | 518 |
520 // Tests a normal tabstrip window with the new style avatar icon. | 519 // Tests a normal tabstrip window with the new style avatar icon. |
521 AddNewAvatarButton(); | 520 AddNewAvatarButton(); |
522 root_view_->Layout(); | 521 root_view_->Layout(); |
523 | 522 |
524 ExpectBasicWindowBounds(); | 523 ExpectBasicWindowBounds(); |
525 | 524 |
526 // Check the location of the caption button | 525 // Check the location of the caption button |
527 EXPECT_EQ("385,1 12x20", new_avatar_button_->bounds().ToString()); | 526 EXPECT_EQ("385,1 12x20", new_avatar_button_->bounds().ToString()); |
528 // The basic window bounds are (-1, 13 398x29). There should not be an icon | 527 // The basic window bounds are (-1, 13 398x29). There should not be an icon |
(...skipping 13 matching lines...) Expand all Loading... |
542 | 541 |
543 // Check the location of the avatar label relative to the avatar button if | 542 // Check the location of the avatar label relative to the avatar button if |
544 // both are displayed on the left side. | 543 // both are displayed on the left side. |
545 // The label height and width depends on the font size and the text displayed. | 544 // The label height and width depends on the font size and the text displayed. |
546 // This may possibly change, so we don't test it here. | 545 // This may possibly change, so we don't test it here. |
547 EXPECT_EQ(menu_button_->bounds().x() - 2, avatar_label_->bounds().x()); | 546 EXPECT_EQ(menu_button_->bounds().x() - 2, avatar_label_->bounds().x()); |
548 EXPECT_EQ( | 547 EXPECT_EQ( |
549 menu_button_->bounds().bottom() - 3 - avatar_label_->bounds().height(), | 548 menu_button_->bounds().bottom() - 3 - avatar_label_->bounds().height(), |
550 avatar_label_->bounds().y()); | 549 avatar_label_->bounds().y()); |
551 } | 550 } |
OLD | NEW |