| 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/ash_constants.h" | 5 #include "ash/ash_constants.h" |
| 6 #include "ash/frame/custom_frame_view_ash.h" | 6 #include "ash/frame/custom_frame_view_ash.h" |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "ash/test/cursor_manager_test_api.h" | 9 #include "ash/test/cursor_manager_test_api.h" |
| 10 #include "ash/wm/resize_shadow.h" | 10 #include "ash/wm/resize_shadow.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 // views::WidgetDelegate which uses ash::CustomFrameViewAsh. | 26 // views::WidgetDelegate which uses ash::CustomFrameViewAsh. |
| 27 class TestWidgetDelegate : public views::WidgetDelegateView { | 27 class TestWidgetDelegate : public views::WidgetDelegateView { |
| 28 public: | 28 public: |
| 29 TestWidgetDelegate() {} | 29 TestWidgetDelegate() {} |
| 30 virtual ~TestWidgetDelegate() {} | 30 virtual ~TestWidgetDelegate() {} |
| 31 | 31 |
| 32 // views::WidgetDelegateView overrides: | 32 // views::WidgetDelegateView overrides: |
| 33 virtual bool CanResize() const OVERRIDE { | 33 virtual bool CanResize() const override { |
| 34 return true; | 34 return true; |
| 35 } | 35 } |
| 36 virtual bool CanMaximize() const OVERRIDE { | 36 virtual bool CanMaximize() const override { |
| 37 return true; | 37 return true; |
| 38 } | 38 } |
| 39 virtual bool CanMinimize() const OVERRIDE { | 39 virtual bool CanMinimize() const override { |
| 40 return true; | 40 return true; |
| 41 } | 41 } |
| 42 virtual views::NonClientFrameView* CreateNonClientFrameView( | 42 virtual views::NonClientFrameView* CreateNonClientFrameView( |
| 43 views::Widget* widget) OVERRIDE { | 43 views::Widget* widget) override { |
| 44 return new ash::CustomFrameViewAsh(widget); | 44 return new ash::CustomFrameViewAsh(widget); |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); | 48 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 // The test tests that the mouse cursor is changed and that the resize shadows | 53 // The test tests that the mouse cursor is changed and that the resize shadows |
| 54 // are shown when the mouse is hovered over the window edge. | 54 // are shown when the mouse is hovered over the window edge. |
| 55 class ResizeShadowAndCursorTest : public AshTestBase { | 55 class ResizeShadowAndCursorTest : public AshTestBase { |
| 56 public: | 56 public: |
| 57 ResizeShadowAndCursorTest() {} | 57 ResizeShadowAndCursorTest() {} |
| 58 virtual ~ResizeShadowAndCursorTest() {} | 58 virtual ~ResizeShadowAndCursorTest() {} |
| 59 | 59 |
| 60 // AshTestBase override: | 60 // AshTestBase override: |
| 61 virtual void SetUp() OVERRIDE { | 61 virtual void SetUp() override { |
| 62 AshTestBase::SetUp(); | 62 AshTestBase::SetUp(); |
| 63 | 63 |
| 64 views::Widget* widget(views::Widget::CreateWindowWithContextAndBounds( | 64 views::Widget* widget(views::Widget::CreateWindowWithContextAndBounds( |
| 65 new TestWidgetDelegate(), CurrentContext(), gfx::Rect(0, 0, 200, 100))); | 65 new TestWidgetDelegate(), CurrentContext(), gfx::Rect(0, 0, 200, 100))); |
| 66 widget->Show(); | 66 widget->Show(); |
| 67 window_ = widget->GetNativeView(); | 67 window_ = widget->GetNativeView(); |
| 68 | 68 |
| 69 // Add a child window to |window_| in order to properly test that the resize | 69 // Add a child window to |window_| in order to properly test that the resize |
| 70 // handles and the resize shadows are shown when the mouse is | 70 // handles and the resize shadows are shown when the mouse is |
| 71 // ash::kResizeInsideBoundsSize inside of |window_|'s edges. | 71 // ash::kResizeInsideBoundsSize inside of |window_|'s edges. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 generator.MoveMouseTo(200, 50); | 224 generator.MoveMouseTo(200, 50); |
| 225 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); | 225 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); |
| 226 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); | 226 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); |
| 227 generator.MoveMouseTo(200 - ash::kResizeInsideBoundsSize, 50); | 227 generator.MoveMouseTo(200 - ash::kResizeInsideBoundsSize, 50); |
| 228 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); | 228 EXPECT_EQ(HTRIGHT, ResizeShadowHitTest()); |
| 229 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); | 229 EXPECT_EQ(ui::kCursorEastResize, GetCurrentCursorType()); |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace test | 232 } // namespace test |
| 233 } // namespace ash | 233 } // namespace ash |
| OLD | NEW |