| 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()->DispatchGestureEvent(&gesture_event); | 286 Shell::GetPrimaryRootWindow()->GetDispatcher()->DispatchGestureEvent( |
| 287 &gesture_event); |
| 287 } | 288 } |
| 288 | 289 |
| 289 bool IsGestureEventType(ui::EventType type) { | 290 bool IsGestureEventType(ui::EventType type) { |
| 290 switch (type) { | 291 switch (type) { |
| 291 case ui::ET_GESTURE_SCROLL_BEGIN: | 292 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 292 case ui::ET_GESTURE_SCROLL_END: | 293 case ui::ET_GESTURE_SCROLL_END: |
| 293 case ui::ET_GESTURE_SCROLL_UPDATE: | 294 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 294 case ui::ET_GESTURE_TAP: | 295 case ui::ET_GESTURE_TAP: |
| 295 case ui::ET_GESTURE_TAP_CANCEL: | 296 case ui::ET_GESTURE_TAP_CANCEL: |
| 296 case ui::ET_GESTURE_TAP_DOWN: | 297 case ui::ET_GESTURE_TAP_DOWN: |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 if (i > 0) | 756 if (i > 0) |
| 756 UpdateDragData(&data); | 757 UpdateDragData(&data); |
| 757 generator.MoveMouseBy(0, 1); | 758 generator.MoveMouseBy(0, 1); |
| 758 | 759 |
| 759 // We send a unexpected mouse move event. Note that we cannot use | 760 // We send a unexpected mouse move event. Note that we cannot use |
| 760 // EventGenerator since it implicitly turns these into mouse drag events. | 761 // EventGenerator since it implicitly turns these into mouse drag events. |
| 761 // The DragDropController should simply ignore these events. | 762 // The DragDropController should simply ignore these events. |
| 762 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); | 763 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); |
| 763 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, | 764 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, |
| 764 mouse_move_location, 0); | 765 mouse_move_location, 0); |
| 765 Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->OnHostMouseEvent( | 766 Shell::GetPrimaryRootWindow()->GetDispatcher()->AsRootWindowHostDelegate()-> |
| 766 &mouse_move); | 767 OnHostMouseEvent(&mouse_move); |
| 767 } | 768 } |
| 768 | 769 |
| 769 generator.ReleaseLeftButton(); | 770 generator.ReleaseLeftButton(); |
| 770 | 771 |
| 771 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); | 772 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); |
| 772 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), | 773 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), |
| 773 drag_drop_controller_->num_drag_updates_); | 774 drag_drop_controller_->num_drag_updates_); |
| 774 EXPECT_TRUE(drag_drop_controller_->drop_received_); | 775 EXPECT_TRUE(drag_drop_controller_->drop_received_); |
| 775 EXPECT_EQ(UTF8ToUTF16("I am being dragged"), | 776 EXPECT_EQ(UTF8ToUTF16("I am being dragged"), |
| 776 drag_drop_controller_->drag_string_); | 777 drag_drop_controller_->drag_string_); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); | 1100 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); |
| 1100 } | 1101 } |
| 1101 for (Shell::RootWindowList::iterator iter = root_windows.begin(); | 1102 for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
| 1102 iter != root_windows.end(); ++iter) { | 1103 iter != root_windows.end(); ++iter) { |
| 1103 aura::client::SetDragDropClient(*iter, NULL); | 1104 aura::client::SetDragDropClient(*iter, NULL); |
| 1104 } | 1105 } |
| 1105 } | 1106 } |
| 1106 | 1107 |
| 1107 } // namespace test | 1108 } // namespace test |
| 1108 } // namespace aura | 1109 } // namespace aura |
| OLD | NEW |