| 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/common/frame/custom_frame_view_ash.h" | 5 #include "ash/common/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/common/frame/caption_buttons/frame_caption_button.h" | 10 #include "ash/common/frame/caption_buttons/frame_caption_button.h" |
| 11 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 11 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
| 12 #include "ash/common/test/test_session_state_delegate.h" | 12 #include "ash/common/test/test_session_state_delegate.h" |
| 13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 14 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 15 #include "ash/shell.h" |
| 15 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
| 16 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 17 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
| 18 #include "ui/gfx/image/image_unittest_util.h" | 19 #include "ui/gfx/image/image_unittest_util.h" |
| 19 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 20 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
| 21 | 22 |
| 22 namespace ash { | 23 namespace ash { |
| 23 | 24 |
| 24 // A views::WidgetDelegate which uses a CustomFrameViewAsh. | 25 // A views::WidgetDelegate which uses a CustomFrameViewAsh. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 204 |
| 204 // The visibility of the size button is updated when maximize mode is toggled. | 205 // The visibility of the size button is updated when maximize mode is toggled. |
| 205 // Verify that the layout of the HeaderView is updated for the size button's | 206 // Verify that the layout of the HeaderView is updated for the size button's |
| 206 // new visibility. | 207 // new visibility. |
| 207 TEST_F(CustomFrameViewAshTest, HeaderViewNotifiedOfChildSizeChange) { | 208 TEST_F(CustomFrameViewAshTest, HeaderViewNotifiedOfChildSizeChange) { |
| 208 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; | 209 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; |
| 209 std::unique_ptr<views::Widget> widget(CreateWidget(delegate)); | 210 std::unique_ptr<views::Widget> widget(CreateWidget(delegate)); |
| 210 | 211 |
| 211 const gfx::Rect initial = | 212 const gfx::Rect initial = |
| 212 delegate->GetFrameCaptionButtonContainerViewBounds(); | 213 delegate->GetFrameCaptionButtonContainerViewBounds(); |
| 213 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 214 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 214 true); | 215 true); |
| 215 delegate->EndFrameCaptionButtonContainerViewAnimations(); | 216 delegate->EndFrameCaptionButtonContainerViewAnimations(); |
| 216 const gfx::Rect maximize_mode_bounds = | 217 const gfx::Rect maximize_mode_bounds = |
| 217 delegate->GetFrameCaptionButtonContainerViewBounds(); | 218 delegate->GetFrameCaptionButtonContainerViewBounds(); |
| 218 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); | 219 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); |
| 219 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 220 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 220 false); | 221 false); |
| 221 delegate->EndFrameCaptionButtonContainerViewAnimations(); | 222 delegate->EndFrameCaptionButtonContainerViewAnimations(); |
| 222 const gfx::Rect after_restore = | 223 const gfx::Rect after_restore = |
| 223 delegate->GetFrameCaptionButtonContainerViewBounds(); | 224 delegate->GetFrameCaptionButtonContainerViewBounds(); |
| 224 EXPECT_EQ(initial, after_restore); | 225 EXPECT_EQ(initial, after_restore); |
| 225 } | 226 } |
| 226 | 227 |
| 227 } // namespace ash | 228 } // namespace ash |
| OLD | NEW |