OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wm/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
6 | 6 |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 namespace ash { | 32 namespace ash { |
33 namespace { | 33 namespace { |
34 | 34 |
35 const int kRootHeight = 600; | 35 const int kRootHeight = 600; |
36 | 36 |
37 // A simple window delegate that returns the specified min size. | 37 // A simple window delegate that returns the specified min size. |
38 class TestWindowDelegate : public aura::test::TestWindowDelegate { | 38 class TestWindowDelegate : public aura::test::TestWindowDelegate { |
39 public: | 39 public: |
40 TestWindowDelegate() { | 40 TestWindowDelegate() { |
41 } | 41 } |
42 virtual ~TestWindowDelegate() {} | 42 ~TestWindowDelegate() override {} |
43 | 43 |
44 void set_min_size(const gfx::Size& size) { | 44 void set_min_size(const gfx::Size& size) { |
45 min_size_ = size; | 45 min_size_ = size; |
46 } | 46 } |
47 | 47 |
48 void set_max_size(const gfx::Size& size) { | 48 void set_max_size(const gfx::Size& size) { |
49 max_size_ = size; | 49 max_size_ = size; |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 // Overridden from aura::Test::TestWindowDelegate: | 53 // Overridden from aura::Test::TestWindowDelegate: |
54 virtual gfx::Size GetMinimumSize() const override { | 54 gfx::Size GetMinimumSize() const override { return min_size_; } |
55 return min_size_; | |
56 } | |
57 | 55 |
58 virtual gfx::Size GetMaximumSize() const override { | 56 gfx::Size GetMaximumSize() const override { return max_size_; } |
59 return max_size_; | |
60 } | |
61 | 57 |
62 gfx::Size min_size_; | 58 gfx::Size min_size_; |
63 gfx::Size max_size_; | 59 gfx::Size max_size_; |
64 | 60 |
65 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); | 61 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); |
66 }; | 62 }; |
67 | 63 |
68 } // namespace | 64 } // namespace |
69 | 65 |
70 class WorkspaceWindowResizerTest : public test::AshTestBase { | 66 class WorkspaceWindowResizerTest : public test::AshTestBase { |
71 public: | 67 public: |
72 WorkspaceWindowResizerTest() : workspace_resizer_(NULL) {} | 68 WorkspaceWindowResizerTest() : workspace_resizer_(NULL) {} |
73 virtual ~WorkspaceWindowResizerTest() {} | 69 ~WorkspaceWindowResizerTest() override {} |
74 | 70 |
75 virtual void SetUp() override { | 71 void SetUp() override { |
76 AshTestBase::SetUp(); | 72 AshTestBase::SetUp(); |
77 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); | 73 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); |
78 // Ignore the touch slop region. | 74 // Ignore the touch slop region. |
79 ui::GestureConfiguration::GetInstance() | 75 ui::GestureConfiguration::GetInstance() |
80 ->set_max_touch_move_in_pixels_for_click(0); | 76 ->set_max_touch_move_in_pixels_for_click(0); |
81 | 77 |
82 aura::Window* root = Shell::GetPrimaryRootWindow(); | 78 aura::Window* root = Shell::GetPrimaryRootWindow(); |
83 gfx::Rect root_bounds(root->bounds()); | 79 gfx::Rect root_bounds(root->bounds()); |
84 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
85 // RootWindow and Display can't resize on Windows Ash. | 81 // RootWindow and Display can't resize on Windows Ash. |
(...skipping 20 matching lines...) Expand all Loading... |
106 ParentWindowInPrimaryRootWindow(window3_.get()); | 102 ParentWindowInPrimaryRootWindow(window3_.get()); |
107 window3_->set_id(3); | 103 window3_->set_id(3); |
108 | 104 |
109 window4_.reset(new aura::Window(&delegate4_)); | 105 window4_.reset(new aura::Window(&delegate4_)); |
110 window4_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 106 window4_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
111 window4_->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 107 window4_->Init(aura::WINDOW_LAYER_NOT_DRAWN); |
112 ParentWindowInPrimaryRootWindow(window4_.get()); | 108 ParentWindowInPrimaryRootWindow(window4_.get()); |
113 window4_->set_id(4); | 109 window4_->set_id(4); |
114 } | 110 } |
115 | 111 |
116 virtual void TearDown() override { | 112 void TearDown() override { |
117 window_.reset(); | 113 window_.reset(); |
118 window2_.reset(); | 114 window2_.reset(); |
119 window3_.reset(); | 115 window3_.reset(); |
120 window4_.reset(); | 116 window4_.reset(); |
121 touch_resize_window_.reset(); | 117 touch_resize_window_.reset(); |
122 AshTestBase::TearDown(); | 118 AshTestBase::TearDown(); |
123 } | 119 } |
124 | 120 |
125 // Returns a string identifying the z-order of each of the known child windows | 121 // Returns a string identifying the z-order of each of the known child windows |
126 // of |parent|. The returned string constains the id of the known windows and | 122 // of |parent|. The returned string constains the id of the known windows and |
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 // Drag even more to snap to the edge. | 1877 // Drag even more to snap to the edge. |
1882 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), | 1878 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), |
1883 gfx::Point(400, kRootHeight - 25), | 1879 gfx::Point(400, kRootHeight - 25), |
1884 base::TimeDelta::FromMilliseconds(10), | 1880 base::TimeDelta::FromMilliseconds(10), |
1885 5); | 1881 5); |
1886 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1882 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
1887 touch_resize_window_->bounds().ToString()); | 1883 touch_resize_window_->bounds().ToString()); |
1888 } | 1884 } |
1889 | 1885 |
1890 } // namespace ash | 1886 } // namespace ash |
OLD | NEW |