| 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/ash_layout_constants.h" | 7 #include "ash/ash_layout_constants.h" |
| 8 #include "ash/frame/caption_buttons/frame_caption_button.h" | 8 #include "ash/frame/caption_buttons/frame_caption_button.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 11 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 11 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 12 #include "grit/ash_resources.h" | 12 #include "grit/ash_resources.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/vector_icons_public.h" |
| 14 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 15 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
| 16 | 17 |
| 17 namespace ash { | 18 namespace ash { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 class TestWidgetDelegate : public views::WidgetDelegateView { | 22 class TestWidgetDelegate : public views::WidgetDelegateView { |
| 22 public: | 23 public: |
| 23 TestWidgetDelegate(bool can_maximize, bool can_minimize) | 24 TestWidgetDelegate(bool can_maximize, bool can_minimize) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return widget; | 71 return widget; |
| 71 } | 72 } |
| 72 | 73 |
| 73 // Sets arbitrary images for the icons and assign the default caption button | 74 // Sets arbitrary images for the icons and assign the default caption button |
| 74 // size to the buttons in |container|. | 75 // size to the buttons in |container|. |
| 75 void InitContainer(FrameCaptionButtonContainerView* container) { | 76 void InitContainer(FrameCaptionButtonContainerView* container) { |
| 76 container->SetButtonSize( | 77 container->SetButtonSize( |
| 77 GetAshLayoutSize(AshLayoutSize::NON_BROWSER_CAPTION_BUTTON)); | 78 GetAshLayoutSize(AshLayoutSize::NON_BROWSER_CAPTION_BUTTON)); |
| 78 for (int icon = 0; icon < CAPTION_BUTTON_ICON_COUNT; ++icon) { | 79 for (int icon = 0; icon < CAPTION_BUTTON_ICON_COUNT; ++icon) { |
| 79 container->SetButtonImage(static_cast<CaptionButtonIcon>(icon), | 80 container->SetButtonImage(static_cast<CaptionButtonIcon>(icon), |
| 80 IDR_AURA_WINDOW_CONTROL_ICON_CLOSE); | 81 gfx::VectorIconId::WINDOW_CONTROL_CLOSE); |
| 81 } | 82 } |
| 82 } | 83 } |
| 83 | 84 |
| 84 // Tests that |leftmost| and |rightmost| are at |container|'s edges. | 85 // Tests that |leftmost| and |rightmost| are at |container|'s edges. |
| 85 bool CheckButtonsAtEdges(FrameCaptionButtonContainerView* container, | 86 bool CheckButtonsAtEdges(FrameCaptionButtonContainerView* container, |
| 86 const ash::FrameCaptionButton& leftmost, | 87 const ash::FrameCaptionButton& leftmost, |
| 87 const ash::FrameCaptionButton& rightmost) { | 88 const ash::FrameCaptionButton& rightmost) { |
| 88 gfx::Rect expected(container->GetPreferredSize()); | 89 gfx::Rect expected(container->GetPreferredSize()); |
| 89 | 90 |
| 90 gfx::Rect container_size(container->GetPreferredSize()); | 91 gfx::Rect container_size(container->GetPreferredSize()); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 EXPECT_TRUE(test.size_button()->visible()); | 203 EXPECT_TRUE(test.size_button()->visible()); |
| 203 EXPECT_TRUE(test.close_button()->visible()); | 204 EXPECT_TRUE(test.close_button()->visible()); |
| 204 EXPECT_EQ(initial_minimize_button_bounds, test.minimize_button()->bounds()); | 205 EXPECT_EQ(initial_minimize_button_bounds, test.minimize_button()->bounds()); |
| 205 EXPECT_EQ(initial_size_button_bounds, test.size_button()->bounds()); | 206 EXPECT_EQ(initial_size_button_bounds, test.size_button()->bounds()); |
| 206 EXPECT_EQ(initial_close_button_bounds, test.close_button()->bounds()); | 207 EXPECT_EQ(initial_close_button_bounds, test.close_button()->bounds()); |
| 207 EXPECT_EQ(container.GetPreferredSize().width(), | 208 EXPECT_EQ(container.GetPreferredSize().width(), |
| 208 initial_container_bounds.width()); | 209 initial_container_bounds.width()); |
| 209 } | 210 } |
| 210 | 211 |
| 211 } // namespace ash | 212 } // namespace ash |
| OLD | NEW |