| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // |window0| covers. | 82 // |window0| covers. |
| 83 EXPECT_EQ(window0.get(), GetTarget(root_windows[0], gfx::Point(50, 50))); | 83 EXPECT_EQ(window0.get(), GetTarget(root_windows[0], gfx::Point(50, 50))); |
| 84 | 84 |
| 85 // Start tracking from the RootWindow0 and check the point on RootWindow0 that | 85 // Start tracking from the RootWindow0 and check the point on RootWindow0 that |
| 86 // neither |window0| nor |window1| covers. | 86 // neither |window0| nor |window1| covers. |
| 87 EXPECT_NE(window0.get(), GetTarget(root_windows[0], gfx::Point(150, 150))); | 87 EXPECT_NE(window0.get(), GetTarget(root_windows[0], gfx::Point(150, 150))); |
| 88 EXPECT_NE(window1.get(), GetTarget(root_windows[0], gfx::Point(150, 150))); | 88 EXPECT_NE(window1.get(), GetTarget(root_windows[0], gfx::Point(150, 150))); |
| 89 | 89 |
| 90 // Start tracking from the RootWindow0 and check the point on RootWindow1 that | 90 // Start tracking from the RootWindow0 and check the point on RootWindow1 that |
| 91 // |window1| covers. | 91 // |window1| covers. |
| 92 EXPECT_EQ(window1.get(), GetTarget(root_windows[0], gfx::Point(150, 350))); | 92 EXPECT_EQ(window1.get(), GetTarget(root_windows[0], gfx::Point(350, 150))); |
| 93 | 93 |
| 94 // Start tracking from the RootWindow0 and check the point on RootWindow1 that | 94 // Start tracking from the RootWindow0 and check the point on RootWindow1 that |
| 95 // neither |window0| nor |window1| covers. | 95 // neither |window0| nor |window1| covers. |
| 96 EXPECT_NE(window0.get(), GetTarget(root_windows[0], gfx::Point(50, 250))); | 96 EXPECT_NE(window0.get(), GetTarget(root_windows[0], gfx::Point(50, 250))); |
| 97 EXPECT_NE(window1.get(), GetTarget(root_windows[0], gfx::Point(50, 250))); | 97 EXPECT_NE(window1.get(), GetTarget(root_windows[0], gfx::Point(50, 250))); |
| 98 | 98 |
| 99 // Start tracking from the RootWindow1 and check the point on RootWindow0 that | 99 // Start tracking from the RootWindow1 and check the point on RootWindow0 that |
| 100 // |window0| covers. | 100 // |window0| covers. |
| 101 EXPECT_EQ(window0.get(), GetTarget(root_windows[1], gfx::Point(50, -150))); | 101 EXPECT_EQ(window0.get(), GetTarget(root_windows[1], gfx::Point(-150, 50))); |
| 102 | 102 |
| 103 // Start tracking from the RootWindow1 and check the point on RootWindow0 that | 103 // Start tracking from the RootWindow1 and check the point on RootWindow0 that |
| 104 // neither |window0| nor |window1| covers. | 104 // neither |window0| nor |window1| covers. |
| 105 EXPECT_NE(window0.get(), GetTarget(root_windows[1], gfx::Point(150, -50))); | 105 EXPECT_NE(window0.get(), GetTarget(root_windows[1], gfx::Point(150, -50))); |
| 106 EXPECT_NE(window1.get(), GetTarget(root_windows[1], gfx::Point(150, -50))); | 106 EXPECT_NE(window1.get(), GetTarget(root_windows[1], gfx::Point(150, -50))); |
| 107 | 107 |
| 108 // Start tracking from the RootWindow1 and check the point on RootWindow1 that | 108 // Start tracking from the RootWindow1 and check the point on RootWindow1 that |
| 109 // |window1| covers. | 109 // |window1| covers. |
| 110 EXPECT_EQ(window1.get(), GetTarget(root_windows[1], gfx::Point(150, 150))); | 110 EXPECT_EQ(window1.get(), GetTarget(root_windows[1], gfx::Point(150, 150))); |
| 111 | 111 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 window0.get(), | 147 window0.get(), |
| 148 original00)); | 148 original00)); |
| 149 EXPECT_EQ(original00.type(), converted00->type()); | 149 EXPECT_EQ(original00.type(), converted00->type()); |
| 150 EXPECT_EQ("50,50", converted00->location().ToString()); | 150 EXPECT_EQ("50,50", converted00->location().ToString()); |
| 151 EXPECT_EQ("50,50", converted00->root_location().ToString()); | 151 EXPECT_EQ("50,50", converted00->root_location().ToString()); |
| 152 EXPECT_EQ(original00.flags(), converted00->flags()); | 152 EXPECT_EQ(original00.flags(), converted00->flags()); |
| 153 | 153 |
| 154 // Start tracking from the RootWindow0 and converts the mouse event into | 154 // Start tracking from the RootWindow0 and converts the mouse event into |
| 155 // |window1|'s coodinates. | 155 // |window1|'s coodinates. |
| 156 ui::MouseEvent original01(ui::ET_MOUSE_DRAGGED, | 156 ui::MouseEvent original01(ui::ET_MOUSE_DRAGGED, |
| 157 gfx::Point(150, 350), | 157 gfx::Point(350, 150), |
| 158 gfx::Point(150, 350), | 158 gfx::Point(350, 150), |
| 159 ui::EF_NONE); | 159 ui::EF_NONE); |
| 160 scoped_ptr<ui::MouseEvent> converted01(ConvertMouseEvent(root_windows[0], | 160 scoped_ptr<ui::MouseEvent> converted01(ConvertMouseEvent(root_windows[0], |
| 161 window1.get(), | 161 window1.get(), |
| 162 original01)); | 162 original01)); |
| 163 EXPECT_EQ(original01.type(), converted01->type()); | 163 EXPECT_EQ(original01.type(), converted01->type()); |
| 164 EXPECT_EQ("50,50", converted01->location().ToString()); | 164 EXPECT_EQ("50,50", converted01->location().ToString()); |
| 165 EXPECT_EQ("150,150", converted01->root_location().ToString()); | 165 EXPECT_EQ("150,150", converted01->root_location().ToString()); |
| 166 EXPECT_EQ(original01.flags(), converted01->flags()); | 166 EXPECT_EQ(original01.flags(), converted01->flags()); |
| 167 | 167 |
| 168 // Start tracking from the RootWindow1 and converts the mouse event into | 168 // Start tracking from the RootWindow1 and converts the mouse event into |
| 169 // |window0|'s coodinates. | 169 // |window0|'s coodinates. |
| 170 ui::MouseEvent original10(ui::ET_MOUSE_DRAGGED, | 170 ui::MouseEvent original10(ui::ET_MOUSE_DRAGGED, |
| 171 gfx::Point(50, -150), | 171 gfx::Point(-150, 50), |
| 172 gfx::Point(50, -150), | 172 gfx::Point(-150, 50), |
| 173 ui::EF_NONE); | 173 ui::EF_NONE); |
| 174 scoped_ptr<ui::MouseEvent> converted10(ConvertMouseEvent(root_windows[1], | 174 scoped_ptr<ui::MouseEvent> converted10(ConvertMouseEvent(root_windows[1], |
| 175 window0.get(), | 175 window0.get(), |
| 176 original10)); | 176 original10)); |
| 177 EXPECT_EQ(original10.type(), converted10->type()); | 177 EXPECT_EQ(original10.type(), converted10->type()); |
| 178 EXPECT_EQ("50,50", converted10->location().ToString()); | 178 EXPECT_EQ("50,50", converted10->location().ToString()); |
| 179 EXPECT_EQ("50,50", converted10->root_location().ToString()); | 179 EXPECT_EQ("50,50", converted10->root_location().ToString()); |
| 180 EXPECT_EQ(original10.flags(), converted10->flags()); | 180 EXPECT_EQ(original10.flags(), converted10->flags()); |
| 181 | 181 |
| 182 // Start tracking from the RootWindow1 and converts the mouse event into | 182 // Start tracking from the RootWindow1 and converts the mouse event into |
| 183 // |window1|'s coodinates. | 183 // |window1|'s coodinates. |
| 184 ui::MouseEvent original11(ui::ET_MOUSE_DRAGGED, | 184 ui::MouseEvent original11(ui::ET_MOUSE_DRAGGED, |
| 185 gfx::Point(150, 150), | 185 gfx::Point(150, 150), |
| 186 gfx::Point(150, 150), | 186 gfx::Point(150, 150), |
| 187 ui::EF_NONE); | 187 ui::EF_NONE); |
| 188 scoped_ptr<ui::MouseEvent> converted11(ConvertMouseEvent(root_windows[1], | 188 scoped_ptr<ui::MouseEvent> converted11(ConvertMouseEvent(root_windows[1], |
| 189 window1.get(), | 189 window1.get(), |
| 190 original11)); | 190 original11)); |
| 191 EXPECT_EQ(original11.type(), converted11->type()); | 191 EXPECT_EQ(original11.type(), converted11->type()); |
| 192 EXPECT_EQ("50,50", converted11->location().ToString()); | 192 EXPECT_EQ("50,50", converted11->location().ToString()); |
| 193 EXPECT_EQ("150,150", converted11->root_location().ToString()); | 193 EXPECT_EQ("150,150", converted11->root_location().ToString()); |
| 194 EXPECT_EQ(original11.flags(), converted11->flags()); | 194 EXPECT_EQ(original11.flags(), converted11->flags()); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace test | 197 } // namespace test |
| 198 } // namespace aura | 198 } // namespace aura |
| OLD | NEW |