Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock with zero width (comments on unit tests) Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/display/display_controller.h" 8 #include "ash/display/display_controller.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 virtual gfx::Size GetMaximumSize() const OVERRIDE { 58 virtual gfx::Size GetMaximumSize() const OVERRIDE {
59 return max_size_; 59 return max_size_;
60 } 60 }
61 61
62 gfx::Size min_size_; 62 gfx::Size min_size_;
63 gfx::Size max_size_; 63 gfx::Size max_size_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); 65 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate);
66 }; 66 };
67 67
68 } // namespace
69
68 class WorkspaceWindowResizerTest : public test::AshTestBase { 70 class WorkspaceWindowResizerTest : public test::AshTestBase {
69 public: 71 public:
70 WorkspaceWindowResizerTest() {} 72 WorkspaceWindowResizerTest() {}
71 virtual ~WorkspaceWindowResizerTest() {} 73 virtual ~WorkspaceWindowResizerTest() {}
72 74
73 virtual void SetUp() OVERRIDE { 75 virtual void SetUp() OVERRIDE {
74 AshTestBase::SetUp(); 76 AshTestBase::SetUp();
75 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); 77 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight));
76 78
77 aura::RootWindow* root = Shell::GetPrimaryRootWindow(); 79 aura::RootWindow* root = Shell::GetPrimaryRootWindow();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 result += base::IntToString((*i)->id()); 132 result += base::IntToString((*i)->id());
131 } 133 }
132 } 134 }
133 return result; 135 return result;
134 } 136 }
135 137
136 protected: 138 protected:
137 gfx::Point CalculateDragPoint(const WorkspaceWindowResizer& resizer, 139 gfx::Point CalculateDragPoint(const WorkspaceWindowResizer& resizer,
138 int delta_x, 140 int delta_x,
139 int delta_y) const { 141 int delta_y) const {
140 gfx::Point location = resizer.GetInitialLocationInParentForTest(); 142 gfx::Point location = resizer.GetInitialLocationForTest();
141 location.set_x(location.x() + delta_x); 143 location.set_x(location.x() + delta_x);
142 location.set_y(location.y() + delta_y); 144 location.set_y(location.y() + delta_y);
143 return location; 145 return location;
144 } 146 }
145 147
146 std::vector<aura::Window*> empty_windows() const { 148 std::vector<aura::Window*> empty_windows() const {
147 return std::vector<aura::Window*>(); 149 return std::vector<aura::Window*>();
148 } 150 }
149 151
150 internal::ShelfLayoutManager* shelf_layout_manager() { 152 internal::ShelfLayoutManager* shelf_layout_manager() {
(...skipping 21 matching lines...) Expand all
172 virtual void SetUp() OVERRIDE { 174 virtual void SetUp() OVERRIDE {
173 CommandLine::ForCurrentProcess()->AppendSwitch( 175 CommandLine::ForCurrentProcess()->AppendSwitch(
174 ash::switches::kAshEnableStickyEdges); 176 ash::switches::kAshEnableStickyEdges);
175 WorkspaceWindowResizerTest::SetUp(); 177 WorkspaceWindowResizerTest::SetUp();
176 } 178 }
177 179
178 private: 180 private:
179 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizerTestSticky); 181 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizerTestSticky);
180 }; 182 };
181 183
182 } // namespace
183
184 // Assertions around attached window resize dragging from the right with 2 184 // Assertions around attached window resize dragging from the right with 2
185 // windows. 185 // windows.
186 TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) { 186 TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) {
187 window_->SetBounds(gfx::Rect(0, 300, 400, 300)); 187 window_->SetBounds(gfx::Rect(0, 300, 400, 300));
188 window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); 188 window2_->SetBounds(gfx::Rect(400, 200, 100, 200));
189 189
190 std::vector<aura::Window*> windows; 190 std::vector<aura::Window*> windows;
191 windows.push_back(window2_.get()); 191 windows.push_back(window2_.get());
192 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 192 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
193 window_.get(), gfx::Point(), HTRIGHT, windows)); 193 window_.get(), gfx::Point(), HTRIGHT, windows));
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 ASSERT_TRUE(resizer.get()); 1580 ASSERT_TRUE(resizer.get());
1581 // Move it 50 to the left, which should contract w1 and expand w2-3. 1581 // Move it 50 to the left, which should contract w1 and expand w2-3.
1582 resizer->Drag(CalculateDragPoint(*resizer, -50, 0), 0); 1582 resizer->Drag(CalculateDragPoint(*resizer, -50, 0), 0);
1583 EXPECT_EQ("100,100 98x100", window_->bounds().ToString()); 1583 EXPECT_EQ("100,100 98x100", window_->bounds().ToString());
1584 EXPECT_EQ("198,100 101x100", window2_->bounds().ToString()); 1584 EXPECT_EQ("198,100 101x100", window2_->bounds().ToString());
1585 EXPECT_EQ("299,100 101x100", window3_->bounds().ToString()); 1585 EXPECT_EQ("299,100 101x100", window3_->bounds().ToString());
1586 } 1586 }
1587 1587
1588 } // namespace internal 1588 } // namespace internal
1589 } // namespace ash 1589 } // namespace ash
OLDNEW
« ash/wm/panels/panel_window_resizer.h ('K') | « ash/wm/workspace/workspace_window_resizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698