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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/ash_layout_constants.h" | 9 #include "ash/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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 gfx::Size max_frame_size = custom_frame_view->GetMaximumSize(); | 166 gfx::Size max_frame_size = custom_frame_view->GetMaximumSize(); |
167 | 167 |
168 EXPECT_EQ(min_client_size.width(), min_frame_size.width()); | 168 EXPECT_EQ(min_client_size.width(), min_frame_size.width()); |
169 EXPECT_EQ(max_client_size.width(), max_frame_size.width()); | 169 EXPECT_EQ(max_client_size.width(), max_frame_size.width()); |
170 EXPECT_EQ(min_client_size.height() + delegate->GetTitleBarHeight(), | 170 EXPECT_EQ(min_client_size.height() + delegate->GetTitleBarHeight(), |
171 min_frame_size.height()); | 171 min_frame_size.height()); |
172 EXPECT_EQ(max_client_size.height() + delegate->GetTitleBarHeight(), | 172 EXPECT_EQ(max_client_size.height() + delegate->GetTitleBarHeight(), |
173 max_frame_size.height()); | 173 max_frame_size.height()); |
174 } | 174 } |
175 | 175 |
| 176 // Verify that CustomFrameViewAsh returns the correct minimum frame size when |
| 177 // the kMinimumSize property is set. |
| 178 TEST_F(CustomFrameViewAshTest, HonorsMinimumSizeProperty) { |
| 179 const gfx::Size min_client_size(500, 500); |
| 180 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; |
| 181 delegate->set_minimum_size(min_client_size); |
| 182 std::unique_ptr<views::Widget> widget(CreateWidget(delegate)); |
| 183 |
| 184 // Update the native window's minimum size property. |
| 185 const gfx::Size min_window_size(600, 700); |
| 186 widget->GetNativeWindow()->SetProperty(aura::client::kMinimumSize, |
| 187 new gfx::Size(min_window_size)); |
| 188 |
| 189 CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view(); |
| 190 const gfx::Size min_frame_size = custom_frame_view->GetMinimumSize(); |
| 191 |
| 192 EXPECT_EQ(min_window_size, min_frame_size); |
| 193 } |
| 194 |
176 // Verify that CustomFrameViewAsh updates the avatar icon based on the | 195 // Verify that CustomFrameViewAsh updates the avatar icon based on the |
177 // avatar icon window property. | 196 // avatar icon window property. |
178 TEST_F(CustomFrameViewAshTest, AvatarIcon) { | 197 TEST_F(CustomFrameViewAshTest, AvatarIcon) { |
179 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; | 198 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; |
180 std::unique_ptr<views::Widget> widget(CreateWidget(delegate)); | 199 std::unique_ptr<views::Widget> widget(CreateWidget(delegate)); |
181 | 200 |
182 CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view(); | 201 CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view(); |
183 EXPECT_FALSE(custom_frame_view->GetAvatarIconViewForTest()); | 202 EXPECT_FALSE(custom_frame_view->GetAvatarIconViewForTest()); |
184 | 203 |
185 // Avatar image becomes available. | 204 // Avatar image becomes available. |
(...skipping 25 matching lines...) Expand all Loading... |
211 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); | 230 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); |
212 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 231 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
213 false); | 232 false); |
214 delegate->EndFrameCaptionButtonContainerViewAnimations(); | 233 delegate->EndFrameCaptionButtonContainerViewAnimations(); |
215 const gfx::Rect after_restore = | 234 const gfx::Rect after_restore = |
216 delegate->GetFrameCaptionButtonContainerViewBounds(); | 235 delegate->GetFrameCaptionButtonContainerViewBounds(); |
217 EXPECT_EQ(initial, after_restore); | 236 EXPECT_EQ(initial, after_restore); |
218 } | 237 } |
219 | 238 |
220 } // namespace ash | 239 } // namespace ash |
OLD | NEW |