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