Mac: Fix performance issues with remote CoreAnimation
[chromium-blink-merge.git] / ash / wm / panels / panel_window_resizer_unittest.cc
blob73500b394be3ff8b9ff3f4a276550c54361b6aee
1 // Copyright (c) 2013 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/panels/panel_window_resizer.h"
7 #include "ash/root_window_controller.h"
8 #include "ash/shelf/shelf.h"
9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_model.h"
11 #include "ash/shelf/shelf_types.h"
12 #include "ash/shelf/shelf_util.h"
13 #include "ash/shelf/shelf_widget.h"
14 #include "ash/shell.h"
15 #include "ash/shell_window_ids.h"
16 #include "ash/test/ash_test_base.h"
17 #include "ash/test/cursor_manager_test_api.h"
18 #include "ash/test/shell_test_api.h"
19 #include "ash/test/test_shelf_delegate.h"
20 #include "ash/wm/drag_window_resizer.h"
21 #include "ash/wm/panels/panel_layout_manager.h"
22 #include "ash/wm/window_state.h"
23 #include "ash/wm/wm_event.h"
24 #include "base/win/windows_version.h"
25 #include "ui/aura/client/aura_constants.h"
26 #include "ui/aura/window_event_dispatcher.h"
27 #include "ui/base/hit_test.h"
28 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/ui_base_types.h"
30 #include "ui/views/widget/widget.h"
31 #include "ui/wm/core/window_util.h"
33 namespace ash {
35 class PanelWindowResizerTest : public test::AshTestBase {
36 public:
37 PanelWindowResizerTest() {}
38 ~PanelWindowResizerTest() override {}
40 void SetUp() override {
41 AshTestBase::SetUp();
42 UpdateDisplay("600x400");
43 test::ShellTestApi test_api(Shell::GetInstance());
44 model_ = test_api.shelf_model();
45 shelf_delegate_ = test::TestShelfDelegate::instance();
48 void TearDown() override { AshTestBase::TearDown(); }
50 protected:
51 gfx::Point CalculateDragPoint(const WindowResizer& resizer,
52 int delta_x,
53 int delta_y) const {
54 gfx::Point location = resizer.GetInitialLocation();
55 location.set_x(location.x() + delta_x);
56 location.set_y(location.y() + delta_y);
57 return location;
60 aura::Window* CreatePanelWindow(const gfx::Point& origin) {
61 gfx::Rect bounds(origin, gfx::Size(101, 101));
62 aura::Window* window = CreateTestWindowInShellWithDelegateAndType(
63 NULL, ui::wm::WINDOW_TYPE_PANEL, 0, bounds);
64 shelf_delegate_->AddShelfItem(window);
65 return window;
68 void DragStart(aura::Window* window) {
69 resizer_.reset(CreateWindowResizer(
70 window,
71 window->bounds().origin(),
72 HTCAPTION,
73 aura::client::WINDOW_MOVE_SOURCE_MOUSE).release());
74 ASSERT_TRUE(resizer_.get());
77 void DragMove(int dx, int dy) {
78 resizer_->Drag(CalculateDragPoint(*resizer_, dx, dy), 0);
81 void DragEnd() {
82 resizer_->CompleteDrag();
83 resizer_.reset();
86 void DragRevert() {
87 resizer_->RevertDrag();
88 resizer_.reset();
91 // Test dragging the panel slightly, then detaching, and then reattaching
92 // dragging out by the vector (dx, dy).
93 void DetachReattachTest(aura::Window* window, int dx, int dy) {
94 wm::WindowState* window_state = wm::GetWindowState(window);
95 EXPECT_TRUE(window_state->panel_attached());
96 aura::Window* root_window = window->GetRootWindow();
97 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
98 DragStart(window);
99 gfx::Rect initial_bounds = window->GetBoundsInScreen();
101 // Drag the panel slightly. The window should still be snapped to the
102 // launcher.
103 DragMove(dx * 5, dy * 5);
104 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
105 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y());
107 // Drag further out and the window should now move to the cursor.
108 DragMove(dx * 100, dy * 100);
109 EXPECT_EQ(initial_bounds.x() + dx * 100, window->GetBoundsInScreen().x());
110 EXPECT_EQ(initial_bounds.y() + dy * 100, window->GetBoundsInScreen().y());
112 // The panel should be detached when the drag completes.
113 DragEnd();
115 EXPECT_FALSE(window_state->panel_attached());
116 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
117 EXPECT_EQ(root_window, window->GetRootWindow());
119 DragStart(window);
120 // Drag the panel down.
121 DragMove(dx * -95, dy * -95);
122 // Release the mouse and the panel should be reattached.
123 DragEnd();
125 // The panel should be reattached and have snapped to the launcher.
126 EXPECT_TRUE(window_state->panel_attached());
127 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
128 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y());
129 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
132 void TestWindowOrder(const std::vector<aura::Window*>& window_order) {
133 int panel_index = model_->FirstPanelIndex();
134 EXPECT_EQ((int)(panel_index + window_order.size()), model_->item_count());
135 for (std::vector<aura::Window*>::const_iterator iter =
136 window_order.begin(); iter != window_order.end();
137 ++iter, ++panel_index) {
138 ShelfID id = GetShelfIDForWindow(*iter);
139 EXPECT_EQ(id, model_->items()[panel_index].id);
143 // Test dragging panel window along the shelf and verify that panel icons
144 // are reordered appropriately.
145 void DragAlongShelfReorder(int dx, int dy) {
146 gfx::Point origin(0, 0);
147 scoped_ptr<aura::Window> w1(CreatePanelWindow(origin));
148 scoped_ptr<aura::Window> w2(CreatePanelWindow(origin));
149 std::vector<aura::Window*> window_order_original;
150 std::vector<aura::Window*> window_order_swapped;
151 window_order_original.push_back(w1.get());
152 window_order_original.push_back(w2.get());
153 window_order_swapped.push_back(w2.get());
154 window_order_swapped.push_back(w1.get());
155 TestWindowOrder(window_order_original);
157 // Drag window #2 to the beginning of the shelf.
158 DragStart(w2.get());
159 DragMove(400 * dx, 400 * dy);
160 TestWindowOrder(window_order_swapped);
161 DragEnd();
163 // Expect swapped window order.
164 TestWindowOrder(window_order_swapped);
166 // Drag window #2 back to the end.
167 DragStart(w2.get());
168 DragMove(-400 * dx, -400 * dy);
169 TestWindowOrder(window_order_original);
170 DragEnd();
172 // Expect original order.
173 TestWindowOrder(window_order_original);
176 private:
177 scoped_ptr<WindowResizer> resizer_;
178 PanelLayoutManager* panel_layout_manager_;
179 ShelfModel* model_;
180 test::TestShelfDelegate* shelf_delegate_;
182 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTest);
185 class PanelWindowResizerTextDirectionTest
186 : public PanelWindowResizerTest,
187 public testing::WithParamInterface<bool> {
188 public:
189 PanelWindowResizerTextDirectionTest() : is_rtl_(GetParam()) {}
190 virtual ~PanelWindowResizerTextDirectionTest() {}
192 void SetUp() override {
193 original_locale = l10n_util::GetApplicationLocale(std::string());
194 if (is_rtl_)
195 base::i18n::SetICUDefaultLocale("he");
196 PanelWindowResizerTest::SetUp();
197 ASSERT_EQ(is_rtl_, base::i18n::IsRTL());
200 void TearDown() override {
201 if (is_rtl_)
202 base::i18n::SetICUDefaultLocale(original_locale);
203 PanelWindowResizerTest::TearDown();
206 private:
207 bool is_rtl_;
208 std::string original_locale;
210 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTextDirectionTest);
213 // PanelLayoutManager and PanelWindowResizer should work if panels have
214 // transient children of supported types.
215 class PanelWindowResizerTransientTest
216 : public PanelWindowResizerTest,
217 public testing::WithParamInterface<ui::wm::WindowType> {
218 public:
219 PanelWindowResizerTransientTest() : transient_window_type_(GetParam()) {}
220 virtual ~PanelWindowResizerTransientTest() {}
222 protected:
223 ui::wm::WindowType transient_window_type_;
225 private:
226 DISALLOW_COPY_AND_ASSIGN(PanelWindowResizerTransientTest);
229 // Verifies a window can be dragged from the panel and detached and then
230 // reattached.
231 TEST_F(PanelWindowResizerTest, PanelDetachReattachBottom) {
232 if (!SupportsHostWindowResize())
233 return;
235 scoped_ptr<aura::Window> window(
236 CreatePanelWindow(gfx::Point(0, 0)));
237 DetachReattachTest(window.get(), 0, -1);
240 TEST_F(PanelWindowResizerTest, PanelDetachReattachLeft) {
241 if (!SupportsHostWindowResize())
242 return;
244 ash::Shell* shell = ash::Shell::GetInstance();
245 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow());
246 scoped_ptr<aura::Window> window(
247 CreatePanelWindow(gfx::Point(0, 0)));
248 DetachReattachTest(window.get(), 1, 0);
251 TEST_F(PanelWindowResizerTest, PanelDetachReattachRight) {
252 if (!SupportsHostWindowResize())
253 return;
255 ash::Shell* shell = ash::Shell::GetInstance();
256 shell->SetShelfAlignment(SHELF_ALIGNMENT_RIGHT,
257 shell->GetPrimaryRootWindow());
258 scoped_ptr<aura::Window> window(
259 CreatePanelWindow(gfx::Point(0, 0)));
260 DetachReattachTest(window.get(), -1, 0);
263 TEST_F(PanelWindowResizerTest, PanelDetachReattachTop) {
264 if (!SupportsHostWindowResize())
265 return;
267 ash::Shell* shell = ash::Shell::GetInstance();
268 shell->SetShelfAlignment(SHELF_ALIGNMENT_TOP, shell->GetPrimaryRootWindow());
269 scoped_ptr<aura::Window> window(
270 CreatePanelWindow(gfx::Point(0, 0)));
271 DetachReattachTest(window.get(), 0, 1);
274 // Tests that a drag continues when the shelf is hidden. This occurs as part of
275 // the animation when switching profiles. http://crbug.com/393047.
276 TEST_F(PanelWindowResizerTest, DetachThenHideShelf) {
277 if (!SupportsHostWindowResize())
278 return;
279 scoped_ptr<aura::Window> window(
280 CreatePanelWindow(gfx::Point(0, 0)));
281 wm::WindowState* state = wm::GetWindowState(window.get());
282 gfx::Rect expected_bounds = window->GetBoundsInScreen();
283 expected_bounds.set_y(expected_bounds.y() - 100);
284 DragStart(window.get());
285 DragMove(0, -100);
286 EXPECT_FALSE(state->IsMinimized());
288 // Hide the shelf. This minimizes all attached windows but should ignore
289 // the dragged window.
290 ShelfLayoutManager* shelf = RootWindowController::ForWindow(window.get())->
291 shelf()->shelf_layout_manager();
292 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
293 shelf->UpdateVisibilityState();
294 RunAllPendingInMessageLoop();
295 EXPECT_FALSE(state->IsMinimized());
296 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
297 DragEnd();
299 // When the drag ends the window should be detached and placed where it was
300 // dragged to.
301 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
302 EXPECT_FALSE(state->IsMinimized());
303 EXPECT_EQ(expected_bounds.ToString(), window->GetBoundsInScreen().ToString());
306 TEST_F(PanelWindowResizerTest, PanelDetachReattachMultipleDisplays) {
307 if (!SupportsMultipleDisplays())
308 return;
310 UpdateDisplay("600x400,600x400");
311 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
312 scoped_ptr<aura::Window> window(
313 CreatePanelWindow(gfx::Point(600, 0)));
314 EXPECT_EQ(root_windows[1], window->GetRootWindow());
315 DetachReattachTest(window.get(), 0, -1);
318 TEST_F(PanelWindowResizerTest, DetachThenDragAcrossDisplays) {
319 if (!SupportsMultipleDisplays())
320 return;
322 UpdateDisplay("600x400,600x400");
323 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
324 scoped_ptr<aura::Window> window(
325 CreatePanelWindow(gfx::Point(0, 0)));
326 gfx::Rect initial_bounds = window->GetBoundsInScreen();
327 EXPECT_EQ(root_windows[0], window->GetRootWindow());
328 DragStart(window.get());
329 DragMove(0, -100);
330 DragEnd();
331 EXPECT_EQ(root_windows[0], window->GetRootWindow());
332 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x());
333 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
334 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached());
335 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
337 DragStart(window.get());
338 DragMove(500, 0);
339 DragEnd();
340 EXPECT_EQ(root_windows[1], window->GetRootWindow());
341 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
342 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
343 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached());
344 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
347 TEST_F(PanelWindowResizerTest, DetachAcrossDisplays) {
348 if (!SupportsMultipleDisplays())
349 return;
351 UpdateDisplay("600x400,600x400");
352 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
353 scoped_ptr<aura::Window> window(
354 CreatePanelWindow(gfx::Point(0, 0)));
355 gfx::Rect initial_bounds = window->GetBoundsInScreen();
356 EXPECT_EQ(root_windows[0], window->GetRootWindow());
357 DragStart(window.get());
358 DragMove(500, -100);
359 DragEnd();
360 EXPECT_EQ(root_windows[1], window->GetRootWindow());
361 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
362 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y());
363 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached());
364 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
367 TEST_F(PanelWindowResizerTest, DetachThenAttachToSecondDisplay) {
368 if (!SupportsMultipleDisplays())
369 return;
371 UpdateDisplay("600x400,600x600");
372 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
373 scoped_ptr<aura::Window> window(
374 CreatePanelWindow(gfx::Point(0, 0)));
375 gfx::Rect initial_bounds = window->GetBoundsInScreen();
376 EXPECT_EQ(root_windows[0], window->GetRootWindow());
378 // Detach the window.
379 DragStart(window.get());
380 DragMove(0, -100);
381 DragEnd();
382 EXPECT_EQ(root_windows[0], window->GetRootWindow());
383 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached());
385 // Drag the window just above the other display's launcher.
386 DragStart(window.get());
387 DragMove(500, 295);
388 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
390 // Should stick to other launcher.
391 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y());
392 DragEnd();
394 // When dropped should move to second display's panel container.
395 EXPECT_EQ(root_windows[1], window->GetRootWindow());
396 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached());
397 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
400 TEST_F(PanelWindowResizerTest, AttachToSecondDisplay) {
401 if (!SupportsMultipleDisplays())
402 return;
404 UpdateDisplay("600x400,600x600");
405 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
406 scoped_ptr<aura::Window> window(
407 CreatePanelWindow(gfx::Point(0, 0)));
408 gfx::Rect initial_bounds = window->GetBoundsInScreen();
409 EXPECT_EQ(root_windows[0], window->GetRootWindow());
411 // Drag the window just above the other display's launcher.
412 DragStart(window.get());
413 DragMove(500, 195);
414 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
416 // Should stick to other launcher.
417 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y());
418 DragEnd();
420 // When dropped should move to second display's panel container.
421 EXPECT_EQ(root_windows[1], window->GetRootWindow());
422 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached());
423 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
426 TEST_F(PanelWindowResizerTest, AttachToSecondFullscreenDisplay) {
427 if (!SupportsMultipleDisplays())
428 return;
430 UpdateDisplay("600x400,600x600");
431 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
432 scoped_ptr<aura::Window> window(
433 CreatePanelWindow(gfx::Point(0, 0)));
434 scoped_ptr<aura::Window> fullscreen(
435 CreateTestWindowInShellWithBounds(gfx::Rect(600, 0, 101, 101)));
436 wm::GetWindowState(fullscreen.get())->Activate();
437 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
438 wm::GetWindowState(fullscreen.get())->OnWMEvent(&event);
439 EXPECT_TRUE(wm::GetWindowState(fullscreen.get())->IsFullscreen());
441 gfx::Rect initial_bounds = window->GetBoundsInScreen();
442 EXPECT_EQ(root_windows[0], window->GetRootWindow());
444 // Activate and drag the window to the other display's launcher.
445 wm::GetWindowState(window.get())->Activate();
446 DragStart(window.get());
447 DragMove(500, 250);
448 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x());
449 EXPECT_GT(window->GetBoundsInScreen().y(),
450 initial_bounds.y() + 200);
451 DragEnd();
453 // When dropped should move to second display's panel container.
454 EXPECT_EQ(root_windows[1], window->GetRootWindow());
455 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached());
456 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
457 EXPECT_TRUE(window->IsVisible());
458 EXPECT_TRUE(wm::GetWindowState(window.get())->IsActive());
459 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y());
462 TEST_F(PanelWindowResizerTest, RevertDragRestoresAttachment) {
463 scoped_ptr<aura::Window> window(
464 CreatePanelWindow(gfx::Point(0, 0)));
465 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached());
466 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
467 DragStart(window.get());
468 DragMove(0, -100);
469 DragRevert();
470 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached());
471 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
473 // Detach panel.
474 DragStart(window.get());
475 DragMove(0, -100);
476 DragEnd();
477 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached());
478 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
480 // Drag back to launcher.
481 DragStart(window.get());
482 DragMove(0, 100);
484 // When the drag is reverted it should remain detached.
485 DragRevert();
486 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached());
487 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
490 TEST_F(PanelWindowResizerTest, DragMovesToPanelLayer) {
491 scoped_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
492 DragStart(window.get());
493 DragMove(0, -100);
494 DragEnd();
495 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
497 // While moving the panel window should be moved to the panel container.
498 DragStart(window.get());
499 DragMove(20, 0);
500 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
501 DragEnd();
503 // When dropped it should return to the default container.
504 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
507 TEST_P(PanelWindowResizerTextDirectionTest, DragReordersPanelsHorizontal) {
508 if (!SupportsHostWindowResize())
509 return;
511 DragAlongShelfReorder(base::i18n::IsRTL() ? 1 : -1, 0);
514 TEST_F(PanelWindowResizerTest, DragReordersPanelsVertical) {
515 if (!SupportsHostWindowResize())
516 return;
518 ash::Shell* shell = ash::Shell::GetInstance();
519 shell->SetShelfAlignment(SHELF_ALIGNMENT_LEFT, shell->GetPrimaryRootWindow());
520 DragAlongShelfReorder(0, -1);
523 // Tests that panels can have transient children of different types.
524 // The transient children should be reparented in sync with the panel.
525 TEST_P(PanelWindowResizerTransientTest, PanelWithTransientChild) {
526 if (!SupportsHostWindowResize())
527 return;
529 scoped_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0)));
530 scoped_ptr<aura::Window> child(CreateTestWindowInShellWithDelegateAndType(
531 NULL, transient_window_type_, 0, gfx::Rect(20, 20, 150, 40)));
532 ::wm::AddTransientChild(window.get(), child.get());
533 if (window->parent() != child->parent())
534 window->parent()->AddChild(child.get());
535 EXPECT_EQ(window.get(), ::wm::GetTransientParent(child.get()));
537 // Drag the child to the shelf. Its new position should not be overridden.
538 const gfx::Rect attached_bounds(window->GetBoundsInScreen());
539 const int dy = window->GetBoundsInScreen().bottom() -
540 child->GetBoundsInScreen().bottom();
541 DragStart(child.get());
542 DragMove(50, dy);
543 // While moving the transient child window should be in the panel container.
544 EXPECT_EQ(kShellWindowId_PanelContainer, child->parent()->id());
545 DragEnd();
546 // Child should move, |window| should not.
547 EXPECT_EQ(gfx::Point(20 + 50, 20 + dy).ToString(),
548 child->GetBoundsInScreen().origin().ToString());
549 EXPECT_EQ(attached_bounds.ToString(), window->GetBoundsInScreen().ToString());
551 // Drag the child along the the shelf past the |window|.
552 // Its new position should not be overridden.
553 DragStart(child.get());
554 DragMove(350, 0);
555 // While moving the transient child window should be in the panel container.
556 EXPECT_EQ(kShellWindowId_PanelContainer, child->parent()->id());
557 DragEnd();
558 // |child| should move, |window| should not.
559 EXPECT_EQ(gfx::Point(20 + 50 + 350, 20 + dy).ToString(),
560 child->GetBoundsInScreen().origin().ToString());
561 EXPECT_EQ(attached_bounds.ToString(), window->GetBoundsInScreen().ToString());
563 DragStart(window.get());
564 DragMove(0, -100);
565 // While moving the windows should be in the panel container.
566 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
567 EXPECT_EQ(kShellWindowId_PanelContainer, child->parent()->id());
568 DragEnd();
569 // When dropped they should return to the default container.
570 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
571 EXPECT_EQ(kShellWindowId_DefaultContainer, child->parent()->id());
573 // While moving the window and child should be moved to the panel container.
574 DragStart(window.get());
575 DragMove(20, 0);
576 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id());
577 EXPECT_EQ(kShellWindowId_PanelContainer, child->parent()->id());
578 DragEnd();
580 // When dropped they should return to the default container.
581 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id());
582 EXPECT_EQ(kShellWindowId_DefaultContainer, child->parent()->id());
585 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest,
586 testing::Bool());
587 INSTANTIATE_TEST_CASE_P(NormalPanelPopup,
588 PanelWindowResizerTransientTest,
589 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
590 ui::wm::WINDOW_TYPE_PANEL,
591 ui::wm::WINDOW_TYPE_POPUP));
593 } // namespace ash