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
3 // found in the LICENSE file.
5 #include "ash/wm/toplevel_window_event_handler.h"
8 #include "ash/shell_window_ids.h"
9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/property_util.h"
11 #include "ash/wm/window_util.h"
12 #include "ash/wm/workspace/snap_sizer.h"
13 #include "ash/wm/workspace_controller.h"
14 #include "base/basictypes.h"
15 #include "base/compiler_specific.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/aura/client/aura_constants.h"
18 #include "ui/aura/root_window.h"
19 #include "ui/aura/test/aura_test_base.h"
20 #include "ui/aura/test/event_generator.h"
21 #include "ui/aura/test/test_activation_client.h"
22 #include "ui/aura/test/test_window_delegate.h"
23 #include "ui/base/events/event.h"
24 #include "ui/base/hit_test.h"
25 #include "ui/gfx/screen.h"
28 // Windows headers define macros for these function names which screw with us.
29 #if defined(CreateWindow)
39 // A simple window delegate that returns the specified hit-test code when
40 // requested and applies a minimum size constraint if there is one.
41 class TestWindowDelegate
: public aura::test::TestWindowDelegate
{
43 explicit TestWindowDelegate(int hittest_code
)
44 : hittest_code_(hittest_code
) {
46 virtual ~TestWindowDelegate() {}
48 void set_min_size(const gfx::Size
& size
) {
53 // Overridden from aura::Test::TestWindowDelegate:
54 virtual gfx::Size
GetMinimumSize() const OVERRIDE
{
57 virtual int GetNonClientComponent(const gfx::Point
& point
) const OVERRIDE
{
60 virtual void OnWindowDestroyed() OVERRIDE
{
67 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate
);
70 class ToplevelWindowEventHandlerTest
: public AshTestBase
{
72 ToplevelWindowEventHandlerTest() {}
73 virtual ~ToplevelWindowEventHandlerTest() {}
76 aura::Window
* CreateWindow(int hittest_code
) {
77 TestWindowDelegate
* d1
= new TestWindowDelegate(hittest_code
);
78 aura::Window
* w1
= new aura::Window(d1
);
80 w1
->Init(ui::LAYER_TEXTURED
);
81 aura::Window
* parent
=
82 Shell::GetContainer(Shell::GetPrimaryRootWindow(),
83 internal::kShellWindowId_AlwaysOnTopContainer
);
85 w1
->SetBounds(gfx::Rect(0, 0, 100, 100));
90 void DragFromCenterBy(aura::Window
* window
, int dx
, int dy
) {
91 aura::test::EventGenerator
generator(Shell::GetPrimaryRootWindow(), window
);
92 generator
.DragMouseBy(dx
, dy
);
95 void TouchDragFromCenterBy(aura::Window
* window
, int dx
, int dy
) {
96 aura::test::EventGenerator
generator(Shell::GetPrimaryRootWindow(), window
);
97 generator
.PressMoveAndReleaseTouchBy(dx
, dy
);
100 scoped_ptr
<ToplevelWindowEventHandler
> handler_
;
103 DISALLOW_COPY_AND_ASSIGN(ToplevelWindowEventHandlerTest
);
108 TEST_F(ToplevelWindowEventHandlerTest
, Caption
) {
109 scoped_ptr
<aura::Window
> w1(CreateWindow(HTCAPTION
));
110 gfx::Size size
= w1
->bounds().size();
111 DragFromCenterBy(w1
.get(), 100, 100);
112 // Position should have been offset by 100,100.
113 EXPECT_EQ("100,100", w1
->bounds().origin().ToString());
114 // Size should not have.
115 EXPECT_EQ(size
.ToString(), w1
->bounds().size().ToString());
117 TouchDragFromCenterBy(w1
.get(), 100, 100);
118 // Position should have been offset by 100,100.
119 EXPECT_EQ("200,200", w1
->bounds().origin().ToString());
120 // Size should not have.
121 EXPECT_EQ(size
.ToString(), w1
->bounds().size().ToString());
124 TEST_F(ToplevelWindowEventHandlerTest
, BottomRight
) {
125 scoped_ptr
<aura::Window
> w1(CreateWindow(HTBOTTOMRIGHT
));
126 gfx::Point position
= w1
->bounds().origin();
127 DragFromCenterBy(w1
.get(), 100, 100);
128 // Position should not have changed.
129 EXPECT_EQ(position
, w1
->bounds().origin());
130 // Size should have increased by 100,100.
131 EXPECT_EQ(gfx::Size(200, 200), w1
->bounds().size());
134 TEST_F(ToplevelWindowEventHandlerTest
, GrowBox
) {
135 scoped_ptr
<aura::Window
> w1(CreateWindow(HTGROWBOX
));
136 TestWindowDelegate
* window_delegate
=
137 static_cast<TestWindowDelegate
*>(w1
->delegate());
138 window_delegate
->set_min_size(gfx::Size(40, 40));
140 gfx::Point position
= w1
->bounds().origin();
141 aura::test::EventGenerator
generator(Shell::GetPrimaryRootWindow());
142 generator
.MoveMouseToCenterOf(w1
.get());
143 generator
.DragMouseBy(100, 100);
144 // Position should not have changed.
145 EXPECT_EQ(position
, w1
->bounds().origin());
146 // Size should have increased by 100,100.
147 EXPECT_EQ(gfx::Size(200, 200), w1
->bounds().size());
149 // Shrink the wnidow by (-100, -100).
150 generator
.DragMouseBy(-100, -100);
151 // Position should not have changed.
152 EXPECT_EQ(position
, w1
->bounds().origin());
153 // Size should have decreased by 100,100.
154 EXPECT_EQ(gfx::Size(100, 100), w1
->bounds().size());
156 // Enforce minimum size.
157 generator
.DragMouseBy(-60, -60);
158 EXPECT_EQ(position
, w1
->bounds().origin());
159 EXPECT_EQ(gfx::Size(40, 40), w1
->bounds().size());
162 TEST_F(ToplevelWindowEventHandlerTest
, Right
) {
163 scoped_ptr
<aura::Window
> w1(CreateWindow(HTRIGHT
));
164 gfx::Point position
= w1
->bounds().origin();
165 DragFromCenterBy(w1
.get(), 100, 100);
166 // Position should not have changed.
167 EXPECT_EQ(position
, w1
->bounds().origin());
168 // Size should have increased by 100,0.
169 EXPECT_EQ(gfx::Size(200, 100), w1
->bounds().size());
172 TEST_F(ToplevelWindowEventHandlerTest
, Bottom
) {
173 scoped_ptr
<aura::Window
> w1(CreateWindow(HTBOTTOM
));
174 gfx::Point position
= w1
->bounds().origin();
175 DragFromCenterBy(w1
.get(), 100, 100);
176 // Position should not have changed.
177 EXPECT_EQ(position
, w1
->bounds().origin());
178 // Size should have increased by 0,100.
179 EXPECT_EQ(gfx::Size(100, 200), w1
->bounds().size());
182 TEST_F(ToplevelWindowEventHandlerTest
, TopRight
) {
183 scoped_ptr
<aura::Window
> w1(CreateWindow(HTTOPRIGHT
));
184 DragFromCenterBy(w1
.get(), -50, 50);
185 // Position should have been offset by 0,50.
186 EXPECT_EQ(gfx::Point(0, 50), w1
->bounds().origin());
187 // Size should have decreased by 50,50.
188 EXPECT_EQ(gfx::Size(50, 50), w1
->bounds().size());
191 TEST_F(ToplevelWindowEventHandlerTest
, Top
) {
192 scoped_ptr
<aura::Window
> w1(CreateWindow(HTTOP
));
193 DragFromCenterBy(w1
.get(), 50, 50);
194 // Position should have been offset by 0,50.
195 EXPECT_EQ(gfx::Point(0, 50), w1
->bounds().origin());
196 // Size should have decreased by 0,50.
197 EXPECT_EQ(gfx::Size(100, 50), w1
->bounds().size());
200 TEST_F(ToplevelWindowEventHandlerTest
, Left
) {
201 scoped_ptr
<aura::Window
> w1(CreateWindow(HTLEFT
));
202 DragFromCenterBy(w1
.get(), 50, 50);
203 // Position should have been offset by 50,0.
204 EXPECT_EQ(gfx::Point(50, 0), w1
->bounds().origin());
205 // Size should have decreased by 50,0.
206 EXPECT_EQ(gfx::Size(50, 100), w1
->bounds().size());
209 TEST_F(ToplevelWindowEventHandlerTest
, BottomLeft
) {
210 scoped_ptr
<aura::Window
> w1(CreateWindow(HTBOTTOMLEFT
));
211 DragFromCenterBy(w1
.get(), 50, -50);
212 // Position should have been offset by 50,0.
213 EXPECT_EQ(gfx::Point(50, 0), w1
->bounds().origin());
214 // Size should have decreased by 50,50.
215 EXPECT_EQ(gfx::Size(50, 50), w1
->bounds().size());
218 TEST_F(ToplevelWindowEventHandlerTest
, TopLeft
) {
219 scoped_ptr
<aura::Window
> w1(CreateWindow(HTTOPLEFT
));
220 DragFromCenterBy(w1
.get(), 50, 50);
221 // Position should have been offset by 50,50.
222 EXPECT_EQ(gfx::Point(50, 50), w1
->bounds().origin());
223 // Size should have decreased by 50,50.
224 EXPECT_EQ(gfx::Size(50, 50), w1
->bounds().size());
227 TEST_F(ToplevelWindowEventHandlerTest
, Client
) {
228 scoped_ptr
<aura::Window
> w1(CreateWindow(HTCLIENT
));
229 gfx::Rect bounds
= w1
->bounds();
230 DragFromCenterBy(w1
.get(), 100, 100);
231 // Neither position nor size should have changed.
232 EXPECT_EQ(bounds
, w1
->bounds());
235 TEST_F(ToplevelWindowEventHandlerTest
, LeftPastMinimum
) {
236 scoped_ptr
<aura::Window
> w1(CreateWindow(HTLEFT
));
237 TestWindowDelegate
* window_delegate
=
238 static_cast<TestWindowDelegate
*>(w1
->delegate());
239 window_delegate
->set_min_size(gfx::Size(40, 40));
241 // Simulate a large left-to-right drag. Window width should be clamped to
242 // minimum and position change should be limited as well.
243 DragFromCenterBy(w1
.get(), 333, 0);
244 EXPECT_EQ(gfx::Point(60, 0), w1
->bounds().origin());
245 EXPECT_EQ(gfx::Size(40, 100), w1
->bounds().size());
248 TEST_F(ToplevelWindowEventHandlerTest
, RightPastMinimum
) {
249 scoped_ptr
<aura::Window
> w1(CreateWindow(HTRIGHT
));
250 TestWindowDelegate
* window_delegate
=
251 static_cast<TestWindowDelegate
*>(w1
->delegate());
252 window_delegate
->set_min_size(gfx::Size(40, 40));
253 gfx::Point position
= w1
->bounds().origin();
255 // Simulate a large right-to-left drag. Window width should be clamped to
256 // minimum and position should not change.
257 DragFromCenterBy(w1
.get(), -333, 0);
258 EXPECT_EQ(position
, w1
->bounds().origin());
259 EXPECT_EQ(gfx::Size(40, 100), w1
->bounds().size());
262 TEST_F(ToplevelWindowEventHandlerTest
, TopLeftPastMinimum
) {
263 scoped_ptr
<aura::Window
> w1(CreateWindow(HTTOPLEFT
));
264 TestWindowDelegate
* window_delegate
=
265 static_cast<TestWindowDelegate
*>(w1
->delegate());
266 window_delegate
->set_min_size(gfx::Size(40, 40));
268 // Simulate a large top-left to bottom-right drag. Window width should be
269 // clamped to minimum and position should be limited.
270 DragFromCenterBy(w1
.get(), 333, 444);
271 EXPECT_EQ(gfx::Point(60, 60), w1
->bounds().origin());
272 EXPECT_EQ(gfx::Size(40, 40), w1
->bounds().size());
275 TEST_F(ToplevelWindowEventHandlerTest
, TopRightPastMinimum
) {
276 scoped_ptr
<aura::Window
> w1(CreateWindow(HTTOPRIGHT
));
277 TestWindowDelegate
* window_delegate
=
278 static_cast<TestWindowDelegate
*>(w1
->delegate());
279 window_delegate
->set_min_size(gfx::Size(40, 40));
281 // Simulate a large top-right to bottom-left drag. Window size should be
282 // clamped to minimum, x position should not change, and y position should
284 DragFromCenterBy(w1
.get(), -333, 444);
285 EXPECT_EQ(gfx::Point(0, 60), w1
->bounds().origin());
286 EXPECT_EQ(gfx::Size(40, 40), w1
->bounds().size());
289 TEST_F(ToplevelWindowEventHandlerTest
, BottomLeftPastMinimum
) {
290 scoped_ptr
<aura::Window
> w1(CreateWindow(HTBOTTOMLEFT
));
291 TestWindowDelegate
* window_delegate
=
292 static_cast<TestWindowDelegate
*>(w1
->delegate());
293 window_delegate
->set_min_size(gfx::Size(40, 40));
295 // Simulate a large bottom-left to top-right drag. Window size should be
296 // clamped to minimum, x position should be clamped, and y position should
298 DragFromCenterBy(w1
.get(), 333, -444);
299 EXPECT_EQ(gfx::Point(60, 0), w1
->bounds().origin());
300 EXPECT_EQ(gfx::Size(40, 40), w1
->bounds().size());
303 TEST_F(ToplevelWindowEventHandlerTest
, BottomRightPastMinimum
) {
304 scoped_ptr
<aura::Window
> w1(CreateWindow(HTBOTTOMRIGHT
));
305 TestWindowDelegate
* window_delegate
=
306 static_cast<TestWindowDelegate
*>(w1
->delegate());
307 window_delegate
->set_min_size(gfx::Size(40, 40));
308 gfx::Point position
= w1
->bounds().origin();
310 // Simulate a large bottom-right to top-left drag. Window size should be
311 // clamped to minimum and position should not change.
312 DragFromCenterBy(w1
.get(), -333, -444);
313 EXPECT_EQ(position
, w1
->bounds().origin());
314 EXPECT_EQ(gfx::Size(40, 40), w1
->bounds().size());
317 TEST_F(ToplevelWindowEventHandlerTest
, BottomRightWorkArea
) {
318 scoped_ptr
<aura::Window
> target(CreateWindow(HTBOTTOMRIGHT
));
319 gfx::Rect work_area
= Shell::GetScreen()->GetDisplayNearestWindow(
320 target
.get()).work_area();
321 gfx::Point position
= target
->bounds().origin();
322 // Drag further than work_area bottom.
323 DragFromCenterBy(target
.get(), 100, work_area
.height());
324 // Position should not have changed.
325 EXPECT_EQ(position
, target
->bounds().origin());
326 // Size should have increased by 100, work_area.height() - target->bounds.y()
327 EXPECT_EQ(gfx::Size(200, work_area
.height() - target
->bounds().y()),
328 target
->bounds().size());
331 TEST_F(ToplevelWindowEventHandlerTest
, BottomLeftWorkArea
) {
332 scoped_ptr
<aura::Window
> target(CreateWindow(HTBOTTOMLEFT
));
333 gfx::Rect work_area
= Shell::GetScreen()->GetDisplayNearestWindow(
334 target
.get()).work_area();
335 gfx::Point position
= target
->bounds().origin();
336 // Drag further than work_area bottom.
337 DragFromCenterBy(target
.get(), -30, work_area
.height());
338 // origin is now at 70, 100.
339 EXPECT_EQ(position
.x() - 30, target
->bounds().x());
340 EXPECT_EQ(position
.y(), target
->bounds().y());
341 // Size should have increased by 30, work_area.height() - target->bounds.y()
342 EXPECT_EQ(gfx::Size(130, work_area
.height() - target
->bounds().y()),
343 target
->bounds().size());
346 TEST_F(ToplevelWindowEventHandlerTest
, BottomWorkArea
) {
347 scoped_ptr
<aura::Window
> target(CreateWindow(HTBOTTOM
));
348 gfx::Rect work_area
= Shell::GetScreen()->GetDisplayNearestWindow(
349 target
.get()).work_area();
350 gfx::Point position
= target
->bounds().origin();
351 // Drag further than work_area bottom.
352 DragFromCenterBy(target
.get(), 0, work_area
.height());
353 // Position should not have changed.
354 EXPECT_EQ(position
, target
->bounds().origin());
355 // Size should have increased by 0, work_area.height() - target->bounds.y()
356 EXPECT_EQ(gfx::Size(100, work_area
.height() - target
->bounds().y()),
357 target
->bounds().size());
360 // Verifies we don't let windows drag to a -y location.
361 TEST_F(ToplevelWindowEventHandlerTest
, DontDragToNegativeY
) {
362 scoped_ptr
<aura::Window
> target(CreateWindow(HTTOP
));
363 aura::test::EventGenerator
generator(Shell::GetPrimaryRootWindow(),
365 generator
.MoveMouseTo(0, 5);
366 generator
.DragMouseBy(0, -5);
367 // The y location and height should not have changed.
368 EXPECT_EQ(0, target
->bounds().y());
369 EXPECT_EQ(100, target
->bounds().height());
372 // Verifies we don't let windows go bigger than the display width.
373 TEST_F(ToplevelWindowEventHandlerTest
, DontGotWiderThanScreen
) {
374 scoped_ptr
<aura::Window
> target(CreateWindow(HTRIGHT
));
375 gfx::Rect work_area
= Shell::GetScreen()->GetDisplayNearestWindow(
376 target
.get()).bounds();
377 DragFromCenterBy(target
.get(), work_area
.width() * 2, 0);
378 // The y location and height should not have changed.
379 EXPECT_EQ(work_area
.width(), target
->bounds().width());
382 // Verifies that touch-gestures drag the window correctly.
383 TEST_F(ToplevelWindowEventHandlerTest
, GestureDrag
) {
384 scoped_ptr
<aura::Window
> target(CreateWindow(HTCAPTION
));
385 aura::test::EventGenerator
generator(Shell::GetPrimaryRootWindow(),
387 gfx::Rect old_bounds
= target
->bounds();
388 gfx::Point
location(5, 5);
389 target
->SetProperty(aura::client::kCanMaximizeKey
, true);
391 gfx::Point end
= location
;
395 // Get the expected snapped bounds before snapping.
396 internal::SnapSizer
sizer(target
.get(), location
,
397 internal::SnapSizer::RIGHT_EDGE
,
398 internal::SnapSizer::OTHER_INPUT
);
399 gfx::Rect snapped_bounds
= sizer
.GetSnapBounds(target
->bounds());
402 generator
.GestureScrollSequence(location
, end
,
403 base::TimeDelta::FromMilliseconds(5),
405 RunAllPendingInMessageLoop();
407 // Verify that the window has moved after the gesture.
408 EXPECT_NE(old_bounds
.ToString(), target
->bounds().ToString());
409 EXPECT_EQ(snapped_bounds
.ToString(), target
->bounds().ToString());
412 old_bounds
= target
->bounds();
416 // Get the expected snapped bounds before snapping.
417 internal::SnapSizer
sizer(target
.get(), location
,
418 internal::SnapSizer::LEFT_EDGE
,
419 internal::SnapSizer::OTHER_INPUT
);
420 gfx::Rect snapped_bounds
= sizer
.GetSnapBounds(target
->bounds());
421 end
= location
= target
->GetBoundsInRootWindow().CenterPoint();
423 generator
.GestureScrollSequence(location
, end
,
424 base::TimeDelta::FromMilliseconds(5),
426 RunAllPendingInMessageLoop();
428 EXPECT_NE(old_bounds
.ToString(), target
->bounds().ToString());
429 EXPECT_EQ(snapped_bounds
.ToString(), target
->bounds().ToString());
432 gfx::Rect bounds_before_maximization
= target
->bounds();
433 bounds_before_maximization
.Offset(0, 100);
434 target
->SetBounds(bounds_before_maximization
);
435 old_bounds
= target
->bounds();
438 end
= location
= target
->GetBoundsInRootWindow().CenterPoint();
440 generator
.GestureScrollSequence(location
, end
,
441 base::TimeDelta::FromMilliseconds(5),
443 RunAllPendingInMessageLoop();
444 EXPECT_NE(old_bounds
.ToString(), target
->bounds().ToString());
445 EXPECT_TRUE(wm::IsWindowMaximized(target
.get()));
446 EXPECT_EQ(old_bounds
.ToString(),
447 GetRestoreBoundsInScreen(target
.get())->ToString());
449 wm::RestoreWindow(target
.get());
450 target
->SetBounds(old_bounds
);
453 end
= location
= target
->GetBoundsInRootWindow().CenterPoint();
455 generator
.GestureScrollSequence(location
, end
,
456 base::TimeDelta::FromMilliseconds(5),
458 RunAllPendingInMessageLoop();
459 EXPECT_NE(old_bounds
.ToString(), target
->bounds().ToString());
460 EXPECT_TRUE(wm::IsWindowMinimized(target
.get()));
461 EXPECT_TRUE(GetWindowAlwaysRestoresToRestoreBounds(target
.get()));
462 EXPECT_EQ(old_bounds
.ToString(),
463 GetRestoreBoundsInScreen(target
.get())->ToString());
466 TEST_F(ToplevelWindowEventHandlerTest
, GestureDragToRestore
) {
467 scoped_ptr
<aura::Window
> window(
468 CreateTestWindowInShellWithDelegate(
469 new TestWindowDelegate(HTCAPTION
),
471 gfx::Rect(10, 20, 30, 40)));
473 ash::wm::ActivateWindow(window
.get());
475 aura::test::EventGenerator
generator(Shell::GetPrimaryRootWindow(),
477 gfx::Rect old_bounds
= window
->bounds();
478 gfx::Point location
, end
;
479 end
= location
= window
->GetBoundsInRootWindow().CenterPoint();
481 generator
.GestureScrollSequence(location
, end
,
482 base::TimeDelta::FromMilliseconds(5),
484 RunAllPendingInMessageLoop();
485 EXPECT_NE(old_bounds
.ToString(), window
->bounds().ToString());
486 EXPECT_TRUE(wm::IsWindowMinimized(window
.get()));
487 EXPECT_TRUE(GetWindowAlwaysRestoresToRestoreBounds(window
.get()));
488 EXPECT_EQ(old_bounds
.ToString(),
489 GetRestoreBoundsInScreen(window
.get())->ToString());
492 // Verifies pressing escape resets the bounds to the original bounds.
493 // Disabled crbug.com/166219.
494 #if defined(OS_MACOSX) || defined(OS_WIN)
495 #define MAYBE_EscapeReverts DISABLED_EscapeReverts
497 #define MAYBE_EscapeReverts EscapeReverts
499 TEST_F(ToplevelWindowEventHandlerTest
, MAYBE_EscapeReverts
) {
500 scoped_ptr
<aura::Window
> target(CreateWindow(HTBOTTOMRIGHT
));
501 aura::test::EventGenerator
generator(Shell::GetPrimaryRootWindow(),
503 generator
.PressLeftButton();
504 generator
.MoveMouseBy(10, 11);
506 // Execute any scheduled draws so that pending mouse events are processed.
507 RunAllPendingInMessageLoop();
509 EXPECT_EQ("0,0 110x111", target
->bounds().ToString());
510 generator
.PressKey(ui::VKEY_ESCAPE
, 0);
511 generator
.ReleaseKey(ui::VKEY_ESCAPE
, 0);
512 EXPECT_EQ("0,0 100x100", target
->bounds().ToString());
515 // Verifies window minimization/maximization completes drag.
516 // Disabled crbug.com/166219.
518 #define MAYBE_MinimizeMaximizeCompletes DISABLED_MinimizeMaximizeCompletes
520 #define MAYBE_MinimizeMaximizeCompletes MinimizeMaximizeCompletes
522 TEST_F(ToplevelWindowEventHandlerTest
, MAYBE_MinimizeMaximizeCompletes
) {
523 // Once window is minimized, window dragging completes.
525 scoped_ptr
<aura::Window
> target(CreateWindow(HTCAPTION
));
527 aura::test::EventGenerator
generator(Shell::GetPrimaryRootWindow(),
529 generator
.PressLeftButton();
530 generator
.MoveMouseBy(10, 11);
531 RunAllPendingInMessageLoop();
532 EXPECT_EQ("10,11 100x100", target
->bounds().ToString());
534 wm::MinimizeWindow(target
.get());
535 wm::RestoreWindow(target
.get());
537 generator
.PressLeftButton();
538 generator
.MoveMouseBy(10, 11);
539 RunAllPendingInMessageLoop();
540 EXPECT_EQ("10,11 100x100", target
->bounds().ToString());
543 // Once window is maximized, window dragging completes.
545 scoped_ptr
<aura::Window
> target(CreateWindow(HTCAPTION
));
547 aura::test::EventGenerator
generator(Shell::GetPrimaryRootWindow(),
549 generator
.PressLeftButton();
550 generator
.MoveMouseBy(10, 11);
551 RunAllPendingInMessageLoop();
552 EXPECT_EQ("10,11 100x100", target
->bounds().ToString());
554 wm::MaximizeWindow(target
.get());
555 wm::RestoreWindow(target
.get());
557 generator
.PressLeftButton();
558 generator
.MoveMouseBy(10, 11);
559 RunAllPendingInMessageLoop();
560 EXPECT_EQ("10,11 100x100", target
->bounds().ToString());