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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/macros.h" | 8 #include "base/macros.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_menu_button.h" | 10 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
11 #include "chrome/browser/ui/views/tab_icon_view.h" | 11 #include "chrome/browser/ui/views/tab_icon_view.h" |
12 #include "chrome/browser/ui/views/tabs/tab.h" | 12 #include "chrome/browser/ui/views/tabs/tab.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "components/signin/core/common/profile_management_switches.h" | 14 #include "components/signin/core/common/profile_management_switches.h" |
15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
16 #include "ui/gfx/image/image_skia_rep.h" | 16 #include "ui/gfx/image/image_skia_rep.h" |
17 #include "ui/gfx/text_constants.h" | 17 #include "ui/gfx/text_constants.h" |
18 #include "ui/views/controls/button/image_button.h" | 18 #include "ui/views/controls/button/image_button.h" |
19 #include "ui/views/controls/button/menu_button.h" | 19 #include "ui/views/controls/button/menu_button.h" |
20 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
21 #include "ui/views/test/views_test_base.h" | 21 #include "ui/views/test/views_test_base.h" |
22 | 22 |
23 #if defined(ENABLE_SUPERVISED_USERS) | |
24 #include "chrome/browser/ui/views/profiles/supervised_user_avatar_label.h" | |
25 #endif | |
26 | |
27 using views::Widget; | 23 using views::Widget; |
28 | 24 |
29 namespace { | 25 namespace { |
30 | 26 |
31 const int kWidth = 500; | 27 const int kWidth = 500; |
32 | 28 |
33 class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate { | 29 class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate { |
34 public: | 30 public: |
35 enum WindowState { | 31 enum WindowState { |
36 STATE_NORMAL, | 32 STATE_NORMAL, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 215 |
220 // Widgets: | 216 // Widgets: |
221 views::ImageButton* minimize_button_; | 217 views::ImageButton* minimize_button_; |
222 views::ImageButton* maximize_button_; | 218 views::ImageButton* maximize_button_; |
223 views::ImageButton* restore_button_; | 219 views::ImageButton* restore_button_; |
224 views::ImageButton* close_button_; | 220 views::ImageButton* close_button_; |
225 | 221 |
226 TabIconView* tab_icon_view_; | 222 TabIconView* tab_icon_view_; |
227 views::Label* window_title_; | 223 views::Label* window_title_; |
228 | 224 |
229 #if defined(ENABLE_SUPERVISED_USERS) | |
230 SupervisedUserAvatarLabel* supervised_user_avatar_label_; | |
231 #endif | |
232 AvatarMenuButton* menu_button_; | 225 AvatarMenuButton* menu_button_; |
233 views::MenuButton* new_avatar_button_; | 226 views::MenuButton* new_avatar_button_; |
234 | 227 |
235 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameViewLayoutTest); | 228 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameViewLayoutTest); |
236 }; | 229 }; |
237 | 230 |
238 TEST_F(OpaqueBrowserFrameViewLayoutTest, BasicWindow) { | 231 TEST_F(OpaqueBrowserFrameViewLayoutTest, BasicWindow) { |
239 // Tests the layout of a default chrome window with no avatars, no window | 232 // Tests the layout of a default chrome window with no avatars, no window |
240 // titles, and a tabstrip. | 233 // titles, and a tabstrip. |
241 root_view_->Layout(); | 234 root_view_->Layout(); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 388 |
396 // Check the location of the avatar button. | 389 // Check the location of the avatar button. |
397 EXPECT_EQ("385,1 12x18", new_avatar_button_->bounds().ToString()); | 390 EXPECT_EQ("385,1 12x18", new_avatar_button_->bounds().ToString()); |
398 // The new tab button is 39px wide and slides completely under the new | 391 // The new tab button is 39px wide and slides completely under the new |
399 // avatar button, thus increasing the tabstrip by that amount. | 392 // avatar button, thus increasing the tabstrip by that amount. |
400 EXPECT_EQ("-1,13 420x29", | 393 EXPECT_EQ("-1,13 420x29", |
401 layout_manager_->GetBoundsForTabStrip( | 394 layout_manager_->GetBoundsForTabStrip( |
402 delegate_->GetTabstripPreferredSize(), kWidth).ToString()); | 395 delegate_->GetTabstripPreferredSize(), kWidth).ToString()); |
403 EXPECT_EQ("261x73", layout_manager_->GetMinimumSize(kWidth).ToString()); | 396 EXPECT_EQ("261x73", layout_manager_->GetMinimumSize(kWidth).ToString()); |
404 } | 397 } |
OLD | NEW |