| 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/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 5 #include "ash/common/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/frame/caption_buttons/frame_caption_button.h" | 8 #include "ash/common/frame/caption_buttons/frame_caption_button.h" |
| 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/resources/vector_icons/vector_icons.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/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 16 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class TestWidgetDelegate : public views::WidgetDelegateView { | 22 class TestWidgetDelegate : public views::WidgetDelegateView { |
| 23 public: | 23 public: |
| 24 TestWidgetDelegate(bool can_maximize, bool can_minimize) | 24 TestWidgetDelegate(bool can_maximize, bool can_minimize) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 return widget; | 64 return widget; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Sets arbitrary images for the icons and assign the default caption button | 67 // Sets arbitrary images for the icons and assign the default caption button |
| 68 // size to the buttons in |container|. | 68 // size to the buttons in |container|. |
| 69 void InitContainer(FrameCaptionButtonContainerView* container) { | 69 void InitContainer(FrameCaptionButtonContainerView* container) { |
| 70 container->SetButtonSize( | 70 container->SetButtonSize( |
| 71 GetAshLayoutSize(AshLayoutSize::NON_BROWSER_CAPTION_BUTTON)); | 71 GetAshLayoutSize(AshLayoutSize::NON_BROWSER_CAPTION_BUTTON)); |
| 72 for (int icon = 0; icon < CAPTION_BUTTON_ICON_COUNT; ++icon) { | 72 for (int icon = 0; icon < CAPTION_BUTTON_ICON_COUNT; ++icon) { |
| 73 container->SetButtonImage(static_cast<CaptionButtonIcon>(icon), | 73 container->SetButtonImage(static_cast<CaptionButtonIcon>(icon), |
| 74 gfx::VectorIconId::WINDOW_CONTROL_CLOSE); | 74 ash::kWindowControlCloseIcon); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 // Tests that |leftmost| and |rightmost| are at |container|'s edges. | 78 // Tests that |leftmost| and |rightmost| are at |container|'s edges. |
| 79 bool CheckButtonsAtEdges(FrameCaptionButtonContainerView* container, | 79 bool CheckButtonsAtEdges(FrameCaptionButtonContainerView* container, |
| 80 const ash::FrameCaptionButton& leftmost, | 80 const ash::FrameCaptionButton& leftmost, |
| 81 const ash::FrameCaptionButton& rightmost) { | 81 const ash::FrameCaptionButton& rightmost) { |
| 82 gfx::Rect expected(container->GetPreferredSize()); | 82 gfx::Rect expected(container->GetPreferredSize()); |
| 83 | 83 |
| 84 gfx::Rect container_size(container->GetPreferredSize()); | 84 gfx::Rect container_size(container->GetPreferredSize()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 EXPECT_TRUE(test.size_button()->visible()); | 195 EXPECT_TRUE(test.size_button()->visible()); |
| 196 EXPECT_TRUE(test.close_button()->visible()); | 196 EXPECT_TRUE(test.close_button()->visible()); |
| 197 EXPECT_EQ(initial_minimize_button_bounds, test.minimize_button()->bounds()); | 197 EXPECT_EQ(initial_minimize_button_bounds, test.minimize_button()->bounds()); |
| 198 EXPECT_EQ(initial_size_button_bounds, test.size_button()->bounds()); | 198 EXPECT_EQ(initial_size_button_bounds, test.size_button()->bounds()); |
| 199 EXPECT_EQ(initial_close_button_bounds, test.close_button()->bounds()); | 199 EXPECT_EQ(initial_close_button_bounds, test.close_button()->bounds()); |
| 200 EXPECT_EQ(container.GetPreferredSize().width(), | 200 EXPECT_EQ(container.GetPreferredSize().width(), |
| 201 initial_container_bounds.width()); | 201 initial_container_bounds.width()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace ash | 204 } // namespace ash |
| OLD | NEW |