| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/caption_buttons/frame_caption_button_container_view.h" | 5 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_layout_constants.h" | 7 #include "ash/common/ash_layout_constants.h" |
| 8 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 8 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 9 #include "ash/common/wm_shell.h" |
| 9 #include "ash/frame/caption_buttons/frame_caption_button.h" | 10 #include "ash/frame/caption_buttons/frame_caption_button.h" |
| 10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 11 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 12 #include "grit/ash_resources.h" | 13 #include "grit/ash_resources.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/vector_icons_public.h" | 15 #include "ui/gfx/vector_icons_public.h" |
| 15 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 16 #include "ui/views/widget/widget_delegate.h" | 17 #include "ui/views/widget/widget_delegate.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 gfx::Rect initial_close_button_bounds = test.close_button()->bounds(); | 159 gfx::Rect initial_close_button_bounds = test.close_button()->bounds(); |
| 159 gfx::Rect initial_container_bounds = container.bounds(); | 160 gfx::Rect initial_container_bounds = container.bounds(); |
| 160 | 161 |
| 161 ASSERT_EQ(initial_size_button_bounds.x(), | 162 ASSERT_EQ(initial_size_button_bounds.x(), |
| 162 initial_minimize_button_bounds.right()); | 163 initial_minimize_button_bounds.right()); |
| 163 ASSERT_EQ(initial_close_button_bounds.x(), | 164 ASSERT_EQ(initial_close_button_bounds.x(), |
| 164 initial_size_button_bounds.right()); | 165 initial_size_button_bounds.right()); |
| 165 | 166 |
| 166 // Hidden size button should result in minimize button animating to the | 167 // Hidden size button should result in minimize button animating to the |
| 167 // right. The size button should not be visible, but should not have moved. | 168 // right. The size button should not be visible, but should not have moved. |
| 168 Shell::GetInstance() | 169 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 169 ->maximize_mode_controller() | 170 true); |
| 170 ->EnableMaximizeModeWindowManager(true); | |
| 171 container.UpdateSizeButtonVisibility(); | 171 container.UpdateSizeButtonVisibility(); |
| 172 test.EndAnimations(); | 172 test.EndAnimations(); |
| 173 // Parent needs to layout in response to size change. | 173 // Parent needs to layout in response to size change. |
| 174 container.Layout(); | 174 container.Layout(); |
| 175 | 175 |
| 176 EXPECT_TRUE(test.minimize_button()->visible()); | 176 EXPECT_TRUE(test.minimize_button()->visible()); |
| 177 EXPECT_FALSE(test.size_button()->visible()); | 177 EXPECT_FALSE(test.size_button()->visible()); |
| 178 EXPECT_TRUE(test.close_button()->visible()); | 178 EXPECT_TRUE(test.close_button()->visible()); |
| 179 gfx::Rect minimize_button_bounds = test.minimize_button()->bounds(); | 179 gfx::Rect minimize_button_bounds = test.minimize_button()->bounds(); |
| 180 gfx::Rect close_button_bounds = test.close_button()->bounds(); | 180 gfx::Rect close_button_bounds = test.close_button()->bounds(); |
| 181 EXPECT_EQ(close_button_bounds.x(), minimize_button_bounds.right()); | 181 EXPECT_EQ(close_button_bounds.x(), minimize_button_bounds.right()); |
| 182 EXPECT_EQ(initial_size_button_bounds, test.size_button()->bounds()); | 182 EXPECT_EQ(initial_size_button_bounds, test.size_button()->bounds()); |
| 183 EXPECT_EQ(initial_close_button_bounds.size(), close_button_bounds.size()); | 183 EXPECT_EQ(initial_close_button_bounds.size(), close_button_bounds.size()); |
| 184 EXPECT_LT(container.GetPreferredSize().width(), | 184 EXPECT_LT(container.GetPreferredSize().width(), |
| 185 initial_container_bounds.width()); | 185 initial_container_bounds.width()); |
| 186 | 186 |
| 187 // Revealing the size button should cause the minimize button to return to its | 187 // Revealing the size button should cause the minimize button to return to its |
| 188 // original position. | 188 // original position. |
| 189 Shell::GetInstance() | 189 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 190 ->maximize_mode_controller() | 190 false); |
| 191 ->EnableMaximizeModeWindowManager(false); | |
| 192 container.UpdateSizeButtonVisibility(); | 191 container.UpdateSizeButtonVisibility(); |
| 193 // Calling code needs to layout in response to size change. | 192 // Calling code needs to layout in response to size change. |
| 194 container.Layout(); | 193 container.Layout(); |
| 195 test.EndAnimations(); | 194 test.EndAnimations(); |
| 196 EXPECT_TRUE(test.minimize_button()->visible()); | 195 EXPECT_TRUE(test.minimize_button()->visible()); |
| 197 EXPECT_TRUE(test.size_button()->visible()); | 196 EXPECT_TRUE(test.size_button()->visible()); |
| 198 EXPECT_TRUE(test.close_button()->visible()); | 197 EXPECT_TRUE(test.close_button()->visible()); |
| 199 EXPECT_EQ(initial_minimize_button_bounds, test.minimize_button()->bounds()); | 198 EXPECT_EQ(initial_minimize_button_bounds, test.minimize_button()->bounds()); |
| 200 EXPECT_EQ(initial_size_button_bounds, test.size_button()->bounds()); | 199 EXPECT_EQ(initial_size_button_bounds, test.size_button()->bounds()); |
| 201 EXPECT_EQ(initial_close_button_bounds, test.close_button()->bounds()); | 200 EXPECT_EQ(initial_close_button_bounds, test.close_button()->bounds()); |
| 202 EXPECT_EQ(container.GetPreferredSize().width(), | 201 EXPECT_EQ(container.GetPreferredSize().width(), |
| 203 initial_container_bounds.width()); | 202 initial_container_bounds.width()); |
| 204 } | 203 } |
| 205 | 204 |
| 206 } // namespace ash | 205 } // namespace ash |
| OLD | NEW |