| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/path_service.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "ui/aura/window_event_dispatcher.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
| 13 #include "ui/base/dragdrop/drag_drop_types.h" | 14 #include "ui/base/dragdrop/drag_drop_types.h" |
| 15 #include "ui/base/resource/resource_bundle.h" |
| 14 #include "ui/base/test/ui_controls.h" | 16 #include "ui/base/test/ui_controls.h" |
| 17 #include "ui/base/ui_base_paths.h" |
| 18 #include "ui/gl/gl_surface.h" |
| 15 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 16 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 17 | 21 |
| 18 namespace ash { | 22 namespace ash { |
| 19 namespace internal { | 23 namespace internal { |
| 20 namespace { | 24 namespace { |
| 21 | 25 |
| 22 class DraggableView : public views::View { | 26 class DraggableView : public views::View { |
| 23 public: | 27 public: |
| 24 DraggableView() {} | 28 DraggableView() {} |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 115 } |
| 112 | 116 |
| 113 void DragDropAcrossMultiDisplay_Step1() { | 117 void DragDropAcrossMultiDisplay_Step1() { |
| 114 ui_controls::SendMouseEventsNotifyWhenDone( | 118 ui_controls::SendMouseEventsNotifyWhenDone( |
| 115 ui_controls::LEFT, ui_controls::DOWN, | 119 ui_controls::LEFT, ui_controls::DOWN, |
| 116 base::Bind(&DragDropAcrossMultiDisplay_Step2)); | 120 base::Bind(&DragDropAcrossMultiDisplay_Step2)); |
| 117 } | 121 } |
| 118 | 122 |
| 119 } // namespace | 123 } // namespace |
| 120 | 124 |
| 121 typedef test::AshTestBase DragDropTest; | 125 class DragDropTest : public test::AshTestBase { |
| 126 public: |
| 127 DragDropTest() {} |
| 128 virtual ~DragDropTest() {} |
| 129 |
| 130 virtual void SetUp() OVERRIDE { |
| 131 gfx::GLSurface::InitializeOneOffForTests(); |
| 132 |
| 133 ui::RegisterPathProvider(); |
| 134 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
| 135 base::FilePath resources_pack_path; |
| 136 PathService::Get(base::DIR_MODULE, &resources_pack_path); |
| 137 resources_pack_path = |
| 138 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); |
| 139 ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 140 resources_pack_path, ui::SCALE_FACTOR_NONE); |
| 141 |
| 142 test::AshTestBase::SetUp(); |
| 143 } |
| 144 }; |
| 122 | 145 |
| 123 #if defined(OS_WIN) | 146 #if defined(OS_WIN) |
| 124 #define MAYBE_DragDropAcrossMultiDisplay DISABLED_DragDropAcrossMultiDisplay | 147 #define MAYBE_DragDropAcrossMultiDisplay DISABLED_DragDropAcrossMultiDisplay |
| 125 #else | 148 #else |
| 126 #define MAYBE_DragDropAcrossMultiDisplay DragDropAcrossMultiDisplay | 149 #define MAYBE_DragDropAcrossMultiDisplay DragDropAcrossMultiDisplay |
| 127 #endif | 150 #endif |
| 128 | 151 |
| 129 // Test if the mouse gets moved properly to another display | 152 // Test if the mouse gets moved properly to another display |
| 130 // during drag & drop operation. | 153 // during drag & drop operation. |
| 131 TEST_F(DragDropTest, MAYBE_DragDropAcrossMultiDisplay) { | 154 TEST_F(DragDropTest, MAYBE_DragDropAcrossMultiDisplay) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 156 base::MessageLoop::current()->Run(); | 179 base::MessageLoop::current()->Run(); |
| 157 | 180 |
| 158 EXPECT_TRUE(target_view->dropped()); | 181 EXPECT_TRUE(target_view->dropped()); |
| 159 | 182 |
| 160 source->Close(); | 183 source->Close(); |
| 161 target->Close(); | 184 target->Close(); |
| 162 } | 185 } |
| 163 | 186 |
| 164 } // namespace internal | 187 } // namespace internal |
| 165 } // namespace ash | 188 } // namespace ash |
| OLD | NEW |