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