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 <vector> | 6 #include <vector> |
7 | 7 |
8 // Include views_test_base.h first because the definition of None in X.h | 8 // Include views_test_base.h first because the definition of None in X.h |
9 // conflicts with the definition of None in gtest-type-util.h | 9 // conflicts with the definition of None in gtest-type-util.h |
10 #include "ui/views/test/views_test_base.h" | 10 #include "ui/views/test/views_test_base.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 class TestMoveLoop : public X11MoveLoop { | 80 class TestMoveLoop : public X11MoveLoop { |
81 public: | 81 public: |
82 explicit TestMoveLoop(X11MoveLoopDelegate* delegate); | 82 explicit TestMoveLoop(X11MoveLoopDelegate* delegate); |
83 virtual ~TestMoveLoop(); | 83 virtual ~TestMoveLoop(); |
84 | 84 |
85 // Returns true if the move loop is running. | 85 // Returns true if the move loop is running. |
86 bool IsRunning() const; | 86 bool IsRunning() const; |
87 | 87 |
88 // X11MoveLoop: | 88 // X11MoveLoop: |
89 virtual bool RunMoveLoop(aura::Window* window, | 89 virtual bool RunMoveLoop(aura::Window* window, |
90 gfx::NativeCursor cursor) OVERRIDE; | 90 gfx::NativeCursor cursor) override; |
91 virtual void UpdateCursor(gfx::NativeCursor cursor) OVERRIDE; | 91 virtual void UpdateCursor(gfx::NativeCursor cursor) override; |
92 virtual void EndMoveLoop() OVERRIDE; | 92 virtual void EndMoveLoop() override; |
93 | 93 |
94 private: | 94 private: |
95 // Not owned. | 95 // Not owned. |
96 X11MoveLoopDelegate* delegate_; | 96 X11MoveLoopDelegate* delegate_; |
97 | 97 |
98 // Ends the move loop. | 98 // Ends the move loop. |
99 base::Closure quit_closure_; | 99 base::Closure quit_closure_; |
100 | 100 |
101 bool is_running_; | 101 bool is_running_; |
102 }; | 102 }; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Sets |xid| as the topmost window at the current mouse position and | 146 // Sets |xid| as the topmost window at the current mouse position and |
147 // generates a synthetic mouse move. | 147 // generates a synthetic mouse move. |
148 void SetTopmostXWindowAndMoveMouse(::Window xid); | 148 void SetTopmostXWindowAndMoveMouse(::Window xid); |
149 | 149 |
150 // Returns true if the move loop is running. | 150 // Returns true if the move loop is running. |
151 bool IsMoveLoopRunning(); | 151 bool IsMoveLoopRunning(); |
152 | 152 |
153 private: | 153 private: |
154 // DesktopDragDropClientAuraX11: | 154 // DesktopDragDropClientAuraX11: |
155 virtual scoped_ptr<X11MoveLoop> CreateMoveLoop( | 155 virtual scoped_ptr<X11MoveLoop> CreateMoveLoop( |
156 X11MoveLoopDelegate* delegate) OVERRIDE; | 156 X11MoveLoopDelegate* delegate) override; |
157 virtual ::Window FindWindowFor(const gfx::Point& screen_point) OVERRIDE; | 157 virtual ::Window FindWindowFor(const gfx::Point& screen_point) override; |
158 virtual void SendXClientEvent(::Window xid, XEvent* event) OVERRIDE; | 158 virtual void SendXClientEvent(::Window xid, XEvent* event) override; |
159 | 159 |
160 // The XID of the window which initiated the drag. | 160 // The XID of the window which initiated the drag. |
161 ::Window source_xid_; | 161 ::Window source_xid_; |
162 | 162 |
163 // The XID of the window which is simulated to be the topmost window at the | 163 // The XID of the window which is simulated to be the topmost window at the |
164 // current mouse position. | 164 // current mouse position. |
165 ::Window target_xid_; | 165 ::Window target_xid_; |
166 | 166 |
167 // The move loop. Not owned. | 167 // The move loop. Not owned. |
168 TestMoveLoop* loop_; | 168 TestMoveLoop* loop_; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 return client_->StartDragAndDrop( | 359 return client_->StartDragAndDrop( |
360 data, | 360 data, |
361 widget_->GetNativeWindow()->GetRootWindow(), | 361 widget_->GetNativeWindow()->GetRootWindow(), |
362 widget_->GetNativeWindow(), | 362 widget_->GetNativeWindow(), |
363 gfx::Point(), | 363 gfx::Point(), |
364 ui::DragDropTypes::DRAG_COPY, | 364 ui::DragDropTypes::DRAG_COPY, |
365 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); | 365 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); |
366 } | 366 } |
367 | 367 |
368 // ViewsTestBase: | 368 // ViewsTestBase: |
369 virtual void SetUp() OVERRIDE { | 369 virtual void SetUp() override { |
370 ViewsTestBase::SetUp(); | 370 ViewsTestBase::SetUp(); |
371 | 371 |
372 // Create widget to initiate the drags. | 372 // Create widget to initiate the drags. |
373 widget_.reset(new Widget); | 373 widget_.reset(new Widget); |
374 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); | 374 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
375 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 375 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
376 params.native_widget = new DesktopNativeWidgetAura(widget_.get()); | 376 params.native_widget = new DesktopNativeWidgetAura(widget_.get()); |
377 params.bounds = gfx::Rect(100, 100); | 377 params.bounds = gfx::Rect(100, 100); |
378 widget_->Init(params); | 378 widget_->Init(params); |
379 widget_->Show(); | 379 widget_->Show(); |
380 | 380 |
381 cursor_manager_.reset(new DesktopNativeCursorManager( | 381 cursor_manager_.reset(new DesktopNativeCursorManager( |
382 DesktopCursorLoaderUpdater::Create())); | 382 DesktopCursorLoaderUpdater::Create())); |
383 | 383 |
384 client_.reset(new TestDragDropClient(widget_->GetNativeWindow(), | 384 client_.reset(new TestDragDropClient(widget_->GetNativeWindow(), |
385 cursor_manager_.get())); | 385 cursor_manager_.get())); |
386 client_->Init(); | 386 client_->Init(); |
387 } | 387 } |
388 | 388 |
389 virtual void TearDown() OVERRIDE { | 389 virtual void TearDown() override { |
390 client_.reset(); | 390 client_.reset(); |
391 cursor_manager_.reset(); | 391 cursor_manager_.reset(); |
392 widget_.reset(); | 392 widget_.reset(); |
393 ViewsTestBase::TearDown(); | 393 ViewsTestBase::TearDown(); |
394 } | 394 } |
395 | 395 |
396 TestDragDropClient* client() { | 396 TestDragDropClient* client() { |
397 return client_.get(); | 397 return client_.get(); |
398 } | 398 } |
399 | 399 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 | 716 |
717 // Repeat the test but reject the drop in the XdndFinished message instead. | 717 // Repeat the test but reject the drop in the XdndFinished message instead. |
718 base::MessageLoop::current()->PostTask( | 718 base::MessageLoop::current()->PostTask( |
719 FROM_HERE, | 719 FROM_HERE, |
720 base::Bind(&RejectAfterMouseReleaseStep3, client())); | 720 base::Bind(&RejectAfterMouseReleaseStep3, client())); |
721 result = StartDragAndDrop(); | 721 result = StartDragAndDrop(); |
722 EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, result); | 722 EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, result); |
723 } | 723 } |
724 | 724 |
725 } // namespace views | 725 } // namespace views |
OLD | NEW |