| 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/common/drag_drop/drag_image_view.h" | 7 #include "ash/common/drag_drop/drag_image_view.h" |
| 8 #include "ash/drag_drop/drag_drop_tracker.h" | 8 #include "ash/drag_drop/drag_drop_tracker.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" |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 | 929 |
| 930 public: | 930 public: |
| 931 gfx::Point window_location_on_destroying_; | 931 gfx::Point window_location_on_destroying_; |
| 932 }; | 932 }; |
| 933 | 933 |
| 934 } // namespace | 934 } // namespace |
| 935 | 935 |
| 936 // Verifies the drag image moves back to the position where drag is started | 936 // Verifies the drag image moves back to the position where drag is started |
| 937 // across displays when drag is cancelled. | 937 // across displays when drag is cancelled. |
| 938 TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) { | 938 TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) { |
| 939 if (!SupportsMultipleDisplays()) | |
| 940 return; | |
| 941 | |
| 942 UpdateDisplay("400x400,400x400"); | 939 UpdateDisplay("400x400,400x400"); |
| 943 aura::Window::Windows root_windows = | 940 aura::Window::Windows root_windows = |
| 944 Shell::GetInstance()->GetAllRootWindows(); | 941 Shell::GetInstance()->GetAllRootWindows(); |
| 945 for (aura::Window::Windows::iterator iter = root_windows.begin(); | 942 for (aura::Window::Windows::iterator iter = root_windows.begin(); |
| 946 iter != root_windows.end(); ++iter) { | 943 iter != root_windows.end(); ++iter) { |
| 947 aura::client::SetDragDropClient(*iter, drag_drop_controller_.get()); | 944 aura::client::SetDragDropClient(*iter, drag_drop_controller_.get()); |
| 948 } | 945 } |
| 949 | 946 |
| 950 ui::OSExchangeData data; | 947 ui::OSExchangeData data; |
| 951 data.SetString(base::UTF8ToUTF16("I am being dragged")); | 948 data.SetString(base::UTF8ToUTF16("I am being dragged")); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); | 1007 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); |
| 1011 } | 1008 } |
| 1012 for (aura::Window::Windows::iterator iter = root_windows.begin(); | 1009 for (aura::Window::Windows::iterator iter = root_windows.begin(); |
| 1013 iter != root_windows.end(); ++iter) { | 1010 iter != root_windows.end(); ++iter) { |
| 1014 aura::client::SetDragDropClient(*iter, NULL); | 1011 aura::client::SetDragDropClient(*iter, NULL); |
| 1015 } | 1012 } |
| 1016 } | 1013 } |
| 1017 | 1014 |
| 1018 // Verifies that a drag is aborted if a display is disconnected during the drag. | 1015 // Verifies that a drag is aborted if a display is disconnected during the drag. |
| 1019 TEST_F(DragDropControllerTest, DragCancelOnDisplayDisconnect) { | 1016 TEST_F(DragDropControllerTest, DragCancelOnDisplayDisconnect) { |
| 1020 if (!SupportsMultipleDisplays()) | |
| 1021 return; | |
| 1022 | |
| 1023 UpdateDisplay("400x400,400x400"); | 1017 UpdateDisplay("400x400,400x400"); |
| 1024 for (aura::Window* root : Shell::GetInstance()->GetAllRootWindows()) { | 1018 for (aura::Window* root : Shell::GetInstance()->GetAllRootWindows()) { |
| 1025 aura::client::SetDragDropClient(root, drag_drop_controller_.get()); | 1019 aura::client::SetDragDropClient(root, drag_drop_controller_.get()); |
| 1026 } | 1020 } |
| 1027 | 1021 |
| 1028 ui::OSExchangeData data; | 1022 ui::OSExchangeData data; |
| 1029 data.SetString(base::UTF8ToUTF16("I am being dragged")); | 1023 data.SetString(base::UTF8ToUTF16("I am being dragged")); |
| 1030 std::unique_ptr<views::Widget> widget(CreateNewWidget()); | 1024 std::unique_ptr<views::Widget> widget(CreateNewWidget()); |
| 1031 aura::Window* window = widget->GetNativeWindow(); | 1025 aura::Window* window = widget->GetNativeWindow(); |
| 1032 drag_drop_controller_->StartDragAndDrop( | 1026 drag_drop_controller_->StartDragAndDrop( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 drag_drop_controller_->drag_string_); | 1092 drag_drop_controller_->drag_string_); |
| 1099 EXPECT_EQ(1, drag_view->num_drag_enters_); | 1093 EXPECT_EQ(1, drag_view->num_drag_enters_); |
| 1100 EXPECT_EQ(2, drag_view->num_drag_updates_); | 1094 EXPECT_EQ(2, drag_view->num_drag_updates_); |
| 1101 EXPECT_EQ(1, drag_view->num_drops_); | 1095 EXPECT_EQ(1, drag_view->num_drops_); |
| 1102 EXPECT_EQ(0, drag_view->num_drag_exits_); | 1096 EXPECT_EQ(0, drag_view->num_drag_exits_); |
| 1103 EXPECT_TRUE(drag_view->drag_done_received_); | 1097 EXPECT_TRUE(drag_view->drag_done_received_); |
| 1104 } | 1098 } |
| 1105 | 1099 |
| 1106 } // namespace test | 1100 } // namespace test |
| 1107 } // namespace ash | 1101 } // namespace ash |
| OLD | NEW |