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/aura/window_tree_host.h" |
18 #include "ui/base/clipboard/clipboard.h" | 18 #include "ui/base/clipboard/clipboard.h" |
19 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 19 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
20 #include "ui/base/dragdrop/drag_drop_types.h" | 20 #include "ui/base/dragdrop/drag_drop_types.h" |
21 #include "ui/base/dragdrop/drag_utils.h" | 21 #include "ui/base/dragdrop/drag_utils.h" |
22 #include "ui/base/dragdrop/os_exchange_data.h" | 22 #include "ui/base/dragdrop/os_exchange_data.h" |
23 #include "ui/base/ui_base_switches.h" | 23 #include "ui/base/ui_base_switches.h" |
24 #include "ui/events/event.h" | 24 #include "ui/events/event.h" |
25 #include "ui/events/event_utils.h" | 25 #include "ui/events/event_utils.h" |
26 #include "ui/events/gestures/gesture_types.h" | 26 #include "ui/events/gestures/gesture_types.h" |
27 #include "ui/gfx/animation/linear_animation.h" | 27 #include "ui/gfx/animation/linear_animation.h" |
28 #include "ui/gfx/image/image_skia_rep.h" | 28 #include "ui/gfx/image/image_skia_rep.h" |
| 29 #include "ui/views/test/test_views_delegate.h" |
29 #include "ui/views/view.h" | 30 #include "ui/views/view.h" |
30 #include "ui/views/views_delegate.h" | 31 #include "ui/views/views_delegate.h" |
31 #include "ui/views/widget/native_widget_aura.h" | 32 #include "ui/views/widget/native_widget_aura.h" |
32 #include "ui/views/widget/native_widget_delegate.h" | 33 #include "ui/views/widget/native_widget_delegate.h" |
33 #include "ui/views/widget/widget.h" | 34 #include "ui/views/widget/widget.h" |
34 | 35 |
35 namespace ash { | 36 namespace ash { |
36 namespace test { | 37 namespace test { |
37 | 38 |
38 namespace { | 39 namespace { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 public: | 292 public: |
292 DragDropControllerTest() : AshTestBase() {} | 293 DragDropControllerTest() : AshTestBase() {} |
293 virtual ~DragDropControllerTest() {} | 294 virtual ~DragDropControllerTest() {} |
294 | 295 |
295 virtual void SetUp() OVERRIDE { | 296 virtual void SetUp() OVERRIDE { |
296 AshTestBase::SetUp(); | 297 AshTestBase::SetUp(); |
297 drag_drop_controller_.reset(new TestDragDropController); | 298 drag_drop_controller_.reset(new TestDragDropController); |
298 drag_drop_controller_->set_should_block_during_drag_drop(false); | 299 drag_drop_controller_->set_should_block_during_drag_drop(false); |
299 aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), | 300 aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), |
300 drag_drop_controller_.get()); | 301 drag_drop_controller_.get()); |
| 302 views_delegate_.reset(new views::TestViewsDelegate); |
301 } | 303 } |
302 | 304 |
303 virtual void TearDown() OVERRIDE { | 305 virtual void TearDown() OVERRIDE { |
304 aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), NULL); | 306 aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), NULL); |
305 drag_drop_controller_.reset(); | 307 drag_drop_controller_.reset(); |
306 AshTestBase::TearDown(); | 308 AshTestBase::TearDown(); |
307 } | 309 } |
308 | 310 |
309 void UpdateDragData(ui::OSExchangeData* data) { | 311 void UpdateDragData(ui::OSExchangeData* data) { |
310 drag_drop_controller_->drag_data_ = data; | 312 drag_drop_controller_->drag_data_ = data; |
(...skipping 24 matching lines...) Expand all Loading... |
335 | 337 |
336 void CompleteCancelAnimation() { | 338 void CompleteCancelAnimation() { |
337 CompletableLinearAnimation* animation = | 339 CompletableLinearAnimation* animation = |
338 static_cast<CompletableLinearAnimation*>( | 340 static_cast<CompletableLinearAnimation*>( |
339 drag_drop_controller_->cancel_animation_.get()); | 341 drag_drop_controller_->cancel_animation_.get()); |
340 animation->Complete(); | 342 animation->Complete(); |
341 } | 343 } |
342 | 344 |
343 protected: | 345 protected: |
344 scoped_ptr<TestDragDropController> drag_drop_controller_; | 346 scoped_ptr<TestDragDropController> drag_drop_controller_; |
| 347 scoped_ptr<views::TestViewsDelegate> views_delegate_; |
345 | 348 |
346 private: | 349 private: |
347 DISALLOW_COPY_AND_ASSIGN(DragDropControllerTest); | 350 DISALLOW_COPY_AND_ASSIGN(DragDropControllerTest); |
348 }; | 351 }; |
349 | 352 |
350 // TODO(win_aura) http://crbug.com/154081 | 353 // TODO(win_aura) http://crbug.com/154081 |
351 #if defined(OS_WIN) | 354 #if defined(OS_WIN) |
352 #define MAYBE_DragDropInSingleViewTest DISABLED_DragDropInSingleViewTest | 355 #define MAYBE_DragDropInSingleViewTest DISABLED_DragDropInSingleViewTest |
353 #else | 356 #else |
354 #define MAYBE_DragDropInSingleViewTest DragDropInSingleViewTest | 357 #define MAYBE_DragDropInSingleViewTest DragDropInSingleViewTest |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); | 1078 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); |
1076 } | 1079 } |
1077 for (aura::Window::Windows::iterator iter = root_windows.begin(); | 1080 for (aura::Window::Windows::iterator iter = root_windows.begin(); |
1078 iter != root_windows.end(); ++iter) { | 1081 iter != root_windows.end(); ++iter) { |
1079 aura::client::SetDragDropClient(*iter, NULL); | 1082 aura::client::SetDragDropClient(*iter, NULL); |
1080 } | 1083 } |
1081 } | 1084 } |
1082 | 1085 |
1083 } // namespace test | 1086 } // namespace test |
1084 } // namespace aura | 1087 } // namespace aura |
OLD | NEW |