| 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 "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" |
| 6 | 6 |
| 7 #include "ash/wm/window_state.h" | 7 #include "ash/wm/window_state.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 // Drag to target_tab_strip. This should stop the nested loop from dragging | 583 // Drag to target_tab_strip. This should stop the nested loop from dragging |
| 584 // the window. | 584 // the window. |
| 585 gfx::Point target_point(target_tab_strip->width() -1, | 585 gfx::Point target_point(target_tab_strip->width() -1, |
| 586 target_tab_strip->height() / 2); | 586 target_tab_strip->height() / 2); |
| 587 views::View::ConvertPointToScreen(target_tab_strip, &target_point); | 587 views::View::ConvertPointToScreen(target_tab_strip, &target_point); |
| 588 ASSERT_TRUE(test->DragInputToAsync(target_point)); | 588 ASSERT_TRUE(test->DragInputToAsync(target_point)); |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace | 591 } // namespace |
| 592 | 592 |
| 593 #if defined(OS_CHROMEOS) | 593 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 594 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 594 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| 595 // compositor. crbug.com/331924 | 595 // compositor. crbug.com/331924 |
| 596 #define MAYBE_DragToSeparateWindow DISABLED_DragToSeparateWindow | 596 #define MAYBE_DragToSeparateWindow DISABLED_DragToSeparateWindow |
| 597 #else | 597 #else |
| 598 #define MAYBE_DragToSeparateWindow DragToSeparateWindow | 598 #define MAYBE_DragToSeparateWindow DragToSeparateWindow |
| 599 #endif | 599 #endif |
| 600 // Creates two browsers, drags from first into second. | 600 // Creates two browsers, drags from first into second. |
| 601 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 601 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| 602 MAYBE_DragToSeparateWindow) { | 602 MAYBE_DragToSeparateWindow) { |
| 603 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 603 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 bool IsWindowPositionManaged(gfx::NativeWindow window) { | 662 bool IsWindowPositionManaged(gfx::NativeWindow window) { |
| 663 return true; | 663 return true; |
| 664 } | 664 } |
| 665 bool HasUserChangedWindowPositionOrSize(gfx::NativeWindow window) { | 665 bool HasUserChangedWindowPositionOrSize(gfx::NativeWindow window) { |
| 666 return false; | 666 return false; |
| 667 } | 667 } |
| 668 #endif | 668 #endif |
| 669 | 669 |
| 670 } // namespace | 670 } // namespace |
| 671 | 671 |
| 672 #if defined(OS_CHROMEOS) | 672 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 673 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 673 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| 674 // compositor. crbug.com/331924 | 674 // compositor. crbug.com/331924 |
| 675 #define MAYBE_DetachToOwnWindow DISABLED_DetachToOwnWindow | 675 #define MAYBE_DetachToOwnWindow DISABLED_DetachToOwnWindow |
| 676 #else | 676 #else |
| 677 #define MAYBE_DetachToOwnWindow DetachToOwnWindow | 677 #define MAYBE_DetachToOwnWindow DetachToOwnWindow |
| 678 #endif | 678 #endif |
| 679 // Drags from browser to separate window and releases mouse. | 679 // Drags from browser to separate window and releases mouse. |
| 680 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 680 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| 681 MAYBE_DetachToOwnWindow) { | 681 MAYBE_DetachToOwnWindow) { |
| 682 const gfx::Rect initial_bounds(browser()->window()->GetBounds()); | 682 const gfx::Rect initial_bounds(browser()->window()->GetBounds()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 // Both windows should not be maximized | 724 // Both windows should not be maximized |
| 725 EXPECT_FALSE(browser()->window()->IsMaximized()); | 725 EXPECT_FALSE(browser()->window()->IsMaximized()); |
| 726 EXPECT_FALSE(new_browser->window()->IsMaximized()); | 726 EXPECT_FALSE(new_browser->window()->IsMaximized()); |
| 727 | 727 |
| 728 // The tab strip should no longer have capture because the drag was ended and | 728 // The tab strip should no longer have capture because the drag was ended and |
| 729 // mouse/touch was released. | 729 // mouse/touch was released. |
| 730 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture()); | 730 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture()); |
| 731 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture()); | 731 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture()); |
| 732 } | 732 } |
| 733 | 733 |
| 734 #if defined(OS_CHROMEOS) | 734 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 735 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 735 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| 736 // compositor. crbug.com/331924 | 736 // compositor. crbug.com/331924 |
| 737 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \ | 737 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \ |
| 738 DISABLED_DetachToOwnWindowFromMaximizedWindow | 738 DISABLED_DetachToOwnWindowFromMaximizedWindow |
| 739 #else | 739 #else |
| 740 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \ | 740 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \ |
| 741 DetachToOwnWindowFromMaximizedWindow | 741 DetachToOwnWindowFromMaximizedWindow |
| 742 #endif | 742 #endif |
| 743 // Drags from browser to a separate window and releases mouse. | 743 // Drags from browser to a separate window and releases mouse. |
| 744 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 744 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 ASSERT_EQ(1u, browser_list->size()); | 1016 ASSERT_EQ(1u, browser_list->size()); |
| 1017 if (test->input_source() == INPUT_SOURCE_TOUCH) { | 1017 if (test->input_source() == INPUT_SOURCE_TOUCH) { |
| 1018 ASSERT_TRUE(test->ReleaseInput()); | 1018 ASSERT_TRUE(test->ReleaseInput()); |
| 1019 } else { | 1019 } else { |
| 1020 ASSERT_TRUE(test->ReleaseMouseAsync()); | 1020 ASSERT_TRUE(test->ReleaseMouseAsync()); |
| 1021 } | 1021 } |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 } // namespace | 1024 } // namespace |
| 1025 | 1025 |
| 1026 #if defined(OS_CHROMEOS) | 1026 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 1027 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 1027 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| 1028 // compositor. crbug.com/331924 | 1028 // compositor. crbug.com/331924 |
| 1029 #define MAYBE_DragAll DISABLED_DragAll | 1029 #define MAYBE_DragAll DISABLED_DragAll |
| 1030 #else | 1030 #else |
| 1031 #define MAYBE_DragAll DragAll | 1031 #define MAYBE_DragAll DragAll |
| 1032 #endif | 1032 #endif |
| 1033 // Selects multiple tabs and starts dragging the window. | 1033 // Selects multiple tabs and starts dragging the window. |
| 1034 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, MAYBE_DragAll) { | 1034 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, MAYBE_DragAll) { |
| 1035 // Add another tab. | 1035 // Add another tab. |
| 1036 AddTabAndResetBrowser(browser()); | 1036 AddTabAndResetBrowser(browser()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 // Drag to target_tab_strip. This should stop the nested loop from dragging | 1077 // Drag to target_tab_strip. This should stop the nested loop from dragging |
| 1078 // the window. | 1078 // the window. |
| 1079 gfx::Point target_point(target_tab_strip->width() - 1, | 1079 gfx::Point target_point(target_tab_strip->width() - 1, |
| 1080 target_tab_strip->height() / 2); | 1080 target_tab_strip->height() / 2); |
| 1081 views::View::ConvertPointToScreen(target_tab_strip, &target_point); | 1081 views::View::ConvertPointToScreen(target_tab_strip, &target_point); |
| 1082 ASSERT_TRUE(test->DragInputToAsync(target_point)); | 1082 ASSERT_TRUE(test->DragInputToAsync(target_point)); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 } // namespace | 1085 } // namespace |
| 1086 | 1086 |
| 1087 #if defined(OS_CHROMEOS) | 1087 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 1088 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 1088 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| 1089 // compositor. crbug.com/331924 | 1089 // compositor. crbug.com/331924 |
| 1090 #define MAYBE_DragAllToSeparateWindow DISABLED_DragAllToSeparateWindow | 1090 #define MAYBE_DragAllToSeparateWindow DISABLED_DragAllToSeparateWindow |
| 1091 #else | 1091 #else |
| 1092 #define MAYBE_DragAllToSeparateWindow DragAllToSeparateWindow | 1092 #define MAYBE_DragAllToSeparateWindow DragAllToSeparateWindow |
| 1093 #endif | 1093 #endif |
| 1094 // Creates two browsers, selects all tabs in first and drags into second. | 1094 // Creates two browsers, selects all tabs in first and drags into second. |
| 1095 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 1095 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| 1096 MAYBE_DragAllToSeparateWindow) { | 1096 MAYBE_DragAllToSeparateWindow) { |
| 1097 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1097 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 // Drag to target_tab_strip. This should stop the nested loop from dragging | 1150 // Drag to target_tab_strip. This should stop the nested loop from dragging |
| 1151 // the window. | 1151 // the window. |
| 1152 gfx::Point target_point(target_tab_strip->width() - 1, | 1152 gfx::Point target_point(target_tab_strip->width() - 1, |
| 1153 target_tab_strip->height() / 2); | 1153 target_tab_strip->height() / 2); |
| 1154 views::View::ConvertPointToScreen(target_tab_strip, &target_point); | 1154 views::View::ConvertPointToScreen(target_tab_strip, &target_point); |
| 1155 ASSERT_TRUE(test->DragInputToAsync(target_point)); | 1155 ASSERT_TRUE(test->DragInputToAsync(target_point)); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 } // namespace | 1158 } // namespace |
| 1159 | 1159 |
| 1160 #if defined(OS_CHROMEOS) | 1160 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 1161 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 1161 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| 1162 // compositor. crbug.com/331924 | 1162 // compositor. crbug.com/331924 |
| 1163 #define MAYBE_DragAllToSeparateWindowAndCancel \ | 1163 #define MAYBE_DragAllToSeparateWindowAndCancel \ |
| 1164 DISABLED_DragAllToSeparateWindowAndCancel | 1164 DISABLED_DragAllToSeparateWindowAndCancel |
| 1165 #else | 1165 #else |
| 1166 #define MAYBE_DragAllToSeparateWindowAndCancel DragAllToSeparateWindowAndCancel | 1166 #define MAYBE_DragAllToSeparateWindowAndCancel DragAllToSeparateWindowAndCancel |
| 1167 #endif | 1167 #endif |
| 1168 // Creates two browsers, selects all tabs in first, drags into second, then hits | 1168 // Creates two browsers, selects all tabs in first, drags into second, then hits |
| 1169 // escape. | 1169 // escape. |
| 1170 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 1170 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 | 1207 |
| 1208 // browser() will have been destroyed, but browser2 should remain. | 1208 // browser() will have been destroyed, but browser2 should remain. |
| 1209 ASSERT_EQ(1u, native_browser_list->size()); | 1209 ASSERT_EQ(1u, native_browser_list->size()); |
| 1210 | 1210 |
| 1211 EXPECT_FALSE(GetIsDragged(browser2)); | 1211 EXPECT_FALSE(GetIsDragged(browser2)); |
| 1212 | 1212 |
| 1213 // Remaining browser window should not be maximized | 1213 // Remaining browser window should not be maximized |
| 1214 EXPECT_FALSE(browser2->window()->IsMaximized()); | 1214 EXPECT_FALSE(browser2->window()->IsMaximized()); |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 #if defined(OS_CHROMEOS) | 1217 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 1218 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 1218 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| 1219 // compositor. crbug.com/331924 | 1219 // compositor. crbug.com/331924 |
| 1220 #define MAYBE_DragDirectlyToSecondWindow DISABLED_DragDirectlyToSecondWindow | 1220 #define MAYBE_DragDirectlyToSecondWindow DISABLED_DragDirectlyToSecondWindow |
| 1221 #else | 1221 #else |
| 1222 #define MAYBE_DragDirectlyToSecondWindow DragDirectlyToSecondWindow | 1222 #define MAYBE_DragDirectlyToSecondWindow DragDirectlyToSecondWindow |
| 1223 #endif | 1223 #endif |
| 1224 // Creates two browsers, drags from first into the second in such a way that | 1224 // Creates two browsers, drags from first into the second in such a way that |
| 1225 // no detaching should happen. | 1225 // no detaching should happen. |
| 1226 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 1226 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| 1227 MAYBE_DragDirectlyToSecondWindow) { | 1227 MAYBE_DragDirectlyToSecondWindow) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 1262 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
| 1263 | 1263 |
| 1264 EXPECT_FALSE(GetIsDragged(browser())); | 1264 EXPECT_FALSE(GetIsDragged(browser())); |
| 1265 EXPECT_FALSE(GetIsDragged(browser2)); | 1265 EXPECT_FALSE(GetIsDragged(browser2)); |
| 1266 | 1266 |
| 1267 // Both windows should not be maximized | 1267 // Both windows should not be maximized |
| 1268 EXPECT_FALSE(browser()->window()->IsMaximized()); | 1268 EXPECT_FALSE(browser()->window()->IsMaximized()); |
| 1269 EXPECT_FALSE(browser2->window()->IsMaximized()); | 1269 EXPECT_FALSE(browser2->window()->IsMaximized()); |
| 1270 } | 1270 } |
| 1271 | 1271 |
| 1272 #if defined(OS_CHROMEOS) | 1272 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 1273 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 1273 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| 1274 // compositor. crbug.com/331924 | 1274 // compositor. crbug.com/331924 |
| 1275 #define MAYBE_DragSingleTabToSeparateWindow \ | 1275 #define MAYBE_DragSingleTabToSeparateWindow \ |
| 1276 DISABLED_DragSingleTabToSeparateWindow | 1276 DISABLED_DragSingleTabToSeparateWindow |
| 1277 #else | 1277 #else |
| 1278 #define MAYBE_DragSingleTabToSeparateWindow DragSingleTabToSeparateWindow | 1278 #define MAYBE_DragSingleTabToSeparateWindow DragSingleTabToSeparateWindow |
| 1279 #endif | 1279 #endif |
| 1280 // Creates two browsers, the first browser has a single tab and drags into the | 1280 // Creates two browsers, the first browser has a single tab and drags into the |
| 1281 // second browser. | 1281 // second browser. |
| 1282 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 1282 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2332 DetachToDockedTabDragControllerTest, | 2332 DetachToDockedTabDragControllerTest, |
| 2333 ::testing::Values("mouse", "mouse docked")); | 2333 ::testing::Values("mouse", "mouse docked")); |
| 2334 INSTANTIATE_TEST_CASE_P(TabDragging, | 2334 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2335 DetachToBrowserTabDragControllerTestTouch, | 2335 DetachToBrowserTabDragControllerTestTouch, |
| 2336 ::testing::Values("touch", "touch docked")); | 2336 ::testing::Values("touch", "touch docked")); |
| 2337 #else | 2337 #else |
| 2338 INSTANTIATE_TEST_CASE_P(TabDragging, | 2338 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2339 DetachToBrowserTabDragControllerTest, | 2339 DetachToBrowserTabDragControllerTest, |
| 2340 ::testing::Values("mouse")); | 2340 ::testing::Values("mouse")); |
| 2341 #endif | 2341 #endif |
| OLD | NEW |