diff options
author | varkha@chromium.org <varkha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-04 00:56:21 +0000 |
---|---|---|
committer | varkha@chromium.org <varkha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-04 00:56:21 +0000 |
commit | 93d9f7cfa35f9f844fa57430d9e7655545ad6e9b (patch) | |
tree | 647ee9ff22e1f58ee34e4b071ddb12592dff0fc7 /ash/wm/workspace_controller_unittest.cc | |
parent | 4bf8c63d97be9f7aaf8682ad637737990c8e3a39 (diff) | |
download | chromium_src-93d9f7cfa35f9f844fa57430d9e7655545ad6e9b.zip chromium_src-93d9f7cfa35f9f844fa57430d9e7655545ad6e9b.tar.gz chromium_src-93d9f7cfa35f9f844fa57430d9e7655545ad6e9b.tar.bz2 |
Update shelf when overlapping dragged windows exist
BUG=321704
TEST=ash_unittests --gtest_filter=*WorkspaceControllerTestDragging.DragWindowOverlapShelf*
Review URL: https://codereview.chromium.org/93103003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238507 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/workspace_controller_unittest.cc')
-rw-r--r-- | ash/wm/workspace_controller_unittest.cc | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc index 48e08fc..6c3c605 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 |