| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Start tracking from the RootWindow0 and converts the mouse event into | 144 // Start tracking from the RootWindow0 and converts the mouse event into |
| 145 // |window0|'s coodinates. | 145 // |window0|'s coodinates. |
| 146 ui::MouseEvent original00(ui::ET_MOUSE_DRAGGED, | 146 ui::MouseEvent original00(ui::ET_MOUSE_DRAGGED, |
| 147 gfx::Point(50, 50), | 147 gfx::Point(50, 50), |
| 148 gfx::Point(50, 50), | 148 gfx::Point(50, 50), |
| 149 ui::EF_NONE, | 149 ui::EF_NONE, |
| 150 ui::EF_NONE); | 150 ui::EF_NONE); |
| 151 scoped_ptr<ui::LocatedEvent> converted00(ConvertEvent(window0.get(), | 151 scoped_ptr<ui::LocatedEvent> converted00(ConvertEvent(window0.get(), |
| 152 original00)); | 152 original00)); |
| 153 EXPECT_EQ(original00.type(), converted00->type()); | 153 EXPECT_EQ(original00.type(), converted00->type()); |
| 154 EXPECT_EQ("50,50", converted00->location().ToString()); | 154 EXPECT_EQ(gfx::PointF(50, 50), converted00->location()); |
| 155 EXPECT_EQ("50,50", converted00->root_location().ToString()); | 155 EXPECT_EQ(gfx::PointF(50, 50), converted00->root_location()); |
| 156 EXPECT_EQ(original00.flags(), converted00->flags()); | 156 EXPECT_EQ(original00.flags(), converted00->flags()); |
| 157 | 157 |
| 158 // Start tracking from the RootWindow0 and converts the mouse event into | 158 // Start tracking from the RootWindow0 and converts the mouse event into |
| 159 // |window1|'s coodinates. | 159 // |window1|'s coodinates. |
| 160 ui::MouseEvent original01(ui::ET_MOUSE_DRAGGED, | 160 ui::MouseEvent original01(ui::ET_MOUSE_DRAGGED, |
| 161 gfx::Point(350, 150), | 161 gfx::Point(350, 150), |
| 162 gfx::Point(350, 150), | 162 gfx::Point(350, 150), |
| 163 ui::EF_NONE, | 163 ui::EF_NONE, |
| 164 ui::EF_NONE); | 164 ui::EF_NONE); |
| 165 scoped_ptr<ui::LocatedEvent> converted01(ConvertEvent(window1.get(), | 165 scoped_ptr<ui::LocatedEvent> converted01(ConvertEvent(window1.get(), |
| 166 original01)); | 166 original01)); |
| 167 EXPECT_EQ(original01.type(), converted01->type()); | 167 EXPECT_EQ(original01.type(), converted01->type()); |
| 168 EXPECT_EQ("50,50", converted01->location().ToString()); | 168 EXPECT_EQ(gfx::PointF(50, 50), converted01->location()); |
| 169 EXPECT_EQ("150,150", converted01->root_location().ToString()); | 169 EXPECT_EQ(gfx::PointF(150, 150), converted01->root_location()); |
| 170 EXPECT_EQ(original01.flags(), converted01->flags()); | 170 EXPECT_EQ(original01.flags(), converted01->flags()); |
| 171 | 171 |
| 172 // Make RootWindow1 active so that capture window is parented to it. | 172 // Make RootWindow1 active so that capture window is parented to it. |
| 173 Shell::GetInstance()->set_target_root_window(root_windows[1]); | 173 Shell::GetInstance()->set_target_root_window(root_windows[1]); |
| 174 | 174 |
| 175 // Start tracking from the RootWindow1 and converts the mouse event into | 175 // Start tracking from the RootWindow1 and converts the mouse event into |
| 176 // |window0|'s coodinates. | 176 // |window0|'s coodinates. |
| 177 ui::MouseEvent original10(ui::ET_MOUSE_DRAGGED, | 177 ui::MouseEvent original10(ui::ET_MOUSE_DRAGGED, |
| 178 gfx::Point(-150, 50), | 178 gfx::Point(-150, 50), |
| 179 gfx::Point(-150, 50), | 179 gfx::Point(-150, 50), |
| 180 ui::EF_NONE, | 180 ui::EF_NONE, |
| 181 ui::EF_NONE); | 181 ui::EF_NONE); |
| 182 scoped_ptr<ui::LocatedEvent> converted10(ConvertEvent(window0.get(), | 182 scoped_ptr<ui::LocatedEvent> converted10(ConvertEvent(window0.get(), |
| 183 original10)); | 183 original10)); |
| 184 EXPECT_EQ(original10.type(), converted10->type()); | 184 EXPECT_EQ(original10.type(), converted10->type()); |
| 185 EXPECT_EQ("50,50", converted10->location().ToString()); | 185 EXPECT_EQ(gfx::PointF(50, 50), converted10->location()); |
| 186 EXPECT_EQ("50,50", converted10->root_location().ToString()); | 186 EXPECT_EQ(gfx::PointF(50, 50), converted10->root_location()); |
| 187 EXPECT_EQ(original10.flags(), converted10->flags()); | 187 EXPECT_EQ(original10.flags(), converted10->flags()); |
| 188 | 188 |
| 189 // Start tracking from the RootWindow1 and converts the mouse event into | 189 // Start tracking from the RootWindow1 and converts the mouse event into |
| 190 // |window1|'s coodinates. | 190 // |window1|'s coodinates. |
| 191 ui::MouseEvent original11(ui::ET_MOUSE_DRAGGED, | 191 ui::MouseEvent original11(ui::ET_MOUSE_DRAGGED, |
| 192 gfx::Point(150, 150), | 192 gfx::Point(150, 150), |
| 193 gfx::Point(150, 150), | 193 gfx::Point(150, 150), |
| 194 ui::EF_NONE, | 194 ui::EF_NONE, |
| 195 ui::EF_NONE); | 195 ui::EF_NONE); |
| 196 scoped_ptr<ui::LocatedEvent> converted11(ConvertEvent(window1.get(), | 196 scoped_ptr<ui::LocatedEvent> converted11(ConvertEvent(window1.get(), |
| 197 original11)); | 197 original11)); |
| 198 EXPECT_EQ(original11.type(), converted11->type()); | 198 EXPECT_EQ(original11.type(), converted11->type()); |
| 199 EXPECT_EQ("50,50", converted11->location().ToString()); | 199 EXPECT_EQ(gfx::PointF(50, 50), converted11->location()); |
| 200 EXPECT_EQ("150,150", converted11->root_location().ToString()); | 200 EXPECT_EQ(gfx::PointF(150, 150), converted11->root_location()); |
| 201 EXPECT_EQ(original11.flags(), converted11->flags()); | 201 EXPECT_EQ(original11.flags(), converted11->flags()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace test | 204 } // namespace test |
| 205 } // namespace aura | 205 } // namespace aura |
| OLD | NEW |