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/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 if (i > 0) | 601 if (i > 0) |
602 UpdateDragData(&data); | 602 UpdateDragData(&data); |
603 generator.MoveMouseBy(0, 1); | 603 generator.MoveMouseBy(0, 1); |
604 | 604 |
605 // We send a unexpected mouse move event. Note that we cannot use | 605 // We send a unexpected mouse move event. Note that we cannot use |
606 // EventGenerator since it implicitly turns these into mouse drag events. | 606 // EventGenerator since it implicitly turns these into mouse drag events. |
607 // The DragDropController should simply ignore these events. | 607 // The DragDropController should simply ignore these events. |
608 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); | 608 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); |
609 aura::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, | 609 aura::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, |
610 mouse_move_location, mouse_move_location, 0); | 610 mouse_move_location, mouse_move_location, 0); |
611 Shell::GetPrimaryRootWindow()->DispatchMouseEvent(&mouse_move); | 611 Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->OnHostMouseEvent( |
| 612 &mouse_move); |
612 } | 613 } |
613 | 614 |
614 generator.ReleaseLeftButton(); | 615 generator.ReleaseLeftButton(); |
615 | 616 |
616 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); | 617 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); |
617 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), | 618 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), |
618 drag_drop_controller_->num_drag_updates_); | 619 drag_drop_controller_->num_drag_updates_); |
619 EXPECT_TRUE(drag_drop_controller_->drop_received_); | 620 EXPECT_TRUE(drag_drop_controller_->drop_received_); |
620 EXPECT_EQ(UTF8ToUTF16("I am being dragged"), | 621 EXPECT_EQ(UTF8ToUTF16("I am being dragged"), |
621 drag_drop_controller_->drag_string_); | 622 drag_drop_controller_->drag_string_); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 EXPECT_EQ(1, drag_view->num_drag_enters_); | 666 EXPECT_EQ(1, drag_view->num_drag_enters_); |
666 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), | 667 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), |
667 drag_view->num_drag_updates_); | 668 drag_view->num_drag_updates_); |
668 EXPECT_EQ(0, drag_view->num_drops_); | 669 EXPECT_EQ(0, drag_view->num_drops_); |
669 EXPECT_EQ(1, drag_view->num_drag_exits_); | 670 EXPECT_EQ(1, drag_view->num_drag_exits_); |
670 EXPECT_TRUE(drag_view->drag_done_received_); | 671 EXPECT_TRUE(drag_view->drag_done_received_); |
671 } | 672 } |
672 | 673 |
673 } // namespace test | 674 } // namespace test |
674 } // namespace aura | 675 } // namespace aura |
OLD | NEW |