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" |
11 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 11 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/shell_port.h" |
13 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
14 #include "ash/test/test_session_state_delegate.h" | 15 #include "ash/test/test_session_state_delegate.h" |
15 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 16 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
16 #include "ash/wm_shell.h" | |
17 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
18 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
19 #include "ui/gfx/image/image_unittest_util.h" | 19 #include "ui/gfx/image/image_unittest_util.h" |
20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
21 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 | 24 |
25 // A views::WidgetDelegate which uses a CustomFrameViewAsh. | 25 // A views::WidgetDelegate which uses a CustomFrameViewAsh. |
26 class TestWidgetDelegate : public views::WidgetDelegateView { | 26 class TestWidgetDelegate : public views::WidgetDelegateView { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 params.delegate = delegate; | 103 params.delegate = delegate; |
104 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 104 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
105 params.bounds = gfx::Rect(0, 0, 100, 100); | 105 params.bounds = gfx::Rect(0, 0, 100, 100); |
106 params.context = CurrentContext(); | 106 params.context = CurrentContext(); |
107 widget->Init(params); | 107 widget->Init(params); |
108 return widget; | 108 return widget; |
109 } | 109 } |
110 | 110 |
111 test::TestSessionStateDelegate* GetTestSessionStateDelegate() { | 111 test::TestSessionStateDelegate* GetTestSessionStateDelegate() { |
112 return static_cast<test::TestSessionStateDelegate*>( | 112 return static_cast<test::TestSessionStateDelegate*>( |
113 WmShell::Get()->GetSessionStateDelegate()); | 113 ShellPort::Get()->GetSessionStateDelegate()); |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshTest); | 117 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshTest); |
118 }; | 118 }; |
119 | 119 |
120 // Verifies the client view is not placed at a y location of 0. | 120 // Verifies the client view is not placed at a y location of 0. |
121 TEST_F(CustomFrameViewAshTest, ClientViewCorrectlyPlaced) { | 121 TEST_F(CustomFrameViewAshTest, ClientViewCorrectlyPlaced) { |
122 std::unique_ptr<views::Widget> widget(CreateWidget(new TestWidgetDelegate)); | 122 std::unique_ptr<views::Widget> widget(CreateWidget(new TestWidgetDelegate)); |
123 widget->Show(); | 123 widget->Show(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); | 219 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); |
220 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 220 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
221 false); | 221 false); |
222 delegate->EndFrameCaptionButtonContainerViewAnimations(); | 222 delegate->EndFrameCaptionButtonContainerViewAnimations(); |
223 const gfx::Rect after_restore = | 223 const gfx::Rect after_restore = |
224 delegate->GetFrameCaptionButtonContainerViewBounds(); | 224 delegate->GetFrameCaptionButtonContainerViewBounds(); |
225 EXPECT_EQ(initial, after_restore); | 225 EXPECT_EQ(initial, after_restore); |
226 } | 226 } |
227 | 227 |
228 } // namespace ash | 228 } // namespace ash |
OLD | NEW |