OLD | NEW |
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 "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "grit/ash_resources.h" | 9 #include "grit/ash_resources.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 TEST_F(CustomFrameViewAshTest, HeaderHeight) { | 106 TEST_F(CustomFrameViewAshTest, HeaderHeight) { |
107 TestWidgetDelegate* delegate = new TestWidgetDelegate; | 107 TestWidgetDelegate* delegate = new TestWidgetDelegate; |
108 | 108 |
109 scoped_ptr<views::Widget> widget(CreateWidget(delegate)); | 109 scoped_ptr<views::Widget> widget(CreateWidget(delegate)); |
110 widget->Show(); | 110 widget->Show(); |
111 | 111 |
112 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 112 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
113 gfx::ImageSkia* close_button = | 113 gfx::ImageSkia* close_button = |
114 rb.GetImageSkiaNamed(IDR_AURA_WINDOW_CONTROL_BACKGROUND_H); | 114 rb.GetImageSkiaNamed(IDR_AURA_WINDOW_CONTROL_BACKGROUND_H); |
115 | 115 |
116 // |kSeparatorSize| should match |kHeaderContentSeparatorSize| in | 116 // The header should have enough room for the window controls. The |
117 // default_header_painter.cc | 117 // header/content separator line overlays the window controls. |
118 // TODO(pkotwicz): Clean this test up once the separator overlays the window | 118 EXPECT_EQ(close_button->height(), |
119 // controls. | |
120 const int kSeparatorSize = 1; | |
121 | |
122 // The header should have enough room for the window controls and the | |
123 // separator line. | |
124 EXPECT_EQ(close_button->height() + kSeparatorSize, | |
125 delegate->custom_frame_view()->GetHeaderView()->height()); | |
126 | |
127 widget->Maximize(); | |
128 EXPECT_EQ(close_button->height() + kSeparatorSize, | |
129 delegate->custom_frame_view()->GetHeaderView()->height()); | 119 delegate->custom_frame_view()->GetHeaderView()->height()); |
130 } | 120 } |
131 | 121 |
132 // Verify that CustomFrameViewAsh returns the correct minimum and maximum frame | 122 // Verify that CustomFrameViewAsh returns the correct minimum and maximum frame |
133 // sizes when the client view does not specify any size constraints. | 123 // sizes when the client view does not specify any size constraints. |
134 TEST_F(CustomFrameViewAshTest, NoSizeConstraints) { | 124 TEST_F(CustomFrameViewAshTest, NoSizeConstraints) { |
135 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; | 125 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; |
136 scoped_ptr<views::Widget> widget(CreateWidget(delegate)); | 126 scoped_ptr<views::Widget> widget(CreateWidget(delegate)); |
137 | 127 |
138 CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view(); | 128 CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view(); |
(...skipping 23 matching lines...) Expand all Loading... |
162 | 152 |
163 EXPECT_EQ(min_client_size.width(), min_frame_size.width()); | 153 EXPECT_EQ(min_client_size.width(), min_frame_size.width()); |
164 EXPECT_EQ(max_client_size.width(), max_frame_size.width()); | 154 EXPECT_EQ(max_client_size.width(), max_frame_size.width()); |
165 EXPECT_EQ(min_client_size.height() + delegate->GetTitleBarHeight(), | 155 EXPECT_EQ(min_client_size.height() + delegate->GetTitleBarHeight(), |
166 min_frame_size.height()); | 156 min_frame_size.height()); |
167 EXPECT_EQ(max_client_size.height() + delegate->GetTitleBarHeight(), | 157 EXPECT_EQ(max_client_size.height() + delegate->GetTitleBarHeight(), |
168 max_frame_size.height()); | 158 max_frame_size.height()); |
169 } | 159 } |
170 | 160 |
171 } // namespace ash | 161 } // namespace ash |
OLD | NEW |