Index: ash/wm/dock/docked_window_layout_manager_unittest.cc |
diff --git a/ash/wm/dock/docked_window_layout_manager_unittest.cc b/ash/wm/dock/docked_window_layout_manager_unittest.cc |
index b2f6ffd9cf4ef48cb3db3e8eb4a89a65555c3d14..72c612fd1ec9d4f3b7927d2182459260c64a9101 100644 |
--- a/ash/wm/dock/docked_window_layout_manager_unittest.cc |
+++ b/ash/wm/dock/docked_window_layout_manager_unittest.cc |
@@ -97,11 +97,7 @@ class DockedWindowLayoutManagerTest |
} |
void DragStart(aura::Window* window) { |
- initial_location_in_parent_ = window->bounds().origin(); |
- resizer_.reset(CreateSomeWindowResizer(window, |
- initial_location_in_parent_, |
- HTCAPTION)); |
- ASSERT_TRUE(resizer_.get()); |
+ DragStartAtOffsetFromwindowOrigin(window, 0, 0); |
} |
void DragStartAtOffsetFromwindowOrigin(aura::Window* window, |
@@ -175,7 +171,7 @@ class DockedWindowLayoutManagerTest |
gfx::Rect initial_bounds = window->GetBoundsInScreen(); |
if (window_type_ == aura::client::WINDOW_TYPE_PANEL) { |
- ASSERT_NO_FATAL_FAILURE(DragStart(window)); |
+ ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5)); |
EXPECT_TRUE(window->GetProperty(kPanelAttachedKey)); |
// Drag enough to detach since our tests assume panels to be initially |
@@ -197,11 +193,13 @@ class DockedWindowLayoutManagerTest |
// avoid snap by clicking away from the border |
ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5)); |
+ gfx::Rect work_area = |
+ Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
// Drag the window left or right to the edge (or almost to it). |
if (edge == DOCKED_EDGE_LEFT) |
- dx += window->GetRootWindow()->bounds().x() - initial_bounds.x(); |
+ dx += work_area.x() - initial_location_in_parent_.x(); |
else if (edge == DOCKED_EDGE_RIGHT) |
- dx += window->GetRootWindow()->bounds().right() - initial_bounds.right(); |
+ dx += work_area.right() - 1 - initial_location_in_parent_.x(); |
DragMove(dx, window_type_ == aura::client::WINDOW_TYPE_PANEL ? 0 : dy); |
EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id()); |
// Release the mouse and the panel should be attached to the dock. |
@@ -209,8 +207,10 @@ class DockedWindowLayoutManagerTest |
// x-coordinate can get adjusted by snapping or sticking. |
// y-coordinate could be changed by possible automatic layout if docked. |
- if (window->parent()->id() != internal::kShellWindowId_DockedContainer) |
+ if (window->parent()->id() != internal::kShellWindowId_DockedContainer && |
+ GetRestoreBoundsInScreen(window) == NULL) { |
EXPECT_EQ(initial_bounds.y() + dy, window->GetBoundsInScreen().y()); |
+ } |
} |
private: |
@@ -288,7 +288,7 @@ TEST_P(DockedWindowLayoutManagerTest, TwoWindowsDragging) { |
// Drag w2 above w1. |
ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(w2.get(), 0, 20)); |
- DragMove(0, w1->bounds().y() - w2->bounds().y() - 20); |
+ DragMove(0, w1->bounds().y() - w2->bounds().y() + 20); |
DragEnd(); |
// Test the new windows order and that the gaps differ at most by a pixel. |