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

Unified Diff: ash/wm/toplevel_window_event_handler_unittest.cc

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase Created 3 years, 10 months 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
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);
- }
-
- 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());

Powered by Google App Engine
This is Rietveld 408576698