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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "ui/aura/client/capture_client.h" | 14 #include "ui/aura/client/capture_client.h" |
15 #include "ui/aura/test/event_generator.h" | 15 #include "ui/aura/test/event_generator.h" |
16 #include "ui/aura/window_event_dispatcher.h" | 16 #include "ui/aura/window_event_dispatcher.h" |
| 17 #include "ui/aura/window_tree_host.h" |
17 #include "ui/base/clipboard/clipboard.h" | 18 #include "ui/base/clipboard/clipboard.h" |
18 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 19 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
19 #include "ui/base/dragdrop/drag_drop_types.h" | 20 #include "ui/base/dragdrop/drag_drop_types.h" |
20 #include "ui/base/dragdrop/drag_utils.h" | 21 #include "ui/base/dragdrop/drag_utils.h" |
21 #include "ui/base/dragdrop/os_exchange_data.h" | 22 #include "ui/base/dragdrop/os_exchange_data.h" |
22 #include "ui/base/ui_base_switches.h" | 23 #include "ui/base/ui_base_switches.h" |
23 #include "ui/events/event.h" | 24 #include "ui/events/event.h" |
24 #include "ui/events/event_utils.h" | 25 #include "ui/events/event_utils.h" |
25 #include "ui/events/gestures/gesture_types.h" | 26 #include "ui/events/gestures/gesture_types.h" |
26 #include "ui/gfx/animation/linear_animation.h" | 27 #include "ui/gfx/animation/linear_animation.h" |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 UpdateDragData(&data); | 732 UpdateDragData(&data); |
732 generator.MoveMouseBy(0, 1); | 733 generator.MoveMouseBy(0, 1); |
733 | 734 |
734 // We send a unexpected mouse move event. Note that we cannot use | 735 // We send a unexpected mouse move event. Note that we cannot use |
735 // EventGenerator since it implicitly turns these into mouse drag events. | 736 // EventGenerator since it implicitly turns these into mouse drag events. |
736 // The DragDropController should simply ignore these events. | 737 // The DragDropController should simply ignore these events. |
737 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); | 738 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); |
738 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, | 739 ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, |
739 mouse_move_location, 0, 0); | 740 mouse_move_location, 0, 0); |
740 ui::EventDispatchDetails details = Shell::GetPrimaryRootWindow()-> | 741 ui::EventDispatchDetails details = Shell::GetPrimaryRootWindow()-> |
741 GetHost()->dispatcher()->OnEventFromSource(&mouse_move); | 742 GetHost()->event_processor()->OnEventFromSource(&mouse_move); |
742 ASSERT_FALSE(details.dispatcher_destroyed); | 743 ASSERT_FALSE(details.dispatcher_destroyed); |
743 } | 744 } |
744 | 745 |
745 generator.ReleaseLeftButton(); | 746 generator.ReleaseLeftButton(); |
746 | 747 |
747 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); | 748 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); |
748 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), | 749 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), |
749 drag_drop_controller_->num_drag_updates_); | 750 drag_drop_controller_->num_drag_updates_); |
750 EXPECT_TRUE(drag_drop_controller_->drop_received_); | 751 EXPECT_TRUE(drag_drop_controller_->drop_received_); |
751 EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), | 752 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()); | 1080 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); |
1080 } | 1081 } |
1081 for (aura::Window::Windows::iterator iter = root_windows.begin(); | 1082 for (aura::Window::Windows::iterator iter = root_windows.begin(); |
1082 iter != root_windows.end(); ++iter) { | 1083 iter != root_windows.end(); ++iter) { |
1083 aura::client::SetDragDropClient(*iter, NULL); | 1084 aura::client::SetDragDropClient(*iter, NULL); |
1084 } | 1085 } |
1085 } | 1086 } |
1086 | 1087 |
1087 } // namespace test | 1088 } // namespace test |
1088 } // namespace aura | 1089 } // namespace aura |
OLD | NEW |