| 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_atom_cache.h" |
| 28 #include "ui/gfx/x/x11_types.h" | 28 #include "ui/gfx/x/x11_types.h" |
| 29 #include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater.h" | |
| 30 #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" |
| 31 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" | 30 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
| 32 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 33 #include "ui/views/widget/desktop_aura/x11_move_loop.h" | 32 #include "ui/views/widget/desktop_aura/x11_move_loop.h" |
| 34 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| 35 | 34 |
| 36 #include <X11/Xlib.h> | 35 #include <X11/Xlib.h> |
| 37 | 36 |
| 38 namespace views { | 37 namespace views { |
| 39 | 38 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 412 |
| 414 // Create widget to initiate the drags. | 413 // Create widget to initiate the drags. |
| 415 widget_.reset(new Widget); | 414 widget_.reset(new Widget); |
| 416 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); | 415 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
| 417 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 416 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 418 params.native_widget = new DesktopNativeWidgetAura(widget_.get()); | 417 params.native_widget = new DesktopNativeWidgetAura(widget_.get()); |
| 419 params.bounds = gfx::Rect(100, 100); | 418 params.bounds = gfx::Rect(100, 100); |
| 420 widget_->Init(params); | 419 widget_->Init(params); |
| 421 widget_->Show(); | 420 widget_->Show(); |
| 422 | 421 |
| 423 cursor_manager_.reset(new DesktopNativeCursorManager( | 422 cursor_manager_.reset(new DesktopNativeCursorManager()); |
| 424 DesktopCursorLoaderUpdater::Create())); | |
| 425 | 423 |
| 426 client_.reset(new TestDragDropClient(widget_->GetNativeWindow(), | 424 client_.reset(new TestDragDropClient(widget_->GetNativeWindow(), |
| 427 cursor_manager_.get())); | 425 cursor_manager_.get())); |
| 428 client_->Init(); | 426 client_->Init(); |
| 429 } | 427 } |
| 430 | 428 |
| 431 void TearDown() override { | 429 void TearDown() override { |
| 432 client_.reset(); | 430 client_.reset(); |
| 433 cursor_manager_.reset(); | 431 cursor_manager_.reset(); |
| 434 widget_.reset(); | 432 widget_.reset(); |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 | 887 |
| 890 // Create widget to initiate the drags. | 888 // Create widget to initiate the drags. |
| 891 widget_.reset(new Widget); | 889 widget_.reset(new Widget); |
| 892 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); | 890 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
| 893 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 891 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 894 params.native_widget = new DesktopNativeWidgetAura(widget_.get()); | 892 params.native_widget = new DesktopNativeWidgetAura(widget_.get()); |
| 895 params.bounds = gfx::Rect(100, 100); | 893 params.bounds = gfx::Rect(100, 100); |
| 896 widget_->Init(params); | 894 widget_->Init(params); |
| 897 widget_->Show(); | 895 widget_->Show(); |
| 898 | 896 |
| 899 cursor_manager_.reset(new DesktopNativeCursorManager( | 897 cursor_manager_.reset(new DesktopNativeCursorManager()); |
| 900 DesktopCursorLoaderUpdater::Create())); | |
| 901 | 898 |
| 902 client_.reset(new SimpleTestDragDropClient(widget_->GetNativeWindow(), | 899 client_.reset(new SimpleTestDragDropClient(widget_->GetNativeWindow(), |
| 903 cursor_manager_.get())); | 900 cursor_manager_.get())); |
| 904 client_->Init(); | 901 client_->Init(); |
| 905 } | 902 } |
| 906 | 903 |
| 907 void TearDown() override { | 904 void TearDown() override { |
| 908 client_.reset(); | 905 client_.reset(); |
| 909 cursor_manager_.reset(); | 906 cursor_manager_.reset(); |
| 910 widget_.reset(); | 907 widget_.reset(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 // the aura::client::DragDropDelegate is properly notified. | 999 // the aura::client::DragDropDelegate is properly notified. |
| 1003 TEST_F(DesktopDragDropClientAuraX11ChromeSourceTargetTest, CtrlPressed) { | 1000 TEST_F(DesktopDragDropClientAuraX11ChromeSourceTargetTest, CtrlPressed) { |
| 1004 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1001 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1005 FROM_HERE, | 1002 FROM_HERE, |
| 1006 base::Bind(&ChromeSourceTargetStep2, client(), ui::EF_CONTROL_DOWN)); | 1003 base::Bind(&ChromeSourceTargetStep2, client(), ui::EF_CONTROL_DOWN)); |
| 1007 int result = StartDragAndDrop(); | 1004 int result = StartDragAndDrop(); |
| 1008 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, result); | 1005 EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, result); |
| 1009 } | 1006 } |
| 1010 | 1007 |
| 1011 } // namespace views | 1008 } // namespace views |
| OLD | NEW |