Chromium Code Reviews| 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..f0af4324ea3cf698192b595b80379ba03e91da07 100644 |
| --- a/ash/wm/workspace_controller_unittest.cc |
| +++ b/ash/wm/workspace_controller_unittest.cc |
| @@ -1389,5 +1389,66 @@ 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<const char*> { |
| + 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 (strstr(GetParam(), "docked") != NULL); |
| + } |
| + |
| + 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::Values("mouse", "mouse docked")); |
|
oshima
2013/12/03 17:31:28
why not just boolean? Is this recommended pattern?
varkha
2013/12/03 18:01:27
I used this elsewhere where there were more cases
oshima
2013/12/03 18:08:49
I'd just use local enum rather than string. Bool i
varkha
2013/12/03 18:14:45
There (tab_drag_controller_interactive_uitest.cc)
|
| } // namespace internal |
| } // namespace ash |