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" |
11 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
12 #include "ui/aura/test/event_generator.h" | 12 #include "ui/aura/test/event_generator.h" |
13 #include "ui/base/clipboard/clipboard.h" | 13 #include "ui/base/clipboard/clipboard.h" |
14 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 14 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
15 #include "ui/base/dragdrop/drag_drop_types.h" | 15 #include "ui/base/dragdrop/drag_drop_types.h" |
16 #include "ui/base/dragdrop/os_exchange_data.h" | 16 #include "ui/base/dragdrop/os_exchange_data.h" |
17 #include "ui/base/event.h" | 17 #include "ui/base/event.h" |
18 #include "ui/views/events/event.h" | |
19 #include "ui/views/test/test_views_delegate.h" | 18 #include "ui/views/test/test_views_delegate.h" |
20 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
21 #include "ui/views/views_delegate.h" | 20 #include "ui/views/views_delegate.h" |
22 #include "ui/views/widget/native_widget_aura.h" | 21 #include "ui/views/widget/native_widget_aura.h" |
23 #include "ui/views/widget/native_widget_delegate.h" | 22 #include "ui/views/widget/native_widget_delegate.h" |
24 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
25 | 24 |
26 namespace ash { | 25 namespace ash { |
27 namespace test { | 26 namespace test { |
28 | 27 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bool GetDropFormats(int* formats, | 73 bool GetDropFormats(int* formats, |
75 std::set<OSExchangeData::CustomFormat>* custom_formats) { | 74 std::set<OSExchangeData::CustomFormat>* custom_formats) { |
76 *formats = ui::OSExchangeData::STRING; | 75 *formats = ui::OSExchangeData::STRING; |
77 return true; | 76 return true; |
78 } | 77 } |
79 | 78 |
80 bool CanDrop(const OSExchangeData& data) OVERRIDE { | 79 bool CanDrop(const OSExchangeData& data) OVERRIDE { |
81 return true; | 80 return true; |
82 } | 81 } |
83 | 82 |
84 void OnDragEntered(const views::DropTargetEvent& event) OVERRIDE { | 83 void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE { |
85 num_drag_enters_++; | 84 num_drag_enters_++; |
86 } | 85 } |
87 | 86 |
88 int OnDragUpdated(const views::DropTargetEvent& event) OVERRIDE { | 87 int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE { |
89 num_drag_updates_++; | 88 num_drag_updates_++; |
90 return ui::DragDropTypes::DRAG_COPY; | 89 return ui::DragDropTypes::DRAG_COPY; |
91 } | 90 } |
92 | 91 |
93 void OnDragExited() OVERRIDE { | 92 void OnDragExited() OVERRIDE { |
94 num_drag_exits_++; | 93 num_drag_exits_++; |
95 } | 94 } |
96 | 95 |
97 int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE { | 96 int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE { |
98 num_drops_++; | 97 num_drops_++; |
99 return ui::DragDropTypes::DRAG_COPY; | 98 return ui::DragDropTypes::DRAG_COPY; |
100 } | 99 } |
101 | 100 |
102 void OnDragDone() OVERRIDE { | 101 void OnDragDone() OVERRIDE { |
103 drag_done_received_ = true; | 102 drag_done_received_ = true; |
104 } | 103 } |
105 | 104 |
106 DISALLOW_COPY_AND_ASSIGN(DragTestView); | 105 DISALLOW_COPY_AND_ASSIGN(DragTestView); |
107 }; | 106 }; |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 EXPECT_EQ(1, drag_view->num_drag_enters_); | 665 EXPECT_EQ(1, drag_view->num_drag_enters_); |
667 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), | 666 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), |
668 drag_view->num_drag_updates_); | 667 drag_view->num_drag_updates_); |
669 EXPECT_EQ(0, drag_view->num_drops_); | 668 EXPECT_EQ(0, drag_view->num_drops_); |
670 EXPECT_EQ(1, drag_view->num_drag_exits_); | 669 EXPECT_EQ(1, drag_view->num_drag_exits_); |
671 EXPECT_TRUE(drag_view->drag_done_received_); | 670 EXPECT_TRUE(drag_view->drag_done_received_); |
672 } | 671 } |
673 | 672 |
674 } // namespace test | 673 } // namespace test |
675 } // namespace aura | 674 } // namespace aura |
OLD | NEW |