Chromium Code Reviews| 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/layout_constants.h" | 10 #include "chrome/browser/ui/layout_constants.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 views::NonClientFrameView::kClientEdgeThickness; | 30 views::NonClientFrameView::kClientEdgeThickness; |
| 31 const int kMinimizeButtonWidth = 26; | 31 const int kMinimizeButtonWidth = 26; |
| 32 const int kMaximizeButtonWidth = 25; | 32 const int kMaximizeButtonWidth = 25; |
| 33 const int kCloseButtonWidth = 43; | 33 const int kCloseButtonWidth = 43; |
| 34 const int kMaximizedExtraCloseWidth = OBFVL::kFrameBorderThickness - | 34 const int kMaximizedExtraCloseWidth = OBFVL::kFrameBorderThickness - |
| 35 views::NonClientFrameView::kFrameShadowThickness; | 35 views::NonClientFrameView::kFrameShadowThickness; |
| 36 const int kCaptionButtonsWidth = | 36 const int kCaptionButtonsWidth = |
| 37 kMinimizeButtonWidth + kMaximizeButtonWidth + kCloseButtonWidth; | 37 kMinimizeButtonWidth + kMaximizeButtonWidth + kCloseButtonWidth; |
| 38 const int kCaptionButtonHeight = 18; | 38 const int kCaptionButtonHeight = 18; |
| 39 | 39 |
| 40 class AvatarMenuButton; | |
| 41 | |
| 40 class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate { | 42 class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate { |
| 41 public: | 43 public: |
| 42 TestLayoutDelegate() : show_caption_buttons_(true), maximized_(false) {} | 44 TestLayoutDelegate() : show_caption_buttons_(true), maximized_(false) {} |
| 43 ~TestLayoutDelegate() override {} | 45 ~TestLayoutDelegate() override {} |
| 44 | 46 |
| 45 void set_window_title(const base::string16& title) { window_title_ = title; } | 47 void set_window_title(const base::string16& title) { window_title_ = title; } |
| 46 void set_show_caption_buttons(bool show_caption_buttons) { | 48 void set_show_caption_buttons(bool show_caption_buttons) { |
| 47 show_caption_buttons_ = show_caption_buttons; | 49 show_caption_buttons_ = show_caption_buttons; |
| 48 } | 50 } |
| 49 void set_maximized(bool maximized) { maximized_ = maximized; } | 51 void set_maximized(bool maximized) { maximized_ = maximized; } |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 | 334 |
| 333 // Widgets: | 335 // Widgets: |
| 334 views::ImageButton* minimize_button_ = nullptr; | 336 views::ImageButton* minimize_button_ = nullptr; |
| 335 views::ImageButton* maximize_button_ = nullptr; | 337 views::ImageButton* maximize_button_ = nullptr; |
| 336 views::ImageButton* restore_button_ = nullptr; | 338 views::ImageButton* restore_button_ = nullptr; |
| 337 views::ImageButton* close_button_ = nullptr; | 339 views::ImageButton* close_button_ = nullptr; |
| 338 | 340 |
| 339 TabIconView* tab_icon_view_ = nullptr; | 341 TabIconView* tab_icon_view_ = nullptr; |
| 340 views::Label* window_title_ = nullptr; | 342 views::Label* window_title_ = nullptr; |
| 341 | 343 |
| 342 AvatarMenuButton* menu_button_ = nullptr; | 344 AvatarMenuButton* menu_button_ = nullptr; |
|
Nico
2016/11/26 04:55:21
this looks unused
(adding a class declaration ins
jbriance
2016/11/26 10:21:40
Indeed, good catch !
| |
| 343 views::MenuButton* avatar_button_ = nullptr; | 345 views::MenuButton* avatar_button_ = nullptr; |
| 344 | 346 |
| 345 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameViewLayoutTest); | 347 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameViewLayoutTest); |
| 346 }; | 348 }; |
| 347 | 349 |
| 348 TEST_F(OpaqueBrowserFrameViewLayoutTest, BasicWindow) { | 350 TEST_F(OpaqueBrowserFrameViewLayoutTest, BasicWindow) { |
| 349 // Tests the layout of a default chrome window with no avatars, no window | 351 // Tests the layout of a default chrome window with no avatars, no window |
| 350 // titles, and a tabstrip. | 352 // titles, and a tabstrip. |
| 351 | 353 |
| 352 for (int i = 0; i < 2; ++i) { | 354 for (int i = 0; i < 2; ++i) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 | 428 |
| 427 for (int i = 0; i < 2; ++i) { | 429 for (int i = 0; i < 2; ++i) { |
| 428 root_view_->Layout(); | 430 root_view_->Layout(); |
| 429 SCOPED_TRACE(i == 0 ? "Window is restored" : "Window is maximized"); | 431 SCOPED_TRACE(i == 0 ? "Window is restored" : "Window is maximized"); |
| 430 ExpectCaptionButtons(false, 0); | 432 ExpectCaptionButtons(false, 0); |
| 431 ExpectTabStripAndMinimumSize(false); | 433 ExpectTabStripAndMinimumSize(false); |
| 432 ExpectAvatar(); | 434 ExpectAvatar(); |
| 433 delegate_->set_maximized(true); | 435 delegate_->set_maximized(true); |
| 434 } | 436 } |
| 435 } | 437 } |
| OLD | NEW |