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_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
6 | 6 |
7 #include "ash/drag_drop/drag_drop_tracker.h" | 7 #include "ash/drag_drop/drag_drop_tracker.h" |
8 #include "ash/drag_drop/drag_image_view.h" | 8 #include "ash/drag_drop/drag_image_view.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 void DispatchGesture(ui::EventType gesture_type, gfx::Point location) { | 277 void DispatchGesture(ui::EventType gesture_type, gfx::Point location) { |
278 ui::GestureEvent gesture_event( | 278 ui::GestureEvent gesture_event( |
279 gesture_type, | 279 gesture_type, |
280 location.x(), | 280 location.x(), |
281 location.y(), | 281 location.y(), |
282 0, | 282 0, |
283 ui::EventTimeForNow(), | 283 ui::EventTimeForNow(), |
284 ui::GestureEventDetails(gesture_type, 0, 0), | 284 ui::GestureEventDetails(gesture_type, 0, 0), |
285 1); | 285 1); |
286 Shell::GetPrimaryRootWindow()->GetDispatcher()->DispatchGestureEvent( | 286 Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()->DispatchGestureEvent( |
287 &gesture_event); | 287 &gesture_event); |
288 } | 288 } |
289 | 289 |
290 } // namespace | 290 } // namespace |
291 | 291 |
292 class DragDropControllerTest : public AshTestBase { | 292 class DragDropControllerTest : public AshTestBase { |
293 public: | 293 public: |
294 DragDropControllerTest() : AshTestBase() {} | 294 DragDropControllerTest() : AshTestBase() {} |
295 virtual ~DragDropControllerTest() {} | 295 virtual ~DragDropControllerTest() {} |
296 | 296 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 UpdateDragData(&data); | 731 UpdateDragData(&data); |
732 generator.MoveMouseBy(0, 1); | 732 generator.MoveMouseBy(0, 1); |
733 | 733 |
734 // We send a unexpected mouse move event. Note that we cannot use | 734 // We send a unexpected mouse move event. Note that we cannot use |
735 // EventGenerator since it implicitly turns these into mouse drag events. | 735 // EventGenerator since it implicitly turns these into mouse drag events. |
736 // The DragDropController should simply ignore these events. | 736 // The DragDropController should simply ignore these events. |
737 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); | 737 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); |
738 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, | 738 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, |
739 mouse_move_location, 0, 0); | 739 mouse_move_location, 0, 0); |
740 ui::EventDispatchDetails details = Shell::GetPrimaryRootWindow()-> | 740 ui::EventDispatchDetails details = Shell::GetPrimaryRootWindow()-> |
741 GetDispatcher()->OnEventFromSource(&mouse_move); | 741 GetHost()->dispatcher()->OnEventFromSource(&mouse_move); |
742 ASSERT_FALSE(details.dispatcher_destroyed); | 742 ASSERT_FALSE(details.dispatcher_destroyed); |
743 } | 743 } |
744 | 744 |
745 generator.ReleaseLeftButton(); | 745 generator.ReleaseLeftButton(); |
746 | 746 |
747 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); | 747 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); |
748 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), | 748 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), |
749 drag_drop_controller_->num_drag_updates_); | 749 drag_drop_controller_->num_drag_updates_); |
750 EXPECT_TRUE(drag_drop_controller_->drop_received_); | 750 EXPECT_TRUE(drag_drop_controller_->drop_received_); |
751 EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), | 751 EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); | 1079 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); |
1080 } | 1080 } |
1081 for (aura::Window::Windows::iterator iter = root_windows.begin(); | 1081 for (aura::Window::Windows::iterator iter = root_windows.begin(); |
1082 iter != root_windows.end(); ++iter) { | 1082 iter != root_windows.end(); ++iter) { |
1083 aura::client::SetDragDropClient(*iter, NULL); | 1083 aura::client::SetDragDropClient(*iter, NULL); |
1084 } | 1084 } |
1085 } | 1085 } |
1086 | 1086 |
1087 } // namespace test | 1087 } // namespace test |
1088 } // namespace aura | 1088 } // namespace aura |
OLD | NEW |