Chromium Code Reviews| Index: ash/wm/toplevel_window_event_handler_unittest.cc |
| diff --git a/ash/wm/toplevel_window_event_handler_unittest.cc b/ash/wm/toplevel_window_event_handler_unittest.cc |
| index 23aa801cdff39f3585313bc7d482e773b895dbad..aec1d16cebc157d0387774218e0297c55c6951ee 100644 |
| --- a/ash/wm/toplevel_window_event_handler_unittest.cc |
| +++ b/ash/wm/toplevel_window_event_handler_unittest.cc |
| @@ -74,6 +74,20 @@ class ToplevelWindowEventHandlerTest : public AshTestBase { |
| return w1; |
| } |
| + aura::Window* CreatePanelWindow(int hittest_code) { |
| + TestWindowDelegate* d1 = new TestWindowDelegate(hittest_code); |
| + aura::Window* w1 = new aura::Window(d1); |
| + w1->SetType(ui::wm::WINDOW_TYPE_PANEL); |
| + w1->set_id(1); |
| + w1->Init(ui::LAYER_TEXTURED); |
| + aura::Window* parent = Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
| + kShellWindowId_PanelContainer); |
| + parent->AddChild(w1); |
| + w1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| + w1->Show(); |
| + return w1; |
| + } |
| + |
| void DragFromCenterBy(aura::Window* window, int dx, int dy) { |
| ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window); |
| generator.DragMouseBy(dx, dy); |
| @@ -134,7 +148,6 @@ TEST_F(ToplevelWindowEventHandlerTest, WindowPositionAutoManagement) { |
| generator.PressLeftButton(); |
| aura::client::WindowMoveClient* move_client = |
| aura::client::GetWindowMoveClient(w1->GetRootWindow()); |
| - // generator.PressLeftButton(); |
| base::ThreadTaskRunnerHandle::Get()->PostTask( |
| FROM_HERE, |
| base::Bind(&ContinueAndCompleteDrag, base::Unretained(&generator), |
| @@ -168,34 +181,16 @@ TEST_F(ToplevelWindowEventHandlerTest, WindowPositionAutoManagement) { |
| EXPECT_EQ(size.ToString(), w1->bounds().size().ToString()); |
| } |
| -namespace { |
| - |
| -class CancelDragObserver : public aura::WindowObserver { |
| - public: |
| - CancelDragObserver() {} |
| - ~CancelDragObserver() override {} |
| - |
| - void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override { |
| - aura::client::CaptureClient* client = |
| - aura::client::GetCaptureClient(params.target->GetRootWindow()); |
| - client->SetCapture(nullptr); |
|
oshima
2017/02/23 22:40:02
I believe this (releasing the capture) was a part
afakhry
2017/02/24 20:00:55
I tried both steps in issue 579226 and couldn't re
oshima
2017/02/27 15:10:08
I think it does't happen because it's not panel wi
afakhry
2017/02/27 17:43:50
Done. removed the test.
|
| - } |
| - |
| - private: |
| - DISALLOW_COPY_AND_ASSIGN(CancelDragObserver); |
| -}; |
| - |
| -} // namespace |
| - |
| // Cancelling drag while starting window drag should not crash. |
| TEST_F(ToplevelWindowEventHandlerTest, CancelWhileDragStart) { |
| - std::unique_ptr<aura::Window> w1(CreateWindow(HTCAPTION)); |
| - CancelDragObserver observer; |
| - w1->AddObserver(&observer); |
| + std::unique_ptr<aura::Window> w1(CreatePanelWindow(HTCAPTION)); |
| gfx::Point origin = w1->bounds().origin(); |
| - DragFromCenterBy(w1.get(), 100, 100); |
| + ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w1.get()); |
| + generator.PressLeftButton(); |
| + generator.MoveMouseBy(100, 100); |
| + generator.PressKey(ui::VKEY_ESCAPE, 0); |
| + generator.ReleaseLeftButton(); |
| EXPECT_EQ(origin, w1->bounds().origin()); |
| - w1->RemoveObserver(&observer); |
| } |
| TEST_F(ToplevelWindowEventHandlerTest, BottomRight) { |
| @@ -830,7 +825,7 @@ TEST_F(ToplevelWindowEventHandlerTest, DragSnappedWindowToExternalDisplay) { |
| // Snap the window to the right. |
| wm::WindowState* window_state = wm::GetWindowState(w1.get()); |
| ASSERT_TRUE(window_state->CanSnap()); |
| - const wm::WMEvent event(wm::WM_EVENT_CYCLE_SNAP_DOCK_RIGHT); |
| + const wm::WMEvent event(wm::WM_EVENT_CYCLE_SNAP_RIGHT); |
| window_state->OnWMEvent(&event); |
| ASSERT_TRUE(window_state->IsSnapped()); |