Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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/common/wm/panels/panel_window_resizer.h" | 5 #include "ash/common/wm/panels/panel_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shelf/shelf_layout_manager.h" | 8 #include "ash/common/shelf/shelf_layout_manager.h" |
| 9 #include "ash/common/shelf/shelf_model.h" | 9 #include "ash/common/shelf/shelf_model.h" |
| 10 #include "ash/common/shelf/shelf_widget.h" | 10 #include "ash/common/shelf/shelf_widget.h" |
| 11 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
| 12 #include "ash/common/test/test_shelf_delegate.h" | 12 #include "ash/common/test/test_shelf_delegate.h" |
| 13 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
| 14 #include "ash/common/wm/wm_event.h" | 14 #include "ash/common/wm/wm_event.h" |
| 15 #include "ash/common/wm_shell.h" | 15 #include "ash/common/wm_shell.h" |
| 16 #include "ash/common/wm_window_property.h" | 16 #include "ash/common/wm_window_property.h" |
| 17 #include "ash/public/cpp/shelf_types.h" | 17 #include "ash/public/cpp/shelf_types.h" |
| 18 #include "ash/public/cpp/shell_window_ids.h" | 18 #include "ash/public/cpp/shell_window_ids.h" |
| 19 #include "ash/root_window_controller.h" | 19 #include "ash/root_window_controller.h" |
| 20 #include "ash/shell.h" | 20 #include "ash/shell.h" |
| 21 #include "ash/test/ash_test_base.h" | 21 #include "ash/test/ash_test_base.h" |
| 22 #include "ash/test/cursor_manager_test_api.h" | 22 #include "ash/test/cursor_manager_test_api.h" |
| 23 #include "ash/wm/drag_window_resizer.h" | 23 #include "ash/wm/drag_window_resizer.h" |
| 24 #include "ash/wm/window_properties.h" | |
| 24 #include "ash/wm/window_state_aura.h" | 25 #include "ash/wm/window_state_aura.h" |
| 25 #include "base/i18n/rtl.h" | 26 #include "base/i18n/rtl.h" |
| 26 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
| 27 #include "ui/aura/client/aura_constants.h" | 28 #include "ui/aura/client/aura_constants.h" |
| 28 #include "ui/aura/window_event_dispatcher.h" | 29 #include "ui/aura/window_event_dispatcher.h" |
| 29 #include "ui/base/hit_test.h" | 30 #include "ui/base/hit_test.h" |
| 30 #include "ui/base/ui_base_types.h" | 31 #include "ui/base/ui_base_types.h" |
| 31 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
| 32 #include "ui/wm/core/window_util.h" | 33 #include "ui/wm/core/window_util.h" |
| 33 | 34 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 } | 84 } |
| 84 | 85 |
| 85 void DragRevert() { | 86 void DragRevert() { |
| 86 resizer_->RevertDrag(); | 87 resizer_->RevertDrag(); |
| 87 resizer_.reset(); | 88 resizer_.reset(); |
| 88 } | 89 } |
| 89 | 90 |
| 90 // Test dragging the panel slightly, then detaching, and then reattaching | 91 // Test dragging the panel slightly, then detaching, and then reattaching |
| 91 // dragging out by the vector (dx, dy). | 92 // dragging out by the vector (dx, dy). |
| 92 void DetachReattachTest(aura::Window* window, int dx, int dy) { | 93 void DetachReattachTest(aura::Window* window, int dx, int dy) { |
| 93 wm::WindowState* window_state = wm::GetWindowState(window); | 94 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); |
| 94 EXPECT_TRUE(window_state->panel_attached()); | |
| 95 aura::Window* root_window = window->GetRootWindow(); | 95 aura::Window* root_window = window->GetRootWindow(); |
| 96 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 96 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
| 97 DragStart(window); | 97 DragStart(window); |
| 98 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 98 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
| 99 | 99 |
| 100 // Drag the panel slightly. The window should still be snapped to the | 100 // Drag the panel slightly. The window should still be snapped to the |
| 101 // launcher. | 101 // launcher. |
| 102 DragMove(dx * 5, dy * 5); | 102 DragMove(dx * 5, dy * 5); |
| 103 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); | 103 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); |
| 104 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y()); | 104 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y()); |
| 105 | 105 |
| 106 // Drag further out and the window should now move to the cursor. | 106 // Drag further out and the window should now move to the cursor. |
| 107 DragMove(dx * 100, dy * 100); | 107 DragMove(dx * 100, dy * 100); |
| 108 EXPECT_EQ(initial_bounds.x() + dx * 100, window->GetBoundsInScreen().x()); | 108 EXPECT_EQ(initial_bounds.x() + dx * 100, window->GetBoundsInScreen().x()); |
| 109 EXPECT_EQ(initial_bounds.y() + dy * 100, window->GetBoundsInScreen().y()); | 109 EXPECT_EQ(initial_bounds.y() + dy * 100, window->GetBoundsInScreen().y()); |
| 110 | 110 |
| 111 // The panel should be detached when the drag completes. | 111 // The panel should be detached when the drag completes. |
| 112 DragEnd(); | 112 DragEnd(); |
| 113 | 113 |
| 114 EXPECT_FALSE(window_state->panel_attached()); | 114 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); |
| 115 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | 115 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); |
| 116 EXPECT_EQ(root_window, window->GetRootWindow()); | 116 EXPECT_EQ(root_window, window->GetRootWindow()); |
| 117 | 117 |
| 118 DragStart(window); | 118 DragStart(window); |
| 119 // Drag the panel down. | 119 // Drag the panel down. |
| 120 DragMove(dx * -95, dy * -95); | 120 DragMove(dx * -95, dy * -95); |
| 121 // Release the mouse and the panel should be reattached. | 121 // Release the mouse and the panel should be reattached. |
| 122 DragEnd(); | 122 DragEnd(); |
| 123 | 123 |
| 124 // The panel should be reattached and have snapped to the launcher. | 124 // The panel should be reattached and have snapped to the launcher. |
| 125 EXPECT_TRUE(window_state->panel_attached()); | 125 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); |
| 126 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); | 126 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); |
| 127 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y()); | 127 EXPECT_EQ(initial_bounds.y(), window->GetBoundsInScreen().y()); |
| 128 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 128 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void TestWindowOrder(const std::vector<aura::Window*>& window_order) { | 131 void TestWindowOrder(const std::vector<aura::Window*>& window_order) { |
| 132 int panel_index = model_->FirstPanelIndex(); | 132 int panel_index = model_->FirstPanelIndex(); |
| 133 EXPECT_EQ((int)(panel_index + window_order.size()), model_->item_count()); | 133 EXPECT_EQ((int)(panel_index + window_order.size()), model_->item_count()); |
| 134 for (std::vector<aura::Window *>::const_iterator | 134 for (std::vector<aura::Window *>::const_iterator |
| 135 iter = window_order.begin(); | 135 iter = window_order.begin(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 292 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 293 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 293 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 294 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 294 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
| 295 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 295 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 296 DragStart(window.get()); | 296 DragStart(window.get()); |
| 297 DragMove(0, -100); | 297 DragMove(0, -100); |
| 298 DragEnd(); | 298 DragEnd(); |
| 299 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 299 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 300 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); | 300 EXPECT_EQ(initial_bounds.x(), window->GetBoundsInScreen().x()); |
| 301 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); | 301 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); |
| 302 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); | 302 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); |
| 303 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | 303 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); |
| 304 | 304 |
| 305 DragStart(window.get()); | 305 DragStart(window.get()); |
| 306 DragMove(500, 0); | 306 DragMove(500, 0); |
| 307 DragEnd(); | 307 DragEnd(); |
| 308 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 308 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 309 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); | 309 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); |
| 310 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); | 310 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); |
| 311 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); | 311 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); |
| 312 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | 312 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 TEST_F(PanelWindowResizerTest, DetachAcrossDisplays) { | 315 TEST_F(PanelWindowResizerTest, DetachAcrossDisplays) { |
| 316 if (!SupportsMultipleDisplays()) | 316 if (!SupportsMultipleDisplays()) |
| 317 return; | 317 return; |
| 318 | 318 |
| 319 UpdateDisplay("600x400,600x400"); | 319 UpdateDisplay("600x400,600x400"); |
| 320 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 320 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 321 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 321 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 322 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 322 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
| 323 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 323 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 324 DragStart(window.get()); | 324 DragStart(window.get()); |
| 325 DragMove(500, -100); | 325 DragMove(500, -100); |
| 326 DragEnd(); | 326 DragEnd(); |
| 327 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 327 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 328 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); | 328 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); |
| 329 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); | 329 EXPECT_EQ(initial_bounds.y() - 100, window->GetBoundsInScreen().y()); |
| 330 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); | 330 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); |
|
sky
2016/12/08 00:38:54
I think Oshima explicitly wanted state information
msw
2016/12/08 20:31:36
I'm eager to hear more about the reasoning for tha
sky
2016/12/08 20:52:42
I'm going to leave Oshima to answer this one.
msw
2016/12/09 01:18:21
Oshima and I chatted over im; he doesn't have any
| |
| 331 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | 331 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); |
| 332 } | 332 } |
| 333 | 333 |
| 334 TEST_F(PanelWindowResizerTest, DetachThenAttachToSecondDisplay) { | 334 TEST_F(PanelWindowResizerTest, DetachThenAttachToSecondDisplay) { |
| 335 if (!SupportsMultipleDisplays()) | 335 if (!SupportsMultipleDisplays()) |
| 336 return; | 336 return; |
| 337 | 337 |
| 338 UpdateDisplay("600x400,600x600"); | 338 UpdateDisplay("600x400,600x600"); |
| 339 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 339 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 340 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 340 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 341 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 341 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
| 342 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 342 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 343 | 343 |
| 344 // Detach the window. | 344 // Detach the window. |
| 345 DragStart(window.get()); | 345 DragStart(window.get()); |
| 346 DragMove(0, -100); | 346 DragMove(0, -100); |
| 347 DragEnd(); | 347 DragEnd(); |
| 348 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 348 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 349 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); | 349 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); |
| 350 | 350 |
| 351 // Drag the window just above the other display's launcher. | 351 // Drag the window just above the other display's launcher. |
| 352 DragStart(window.get()); | 352 DragStart(window.get()); |
| 353 DragMove(500, 295); | 353 DragMove(500, 295); |
| 354 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); | 354 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); |
| 355 | 355 |
| 356 // Should stick to other launcher. | 356 // Should stick to other launcher. |
| 357 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); | 357 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); |
| 358 DragEnd(); | 358 DragEnd(); |
| 359 | 359 |
| 360 // When dropped should move to second display's panel container. | 360 // When dropped should move to second display's panel container. |
| 361 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 361 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 362 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); | 362 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); |
| 363 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 363 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
| 364 } | 364 } |
| 365 | 365 |
| 366 TEST_F(PanelWindowResizerTest, AttachToSecondDisplay) { | 366 TEST_F(PanelWindowResizerTest, AttachToSecondDisplay) { |
| 367 if (!SupportsMultipleDisplays()) | 367 if (!SupportsMultipleDisplays()) |
| 368 return; | 368 return; |
| 369 | 369 |
| 370 UpdateDisplay("600x400,600x600"); | 370 UpdateDisplay("600x400,600x600"); |
| 371 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 371 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 372 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 372 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 373 gfx::Rect initial_bounds = window->GetBoundsInScreen(); | 373 gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
| 374 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 374 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 375 | 375 |
| 376 // Drag the window just above the other display's launcher. | 376 // Drag the window just above the other display's launcher. |
| 377 DragStart(window.get()); | 377 DragStart(window.get()); |
| 378 DragMove(500, 195); | 378 DragMove(500, 195); |
| 379 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); | 379 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); |
| 380 | 380 |
| 381 // Should stick to other launcher. | 381 // Should stick to other launcher. |
| 382 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); | 382 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); |
| 383 DragEnd(); | 383 DragEnd(); |
| 384 | 384 |
| 385 // When dropped should move to second display's panel container. | 385 // When dropped should move to second display's panel container. |
| 386 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 386 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 387 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); | 387 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); |
| 388 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 388 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
| 389 } | 389 } |
| 390 | 390 |
| 391 TEST_F(PanelWindowResizerTest, AttachToSecondFullscreenDisplay) { | 391 TEST_F(PanelWindowResizerTest, AttachToSecondFullscreenDisplay) { |
| 392 if (!SupportsMultipleDisplays()) | 392 if (!SupportsMultipleDisplays()) |
| 393 return; | 393 return; |
| 394 | 394 |
| 395 UpdateDisplay("600x400,600x600"); | 395 UpdateDisplay("600x400,600x600"); |
| 396 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 396 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 397 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 397 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 408 // Activate and drag the window to the other display's launcher. | 408 // Activate and drag the window to the other display's launcher. |
| 409 wm::GetWindowState(window.get())->Activate(); | 409 wm::GetWindowState(window.get())->Activate(); |
| 410 DragStart(window.get()); | 410 DragStart(window.get()); |
| 411 DragMove(500, 250); | 411 DragMove(500, 250); |
| 412 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); | 412 EXPECT_EQ(initial_bounds.x() + 500, window->GetBoundsInScreen().x()); |
| 413 EXPECT_GT(window->GetBoundsInScreen().y(), initial_bounds.y() + 200); | 413 EXPECT_GT(window->GetBoundsInScreen().y(), initial_bounds.y() + 200); |
| 414 DragEnd(); | 414 DragEnd(); |
| 415 | 415 |
| 416 // When dropped should move to second display's panel container. | 416 // When dropped should move to second display's panel container. |
| 417 EXPECT_EQ(root_windows[1], window->GetRootWindow()); | 417 EXPECT_EQ(root_windows[1], window->GetRootWindow()); |
| 418 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); | 418 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); |
| 419 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 419 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
| 420 EXPECT_TRUE(window->IsVisible()); | 420 EXPECT_TRUE(window->IsVisible()); |
| 421 EXPECT_TRUE(wm::GetWindowState(window.get())->IsActive()); | 421 EXPECT_TRUE(wm::GetWindowState(window.get())->IsActive()); |
| 422 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); | 422 EXPECT_EQ(initial_bounds.y() + 200, window->GetBoundsInScreen().y()); |
| 423 } | 423 } |
| 424 | 424 |
| 425 TEST_F(PanelWindowResizerTest, RevertDragRestoresAttachment) { | 425 TEST_F(PanelWindowResizerTest, RevertDragRestoresAttachment) { |
| 426 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 426 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 427 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); | 427 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); |
| 428 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 428 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
| 429 DragStart(window.get()); | 429 DragStart(window.get()); |
| 430 DragMove(0, -100); | 430 DragMove(0, -100); |
| 431 DragRevert(); | 431 DragRevert(); |
| 432 EXPECT_TRUE(wm::GetWindowState(window.get())->panel_attached()); | 432 EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); |
| 433 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); | 433 EXPECT_EQ(kShellWindowId_PanelContainer, window->parent()->id()); |
| 434 | 434 |
| 435 // Detach panel. | 435 // Detach panel. |
| 436 DragStart(window.get()); | 436 DragStart(window.get()); |
| 437 DragMove(0, -100); | 437 DragMove(0, -100); |
| 438 DragEnd(); | 438 DragEnd(); |
| 439 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); | 439 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); |
| 440 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | 440 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); |
| 441 | 441 |
| 442 // Drag back to launcher. | 442 // Drag back to launcher. |
| 443 DragStart(window.get()); | 443 DragStart(window.get()); |
| 444 DragMove(0, 100); | 444 DragMove(0, 100); |
| 445 | 445 |
| 446 // When the drag is reverted it should remain detached. | 446 // When the drag is reverted it should remain detached. |
| 447 DragRevert(); | 447 DragRevert(); |
| 448 EXPECT_FALSE(wm::GetWindowState(window.get())->panel_attached()); | 448 EXPECT_FALSE(window->GetProperty(kPanelAttachedKey)); |
| 449 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | 449 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); |
| 450 } | 450 } |
| 451 | 451 |
| 452 TEST_F(PanelWindowResizerTest, DragMovesToPanelLayer) { | 452 TEST_F(PanelWindowResizerTest, DragMovesToPanelLayer) { |
| 453 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); | 453 std::unique_ptr<aura::Window> window(CreatePanelWindow(gfx::Point(0, 0))); |
| 454 DragStart(window.get()); | 454 DragStart(window.get()); |
| 455 DragMove(0, -100); | 455 DragMove(0, -100); |
| 456 DragEnd(); | 456 DragEnd(); |
| 457 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); | 457 EXPECT_EQ(kShellWindowId_DefaultContainer, window->parent()->id()); |
| 458 | 458 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 INSTANTIATE_TEST_CASE_P(LtrRtl, | 538 INSTANTIATE_TEST_CASE_P(LtrRtl, |
| 539 PanelWindowResizerTextDirectionTest, | 539 PanelWindowResizerTextDirectionTest, |
| 540 testing::Bool()); | 540 testing::Bool()); |
| 541 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, | 541 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, |
| 542 PanelWindowResizerTransientTest, | 542 PanelWindowResizerTransientTest, |
| 543 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 543 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 544 ui::wm::WINDOW_TYPE_PANEL, | 544 ui::wm::WINDOW_TYPE_PANEL, |
| 545 ui::wm::WINDOW_TYPE_POPUP)); | 545 ui::wm::WINDOW_TYPE_POPUP)); |
| 546 | 546 |
| 547 } // namespace ash | 547 } // namespace ash |
| OLD | NEW |