| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/drag_drop/drag_drop_tracker.h" | 5 #include "ash/drag_drop/drag_drop_tracker.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/common/scoped_root_window_for_new_windows.h" | 9 #include "ash/common/scoped_root_window_for_new_windows.h" |
| 10 #include "ash/common/wm_shell.h" | |
| 11 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| 12 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
| 13 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 14 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 15 #include "ui/aura/test/test_windows.h" | 14 #include "ui/aura/test/test_windows.h" |
| 16 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_event_dispatcher.h" | 16 #include "ui/aura/window_event_dispatcher.h" |
| 18 #include "ui/events/event_utils.h" | 17 #include "ui/events/event_utils.h" |
| 19 | 18 |
| 20 namespace ash { | 19 namespace ash { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 std::unique_ptr<aura::Window> window1( | 60 std::unique_ptr<aura::Window> window1( |
| 62 CreateTestWindow(gfx::Rect(300, 100, 100, 100))); | 61 CreateTestWindow(gfx::Rect(300, 100, 100, 100))); |
| 63 window1->Show(); | 62 window1->Show(); |
| 64 EXPECT_EQ(root_windows[0], window0->GetRootWindow()); | 63 EXPECT_EQ(root_windows[0], window0->GetRootWindow()); |
| 65 EXPECT_EQ(root_windows[1], window1->GetRootWindow()); | 64 EXPECT_EQ(root_windows[1], window1->GetRootWindow()); |
| 66 EXPECT_EQ("0,0 100x100", window0->GetBoundsInScreen().ToString()); | 65 EXPECT_EQ("0,0 100x100", window0->GetBoundsInScreen().ToString()); |
| 67 EXPECT_EQ("300,100 100x100", window1->GetBoundsInScreen().ToString()); | 66 EXPECT_EQ("300,100 100x100", window1->GetBoundsInScreen().ToString()); |
| 68 | 67 |
| 69 // RootWindow0 is active so the capture window is parented to it. | 68 // RootWindow0 is active so the capture window is parented to it. |
| 70 EXPECT_EQ(WmWindow::Get(root_windows[0]), | 69 EXPECT_EQ(WmWindow::Get(root_windows[0]), |
| 71 WmShell::Get()->GetRootWindowForNewWindows()); | 70 Shell::GetWmRootWindowForNewWindows()); |
| 72 | 71 |
| 73 // Start tracking from the RootWindow1 and check the point on RootWindow0 that | 72 // Start tracking from the RootWindow1 and check the point on RootWindow0 that |
| 74 // |window0| covers. | 73 // |window0| covers. |
| 75 EXPECT_EQ(window0.get(), GetTarget(gfx::Point(50, 50))); | 74 EXPECT_EQ(window0.get(), GetTarget(gfx::Point(50, 50))); |
| 76 | 75 |
| 77 // Start tracking from the RootWindow0 and check the point on RootWindow0 that | 76 // Start tracking from the RootWindow0 and check the point on RootWindow0 that |
| 78 // neither |window0| nor |window1| covers. | 77 // neither |window0| nor |window1| covers. |
| 79 EXPECT_NE(window0.get(), GetTarget(gfx::Point(150, 150))); | 78 EXPECT_NE(window0.get(), GetTarget(gfx::Point(150, 150))); |
| 80 EXPECT_NE(window1.get(), GetTarget(gfx::Point(150, 150))); | 79 EXPECT_NE(window1.get(), GetTarget(gfx::Point(150, 150))); |
| 81 | 80 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 std::unique_ptr<aura::Window> window0( | 118 std::unique_ptr<aura::Window> window0( |
| 120 CreateTestWindow(gfx::Rect(0, 0, 100, 100))); | 119 CreateTestWindow(gfx::Rect(0, 0, 100, 100))); |
| 121 window0->Show(); | 120 window0->Show(); |
| 122 | 121 |
| 123 std::unique_ptr<aura::Window> window1( | 122 std::unique_ptr<aura::Window> window1( |
| 124 CreateTestWindow(gfx::Rect(300, 100, 100, 100))); | 123 CreateTestWindow(gfx::Rect(300, 100, 100, 100))); |
| 125 window1->Show(); | 124 window1->Show(); |
| 126 | 125 |
| 127 // RootWindow0 is active so the capture window is parented to it. | 126 // RootWindow0 is active so the capture window is parented to it. |
| 128 EXPECT_EQ(WmWindow::Get(root_windows[0]), | 127 EXPECT_EQ(WmWindow::Get(root_windows[0]), |
| 129 WmShell::Get()->GetRootWindowForNewWindows()); | 128 Shell::GetWmRootWindowForNewWindows()); |
| 130 | 129 |
| 131 // Start tracking from the RootWindow0 and converts the mouse event into | 130 // Start tracking from the RootWindow0 and converts the mouse event into |
| 132 // |window0|'s coodinates. | 131 // |window0|'s coodinates. |
| 133 ui::MouseEvent original00(ui::ET_MOUSE_DRAGGED, gfx::Point(50, 50), | 132 ui::MouseEvent original00(ui::ET_MOUSE_DRAGGED, gfx::Point(50, 50), |
| 134 gfx::Point(50, 50), ui::EventTimeForNow(), | 133 gfx::Point(50, 50), ui::EventTimeForNow(), |
| 135 ui::EF_NONE, ui::EF_NONE); | 134 ui::EF_NONE, ui::EF_NONE); |
| 136 std::unique_ptr<ui::LocatedEvent> converted00( | 135 std::unique_ptr<ui::LocatedEvent> converted00( |
| 137 ConvertEvent(window0.get(), original00)); | 136 ConvertEvent(window0.get(), original00)); |
| 138 EXPECT_EQ(original00.type(), converted00->type()); | 137 EXPECT_EQ(original00.type(), converted00->type()); |
| 139 EXPECT_EQ("50,50", converted00->location().ToString()); | 138 EXPECT_EQ("50,50", converted00->location().ToString()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 std::unique_ptr<ui::LocatedEvent> converted11( | 175 std::unique_ptr<ui::LocatedEvent> converted11( |
| 177 ConvertEvent(window1.get(), original11)); | 176 ConvertEvent(window1.get(), original11)); |
| 178 EXPECT_EQ(original11.type(), converted11->type()); | 177 EXPECT_EQ(original11.type(), converted11->type()); |
| 179 EXPECT_EQ("50,50", converted11->location().ToString()); | 178 EXPECT_EQ("50,50", converted11->location().ToString()); |
| 180 EXPECT_EQ("150,150", converted11->root_location().ToString()); | 179 EXPECT_EQ("150,150", converted11->root_location().ToString()); |
| 181 EXPECT_EQ(original11.flags(), converted11->flags()); | 180 EXPECT_EQ(original11.flags(), converted11->flags()); |
| 182 } | 181 } |
| 183 | 182 |
| 184 } // namespace test | 183 } // namespace test |
| 185 } // namespace aura | 184 } // namespace aura |
| OLD | NEW |