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

Unified Diff: ash/wm/workspace_controller_unittest.cc

Issue 93103003: Update shelf when overlapping dragged windows exist (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snap_undock
Patch Set: Update shelf when overlapping dragged windows exist (test) Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/workspace_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace_controller_unittest.cc
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc
index 48e08fc41545760b62793cdd60fd8e9361c1829d..6c3c6056e9123dc053182649944ab63d1cc7ddae 100644
--- a/ash/wm/workspace_controller_unittest.cc
+++ b/ash/wm/workspace_controller_unittest.cc
@@ -1389,5 +1389,64 @@ TEST_F(WorkspaceControllerTest, SwitchFromModal) {
EXPECT_TRUE(maximized_window->IsVisible());
}
+namespace {
+
+// Subclass of WorkspaceControllerTest that runs tests with docked windows
+// enabled and disabled.
+class WorkspaceControllerTestDragging
+ : public WorkspaceControllerTest,
+ public testing::WithParamInterface<bool> {
+ public:
+ WorkspaceControllerTestDragging() {}
+ virtual ~WorkspaceControllerTestDragging() {}
+
+ // testing::Test:
+ virtual void SetUp() OVERRIDE {
+ WorkspaceControllerTest::SetUp();
+ if (!docked_windows_enabled()) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ ash::switches::kAshDisableDockedWindows);
+ }
+ }
+
+ bool docked_windows_enabled() const { return GetParam(); }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WorkspaceControllerTestDragging);
+};
+
+} // namespace
+
+// Verifies that when dragging a window over the shelf overlap is detected
+// during and after the drag.
+TEST_P(WorkspaceControllerTestDragging, DragWindowOverlapShelf) {
+ aura::test::TestWindowDelegate delegate;
+ delegate.set_window_component(HTCAPTION);
+ scoped_ptr<Window> w1(
+ aura::test::CreateTestWindowWithDelegate(&delegate,
+ aura::client::WINDOW_TYPE_NORMAL,
+ gfx::Rect(5, 5, 100, 50),
+ NULL));
+ ParentWindowInPrimaryRootWindow(w1.get());
+
+ ShelfLayoutManager* shelf = shelf_layout_manager();
+ shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
+
+ // Drag near the shelf
+ aura::test::EventGenerator generator(
+ Shell::GetPrimaryRootWindow(), gfx::Point());
+ generator.MoveMouseTo(10, 10);
+ generator.PressLeftButton();
+ generator.MoveMouseTo(100, shelf->GetIdealBounds().y() - 20);
+
+ // Shelf should detect overlap. Overlap state stays after mouse is released.
+ EXPECT_TRUE(GetWindowOverlapsShelf());
+ generator.ReleaseLeftButton();
+ EXPECT_TRUE(GetWindowOverlapsShelf());
+}
+
+INSTANTIATE_TEST_CASE_P(DockedOrNot, WorkspaceControllerTestDragging,
+ ::testing::Bool());
+
} // namespace internal
} // namespace ash
« no previous file with comments | « ash/wm/workspace_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698