| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <map> | 5 #include <map> |
| 6 #include <memory> | 6 #include <memory> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 // Include views_test_base.h first because the definition of None in X.h | 9 // Include views_test_base.h first because the definition of None in X.h |
| 10 // conflicts with the definition of None in gtest-type-util.h | 10 // conflicts with the definition of None in gtest-type-util.h |
| 11 #include "ui/views/test/views_test_base.h" | 11 #include "ui/views/test/views_test_base.h" |
| 12 | 12 |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
| 20 #include "ui/aura/client/drag_drop_delegate.h" | 20 #include "ui/aura/client/drag_drop_delegate.h" |
| 21 #include "ui/aura/test/test_screen.h" | 21 #include "ui/aura/test/test_screen.h" |
| 22 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 23 #include "ui/aura/window_tree_host.h" | 23 #include "ui/aura/window_tree_host.h" |
| 24 #include "ui/base/dragdrop/os_exchange_data.h" | 24 #include "ui/base/dragdrop/os_exchange_data.h" |
| 25 #include "ui/base/x/x11_util.h" | 25 #include "ui/base/x/x11_util.h" |
| 26 #include "ui/events/event_utils.h" | 26 #include "ui/events/event_utils.h" |
| 27 #include "ui/gfx/x/x11_atom_cache.h" |
| 27 #include "ui/gfx/x/x11_types.h" | 28 #include "ui/gfx/x/x11_types.h" |
| 28 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" | 29 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" |
| 29 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" | 30 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
| 30 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 31 #include "ui/views/widget/desktop_aura/x11_move_loop.h" | 32 #include "ui/views/widget/desktop_aura/x11_move_loop.h" |
| 32 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| 33 | 34 |
| 34 #include <X11/Xlib.h> | 35 #include <X11/Xlib.h> |
| 35 | 36 |
| 36 namespace views { | 37 namespace views { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 TestDragDropClient::TestDragDropClient( | 295 TestDragDropClient::TestDragDropClient( |
| 295 aura::Window* window, | 296 aura::Window* window, |
| 296 DesktopNativeCursorManager* cursor_manager) | 297 DesktopNativeCursorManager* cursor_manager) |
| 297 : SimpleTestDragDropClient(window, cursor_manager), | 298 : SimpleTestDragDropClient(window, cursor_manager), |
| 298 source_xid_(window->GetHost()->GetAcceleratedWidget()) {} | 299 source_xid_(window->GetHost()->GetAcceleratedWidget()) {} |
| 299 | 300 |
| 300 TestDragDropClient::~TestDragDropClient() { | 301 TestDragDropClient::~TestDragDropClient() { |
| 301 } | 302 } |
| 302 | 303 |
| 303 Atom TestDragDropClient::GetAtom(const char* name) { | 304 Atom TestDragDropClient::GetAtom(const char* name) { |
| 304 return ui::GetAtom(name); | 305 return gfx::GetAtom(name); |
| 305 } | 306 } |
| 306 | 307 |
| 307 bool TestDragDropClient::MessageHasType(const XClientMessageEvent& event, | 308 bool TestDragDropClient::MessageHasType(const XClientMessageEvent& event, |
| 308 const char* type) { | 309 const char* type) { |
| 309 return event.message_type == GetAtom(type); | 310 return event.message_type == GetAtom(type); |
| 310 } | 311 } |
| 311 | 312 |
| 312 void TestDragDropClient::SetEventCollectorFor( | 313 void TestDragDropClient::SetEventCollectorFor( |
| 313 ::Window xid, | 314 ::Window xid, |
| 314 ClientMessageEventCollector* collector) { | 315 ClientMessageEventCollector* collector) { |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 // the aura::client::DragDropDelegate is properly notified. | 983 // the aura::client::DragDropDelegate is properly notified. |
| 983 TEST_F(DesktopDragDropClientAuraX11ChromeSourceTargetTest, CtrlPressed) { | 984 TEST_F(DesktopDragDropClientAuraX11ChromeSourceTargetTest, CtrlPressed) { |
| 984 base::ThreadTaskRunnerHandle::Get()->PostTask( | 985 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 985 FROM_HERE, | 986 FROM_HERE, |
| 986 base::Bind(&ChromeSourceTargetStep2, client(), ui::EF_CONTROL_DOWN)); | 987 base::Bind(&ChromeSourceTargetStep2, client(), ui::EF_CONTROL_DOWN)); |
| 987 int result = StartDragAndDrop(); | 988 int result = StartDragAndDrop(); |
| 988 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, result); | 989 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, result); |
| 989 } | 990 } |
| 990 | 991 |
| 991 } // namespace views | 992 } // namespace views |
| OLD | NEW |