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

Side by Side Diff: ash/frame/custom_frame_view_ash_unittest.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « ash/frame/custom_frame_view_ash.cc ('k') | ash/frame/default_header_painter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/frame/custom_frame_view_ash.h" 5 #include "ash/frame/custom_frame_view_ash.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/common/ash_layout_constants.h" 9 #include "ash/common/ash_layout_constants.h"
10 #include "ash/frame/caption_buttons/frame_caption_button.h" 10 #include "ash/frame/caption_buttons/frame_caption_button.h"
(...skipping 16 matching lines...) Expand all
27 public: 27 public:
28 TestWidgetDelegate() {} 28 TestWidgetDelegate() {}
29 ~TestWidgetDelegate() override {} 29 ~TestWidgetDelegate() override {}
30 30
31 views::NonClientFrameView* CreateNonClientFrameView( 31 views::NonClientFrameView* CreateNonClientFrameView(
32 views::Widget* widget) override { 32 views::Widget* widget) override {
33 custom_frame_view_ = new CustomFrameViewAsh(widget); 33 custom_frame_view_ = new CustomFrameViewAsh(widget);
34 return custom_frame_view_; 34 return custom_frame_view_;
35 } 35 }
36 36
37 CustomFrameViewAsh* custom_frame_view() const { 37 CustomFrameViewAsh* custom_frame_view() const { return custom_frame_view_; }
38 return custom_frame_view_;
39 }
40 38
41 private: 39 private:
42 // Not owned. 40 // Not owned.
43 CustomFrameViewAsh* custom_frame_view_; 41 CustomFrameViewAsh* custom_frame_view_;
44 42
45 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); 43 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate);
46 }; 44 };
47 45
48 class TestWidgetConstraintsDelegate : public TestWidgetDelegate { 46 class TestWidgetConstraintsDelegate : public TestWidgetDelegate {
49 public: 47 public:
50 TestWidgetConstraintsDelegate() {} 48 TestWidgetConstraintsDelegate() {}
51 ~TestWidgetConstraintsDelegate() override {} 49 ~TestWidgetConstraintsDelegate() override {}
52 50
53 // views::View: 51 // views::View:
54 gfx::Size GetMinimumSize() const override { return minimum_size_; } 52 gfx::Size GetMinimumSize() const override { return minimum_size_; }
55 53
56 gfx::Size GetMaximumSize() const override { return maximum_size_; } 54 gfx::Size GetMaximumSize() const override { return maximum_size_; }
57 55
58 views::View* GetContentsView() override { 56 views::View* GetContentsView() override {
59 // Set this instance as the contents view so that the maximum and minimum 57 // Set this instance as the contents view so that the maximum and minimum
60 // size constraints will be used. 58 // size constraints will be used.
61 return this; 59 return this;
62 } 60 }
63 61
64 // views::WidgetDelegate: 62 // views::WidgetDelegate:
65 bool CanMaximize() const override { return true; } 63 bool CanMaximize() const override { return true; }
66 64
67 bool CanMinimize() const override { return true; } 65 bool CanMinimize() const override { return true; }
68 66
69 void set_minimum_size(const gfx::Size& min_size) { 67 void set_minimum_size(const gfx::Size& min_size) { minimum_size_ = min_size; }
70 minimum_size_ = min_size;
71 }
72 68
73 void set_maximum_size(const gfx::Size& max_size) { 69 void set_maximum_size(const gfx::Size& max_size) { maximum_size_ = max_size; }
74 maximum_size_ = max_size;
75 }
76 70
77 const gfx::Rect& GetFrameCaptionButtonContainerViewBounds() { 71 const gfx::Rect& GetFrameCaptionButtonContainerViewBounds() {
78 return custom_frame_view()->GetFrameCaptionButtonContainerViewForTest()-> 72 return custom_frame_view()
79 bounds(); 73 ->GetFrameCaptionButtonContainerViewForTest()
74 ->bounds();
80 } 75 }
81 76
82 void EndFrameCaptionButtonContainerViewAnimations() { 77 void EndFrameCaptionButtonContainerViewAnimations() {
83 FrameCaptionButtonContainerView::TestApi test(custom_frame_view()-> 78 FrameCaptionButtonContainerView::TestApi test(
84 GetFrameCaptionButtonContainerViewForTest()); 79 custom_frame_view()->GetFrameCaptionButtonContainerViewForTest());
85 test.EndAnimations(); 80 test.EndAnimations();
86 } 81 }
87 82
88 int GetTitleBarHeight() const { 83 int GetTitleBarHeight() const {
89 return custom_frame_view()->NonClientTopBorderHeight(); 84 return custom_frame_view()->NonClientTopBorderHeight();
90 } 85 }
91 86
92 private: 87 private:
93 gfx::Size minimum_size_; 88 gfx::Size minimum_size_;
94 gfx::Size maximum_size_; 89 gfx::Size maximum_size_;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 EXPECT_FALSE(custom_frame_view->GetAvatarIconViewForTest()); 197 EXPECT_FALSE(custom_frame_view->GetAvatarIconViewForTest());
203 } 198 }
204 199
205 // The visibility of the size button is updated when maximize mode is toggled. 200 // The visibility of the size button is updated when maximize mode is toggled.
206 // Verify that the layout of the HeaderView is updated for the size button's 201 // Verify that the layout of the HeaderView is updated for the size button's
207 // new visibility. 202 // new visibility.
208 TEST_F(CustomFrameViewAshTest, HeaderViewNotifiedOfChildSizeChange) { 203 TEST_F(CustomFrameViewAshTest, HeaderViewNotifiedOfChildSizeChange) {
209 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; 204 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate;
210 std::unique_ptr<views::Widget> widget(CreateWidget(delegate)); 205 std::unique_ptr<views::Widget> widget(CreateWidget(delegate));
211 206
212 const gfx::Rect initial = delegate-> 207 const gfx::Rect initial =
213 GetFrameCaptionButtonContainerViewBounds(); 208 delegate->GetFrameCaptionButtonContainerViewBounds();
214 Shell::GetInstance()->maximize_mode_controller()-> 209 Shell::GetInstance()
215 EnableMaximizeModeWindowManager(true); 210 ->maximize_mode_controller()
211 ->EnableMaximizeModeWindowManager(true);
216 delegate->EndFrameCaptionButtonContainerViewAnimations(); 212 delegate->EndFrameCaptionButtonContainerViewAnimations();
217 const gfx::Rect maximize_mode_bounds = delegate-> 213 const gfx::Rect maximize_mode_bounds =
218 GetFrameCaptionButtonContainerViewBounds(); 214 delegate->GetFrameCaptionButtonContainerViewBounds();
219 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); 215 EXPECT_GT(initial.width(), maximize_mode_bounds.width());
220 Shell::GetInstance()->maximize_mode_controller()-> 216 Shell::GetInstance()
221 EnableMaximizeModeWindowManager(false); 217 ->maximize_mode_controller()
218 ->EnableMaximizeModeWindowManager(false);
222 delegate->EndFrameCaptionButtonContainerViewAnimations(); 219 delegate->EndFrameCaptionButtonContainerViewAnimations();
223 const gfx::Rect after_restore = delegate-> 220 const gfx::Rect after_restore =
224 GetFrameCaptionButtonContainerViewBounds(); 221 delegate->GetFrameCaptionButtonContainerViewBounds();
225 EXPECT_EQ(initial, after_restore); 222 EXPECT_EQ(initial, after_restore);
226 } 223 }
227 224
228 } // namespace ash 225 } // namespace ash
OLDNEW
« no previous file with comments | « ash/frame/custom_frame_view_ash.cc ('k') | ash/frame/default_header_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698