| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 } // namespace test | 159 } // namespace test |
| 160 | 160 |
| 161 using test::GetCenterInScreenCoordinates; | 161 using test::GetCenterInScreenCoordinates; |
| 162 using test::SetID; | 162 using test::SetID; |
| 163 using test::ResetIDs; | 163 using test::ResetIDs; |
| 164 using test::IDString; | 164 using test::IDString; |
| 165 using test::GetTabStripForBrowser; | 165 using test::GetTabStripForBrowser; |
| 166 | 166 |
| 167 TabDragControllerTest::TabDragControllerTest() | 167 TabDragControllerTest::TabDragControllerTest() |
| 168 : native_browser_list(BrowserList::GetInstance( | 168 : browser_list(BrowserList::GetInstance()) {} |
| 169 chrome::HOST_DESKTOP_TYPE_NATIVE)) { | |
| 170 } | |
| 171 | 169 |
| 172 TabDragControllerTest::~TabDragControllerTest() { | 170 TabDragControllerTest::~TabDragControllerTest() { |
| 173 } | 171 } |
| 174 | 172 |
| 175 void TabDragControllerTest::StopAnimating(TabStrip* tab_strip) { | 173 void TabDragControllerTest::StopAnimating(TabStrip* tab_strip) { |
| 176 tab_strip->StopAnimating(true); | 174 tab_strip->StopAnimating(true); |
| 177 } | 175 } |
| 178 | 176 |
| 179 void TabDragControllerTest::AddTabAndResetBrowser(Browser* browser) { | 177 void TabDragControllerTest::AddTabAndResetBrowser(Browser* browser) { |
| 180 AddBlankTabAndShow(browser); | 178 AddBlankTabAndShow(browser); |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 if (input_source() == INPUT_SOURCE_MOUSE) { | 758 if (input_source() == INPUT_SOURCE_MOUSE) { |
| 761 ASSERT_TRUE(ReleaseMouseAsync()); | 759 ASSERT_TRUE(ReleaseMouseAsync()); |
| 762 QuitWhenNotDragging(); | 760 QuitWhenNotDragging(); |
| 763 } | 761 } |
| 764 | 762 |
| 765 // Should no longer be dragging. | 763 // Should no longer be dragging. |
| 766 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 764 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 767 ASSERT_FALSE(TabDragController::IsActive()); | 765 ASSERT_FALSE(TabDragController::IsActive()); |
| 768 | 766 |
| 769 // There should now be another browser. | 767 // There should now be another browser. |
| 770 ASSERT_EQ(2u, native_browser_list->size()); | 768 ASSERT_EQ(2u, browser_list->size()); |
| 771 Browser* new_browser = native_browser_list->get(1); | 769 Browser* new_browser = browser_list->get(1); |
| 772 ASSERT_TRUE(new_browser->window()->IsActive()); | 770 ASSERT_TRUE(new_browser->window()->IsActive()); |
| 773 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); | 771 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); |
| 774 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 772 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
| 775 | 773 |
| 776 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); | 774 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); |
| 777 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 775 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
| 778 | 776 |
| 779 // The bounds of the initial window should not have changed. | 777 // The bounds of the initial window should not have changed. |
| 780 EXPECT_EQ(initial_bounds.ToString(), | 778 EXPECT_EQ(initial_bounds.ToString(), |
| 781 browser()->window()->GetBounds().ToString()); | 779 browser()->window()->GetBounds().ToString()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 if (input_source() == INPUT_SOURCE_MOUSE) { | 826 if (input_source() == INPUT_SOURCE_MOUSE) { |
| 829 ASSERT_TRUE(ReleaseMouseAsync()); | 827 ASSERT_TRUE(ReleaseMouseAsync()); |
| 830 QuitWhenNotDragging(); | 828 QuitWhenNotDragging(); |
| 831 } | 829 } |
| 832 | 830 |
| 833 // Should no longer be dragging. | 831 // Should no longer be dragging. |
| 834 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 832 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 835 ASSERT_FALSE(TabDragController::IsActive()); | 833 ASSERT_FALSE(TabDragController::IsActive()); |
| 836 | 834 |
| 837 // There should now be another browser. | 835 // There should now be another browser. |
| 838 ASSERT_EQ(2u, native_browser_list->size()); | 836 ASSERT_EQ(2u, browser_list->size()); |
| 839 Browser* new_browser = native_browser_list->get(1); | 837 Browser* new_browser = browser_list->get(1); |
| 840 ASSERT_TRUE(new_browser->window()->IsActive()); | 838 ASSERT_TRUE(new_browser->window()->IsActive()); |
| 841 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); | 839 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); |
| 842 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 840 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
| 843 | 841 |
| 844 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); | 842 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); |
| 845 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 843 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
| 846 | 844 |
| 847 // The bounds of the initial window should not have changed. | 845 // The bounds of the initial window should not have changed. |
| 848 EXPECT_EQ(initial_bounds.ToString(), | 846 EXPECT_EQ(initial_bounds.ToString(), |
| 849 browser()->window()->GetBounds().ToString()); | 847 browser()->window()->GetBounds().ToString()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 if (input_source() == INPUT_SOURCE_MOUSE) { | 893 if (input_source() == INPUT_SOURCE_MOUSE) { |
| 896 ASSERT_TRUE(ReleaseMouseAsync()); | 894 ASSERT_TRUE(ReleaseMouseAsync()); |
| 897 QuitWhenNotDragging(); | 895 QuitWhenNotDragging(); |
| 898 } | 896 } |
| 899 | 897 |
| 900 // Should no longer be dragging. | 898 // Should no longer be dragging. |
| 901 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 899 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 902 ASSERT_FALSE(TabDragController::IsActive()); | 900 ASSERT_FALSE(TabDragController::IsActive()); |
| 903 | 901 |
| 904 // There should now be another browser. | 902 // There should now be another browser. |
| 905 ASSERT_EQ(2u, native_browser_list->size()); | 903 ASSERT_EQ(2u, browser_list->size()); |
| 906 Browser* new_browser = native_browser_list->get(1); | 904 Browser* new_browser = browser_list->get(1); |
| 907 ASSERT_TRUE(new_browser->window()->IsActive()); | 905 ASSERT_TRUE(new_browser->window()->IsActive()); |
| 908 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); | 906 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); |
| 909 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 907 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
| 910 | 908 |
| 911 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); | 909 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); |
| 912 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 910 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
| 913 | 911 |
| 914 // The bounds of the initial window should not have changed. | 912 // The bounds of the initial window should not have changed. |
| 915 EXPECT_TRUE(browser()->window()->IsMaximized()); | 913 EXPECT_TRUE(browser()->window()->IsMaximized()); |
| 916 | 914 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 // Add another tab. | 1064 // Add another tab. |
| 1067 AddTabAndResetBrowser(browser()); | 1065 AddTabAndResetBrowser(browser()); |
| 1068 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1066 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
| 1069 | 1067 |
| 1070 // Move to the first tab and drag it enough so that it detaches. | 1068 // Move to the first tab and drag it enough so that it detaches. |
| 1071 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1069 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 1072 WebContents* to_delete = browser()->tab_strip_model()->GetWebContentsAt(1); | 1070 WebContents* to_delete = browser()->tab_strip_model()->GetWebContentsAt(1); |
| 1073 ASSERT_TRUE(PressInput(tab_0_center)); | 1071 ASSERT_TRUE(PressInput(tab_0_center)); |
| 1074 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1072 ASSERT_TRUE(DragInputToNotifyWhenDone( |
| 1075 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1073 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 1076 base::Bind(&DeleteSourceDetachedStep2, to_delete, native_browser_list))); | 1074 base::Bind(&DeleteSourceDetachedStep2, to_delete, browser_list))); |
| 1077 QuitWhenNotDragging(); | 1075 QuitWhenNotDragging(); |
| 1078 | 1076 |
| 1079 // Should not be dragging. | 1077 // Should not be dragging. |
| 1080 ASSERT_EQ(1u, native_browser_list->size()); | 1078 ASSERT_EQ(1u, browser_list->size()); |
| 1081 Browser* new_browser = native_browser_list->get(0); | 1079 Browser* new_browser = browser_list->get(0); |
| 1082 ASSERT_FALSE(GetTabStripForBrowser(new_browser)->IsDragSessionActive()); | 1080 ASSERT_FALSE(GetTabStripForBrowser(new_browser)->IsDragSessionActive()); |
| 1083 ASSERT_FALSE(TabDragController::IsActive()); | 1081 ASSERT_FALSE(TabDragController::IsActive()); |
| 1084 | 1082 |
| 1085 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); | 1083 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); |
| 1086 | 1084 |
| 1087 EXPECT_FALSE(GetIsDragged(new_browser)); | 1085 EXPECT_FALSE(GetIsDragged(new_browser)); |
| 1088 | 1086 |
| 1089 // Remaining browser window should not be maximized | 1087 // Remaining browser window should not be maximized |
| 1090 EXPECT_FALSE(new_browser->window()->IsMaximized()); | 1088 EXPECT_FALSE(new_browser->window()->IsMaximized()); |
| 1091 } | 1089 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1115 MAYBE_PressEscapeWhileDetached) { | 1113 MAYBE_PressEscapeWhileDetached) { |
| 1116 // Add another tab. | 1114 // Add another tab. |
| 1117 AddTabAndResetBrowser(browser()); | 1115 AddTabAndResetBrowser(browser()); |
| 1118 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1116 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
| 1119 | 1117 |
| 1120 // Move to the first tab and drag it enough so that it detaches. | 1118 // Move to the first tab and drag it enough so that it detaches. |
| 1121 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1119 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 1122 ASSERT_TRUE(PressInput(tab_0_center)); | 1120 ASSERT_TRUE(PressInput(tab_0_center)); |
| 1123 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1121 ASSERT_TRUE(DragInputToNotifyWhenDone( |
| 1124 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1122 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 1125 base::Bind(&PressEscapeWhileDetachedStep2, native_browser_list))); | 1123 base::Bind(&PressEscapeWhileDetachedStep2, browser_list))); |
| 1126 QuitWhenNotDragging(); | 1124 QuitWhenNotDragging(); |
| 1127 | 1125 |
| 1128 // Should not be dragging. | 1126 // Should not be dragging. |
| 1129 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 1127 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 1130 ASSERT_FALSE(TabDragController::IsActive()); | 1128 ASSERT_FALSE(TabDragController::IsActive()); |
| 1131 | 1129 |
| 1132 // And there should only be one window. | 1130 // And there should only be one window. |
| 1133 EXPECT_EQ(1u, native_browser_list->size()); | 1131 EXPECT_EQ(1u, browser_list->size()); |
| 1134 | 1132 |
| 1135 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 1133 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
| 1136 | 1134 |
| 1137 // Remaining browser window should not be maximized | 1135 // Remaining browser window should not be maximized |
| 1138 EXPECT_FALSE(browser()->window()->IsMaximized()); | 1136 EXPECT_FALSE(browser()->window()->IsMaximized()); |
| 1139 | 1137 |
| 1140 // The tab strip should no longer have capture because the drag was ended and | 1138 // The tab strip should no longer have capture because the drag was ended and |
| 1141 // mouse/touch was released. | 1139 // mouse/touch was released. |
| 1142 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture()); | 1140 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture()); |
| 1143 } | 1141 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1171 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1169 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
| 1172 browser()->tab_strip_model()->AddTabAtToSelection(0); | 1170 browser()->tab_strip_model()->AddTabAtToSelection(0); |
| 1173 browser()->tab_strip_model()->AddTabAtToSelection(1); | 1171 browser()->tab_strip_model()->AddTabAtToSelection(1); |
| 1174 | 1172 |
| 1175 // Move to the first tab and drag it enough so that it would normally | 1173 // Move to the first tab and drag it enough so that it would normally |
| 1176 // detach. | 1174 // detach. |
| 1177 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1175 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 1178 ASSERT_TRUE(PressInput(tab_0_center)); | 1176 ASSERT_TRUE(PressInput(tab_0_center)); |
| 1179 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1177 ASSERT_TRUE(DragInputToNotifyWhenDone( |
| 1180 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1178 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 1181 base::Bind(&DragAllStep2, this, native_browser_list))); | 1179 base::Bind(&DragAllStep2, this, browser_list))); |
| 1182 QuitWhenNotDragging(); | 1180 QuitWhenNotDragging(); |
| 1183 | 1181 |
| 1184 // Should not be dragging. | 1182 // Should not be dragging. |
| 1185 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 1183 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 1186 ASSERT_FALSE(TabDragController::IsActive()); | 1184 ASSERT_FALSE(TabDragController::IsActive()); |
| 1187 | 1185 |
| 1188 // And there should only be one window. | 1186 // And there should only be one window. |
| 1189 EXPECT_EQ(1u, native_browser_list->size()); | 1187 EXPECT_EQ(1u, browser_list->size()); |
| 1190 | 1188 |
| 1191 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 1189 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
| 1192 | 1190 |
| 1193 EXPECT_FALSE(GetIsDragged(browser())); | 1191 EXPECT_FALSE(GetIsDragged(browser())); |
| 1194 | 1192 |
| 1195 // Remaining browser window should not be maximized | 1193 // Remaining browser window should not be maximized |
| 1196 EXPECT_FALSE(browser()->window()->IsMaximized()); | 1194 EXPECT_FALSE(browser()->window()->IsMaximized()); |
| 1197 } | 1195 } |
| 1198 | 1196 |
| 1199 namespace { | 1197 namespace { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 browser()->tab_strip_model()->AddTabAtToSelection(1); | 1239 browser()->tab_strip_model()->AddTabAtToSelection(1); |
| 1242 | 1240 |
| 1243 // Move to the first tab and drag it enough so that it detaches, but not | 1241 // Move to the first tab and drag it enough so that it detaches, but not |
| 1244 // enough that it attaches to browser2. | 1242 // enough that it attaches to browser2. |
| 1245 gfx::Point tab_0_center( | 1243 gfx::Point tab_0_center( |
| 1246 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1244 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 1247 ASSERT_TRUE(PressInput(tab_0_center)); | 1245 ASSERT_TRUE(PressInput(tab_0_center)); |
| 1248 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1246 ASSERT_TRUE(DragInputToNotifyWhenDone( |
| 1249 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1247 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 1250 base::Bind(&DragAllToSeparateWindowStep2, this, tab_strip, tab_strip2, | 1248 base::Bind(&DragAllToSeparateWindowStep2, this, tab_strip, tab_strip2, |
| 1251 native_browser_list))); | 1249 browser_list))); |
| 1252 QuitWhenNotDragging(); | 1250 QuitWhenNotDragging(); |
| 1253 | 1251 |
| 1254 // Should now be attached to tab_strip2. | 1252 // Should now be attached to tab_strip2. |
| 1255 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); | 1253 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); |
| 1256 ASSERT_TRUE(TabDragController::IsActive()); | 1254 ASSERT_TRUE(TabDragController::IsActive()); |
| 1257 ASSERT_EQ(1u, native_browser_list->size()); | 1255 ASSERT_EQ(1u, browser_list->size()); |
| 1258 | 1256 |
| 1259 // Release the mouse, stopping the drag session. | 1257 // Release the mouse, stopping the drag session. |
| 1260 ASSERT_TRUE(ReleaseInput()); | 1258 ASSERT_TRUE(ReleaseInput()); |
| 1261 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 1259 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
| 1262 ASSERT_FALSE(TabDragController::IsActive()); | 1260 ASSERT_FALSE(TabDragController::IsActive()); |
| 1263 EXPECT_EQ("100 0 1", IDString(browser2->tab_strip_model())); | 1261 EXPECT_EQ("100 0 1", IDString(browser2->tab_strip_model())); |
| 1264 | 1262 |
| 1265 EXPECT_FALSE(GetIsDragged(browser2)); | 1263 EXPECT_FALSE(GetIsDragged(browser2)); |
| 1266 | 1264 |
| 1267 // Remaining browser window should not be maximized | 1265 // Remaining browser window should not be maximized |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 browser()->tab_strip_model()->AddTabAtToSelection(1); | 1314 browser()->tab_strip_model()->AddTabAtToSelection(1); |
| 1317 | 1315 |
| 1318 // Move to the first tab and drag it enough so that it detaches, but not | 1316 // Move to the first tab and drag it enough so that it detaches, but not |
| 1319 // enough that it attaches to browser2. | 1317 // enough that it attaches to browser2. |
| 1320 gfx::Point tab_0_center( | 1318 gfx::Point tab_0_center( |
| 1321 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1319 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 1322 ASSERT_TRUE(PressInput(tab_0_center)); | 1320 ASSERT_TRUE(PressInput(tab_0_center)); |
| 1323 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1321 ASSERT_TRUE(DragInputToNotifyWhenDone( |
| 1324 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1322 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 1325 base::Bind(&DragAllToSeparateWindowAndCancelStep2, this, | 1323 base::Bind(&DragAllToSeparateWindowAndCancelStep2, this, |
| 1326 tab_strip, tab_strip2, native_browser_list))); | 1324 tab_strip, tab_strip2, browser_list))); |
| 1327 QuitWhenNotDragging(); | 1325 QuitWhenNotDragging(); |
| 1328 | 1326 |
| 1329 // Should now be attached to tab_strip2. | 1327 // Should now be attached to tab_strip2. |
| 1330 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); | 1328 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); |
| 1331 ASSERT_TRUE(TabDragController::IsActive()); | 1329 ASSERT_TRUE(TabDragController::IsActive()); |
| 1332 ASSERT_EQ(1u, native_browser_list->size()); | 1330 ASSERT_EQ(1u, browser_list->size()); |
| 1333 | 1331 |
| 1334 // Cancel the drag. | 1332 // Cancel the drag. |
| 1335 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 1333 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 1336 browser2, ui::VKEY_ESCAPE, false, false, false, false)); | 1334 browser2, ui::VKEY_ESCAPE, false, false, false, false)); |
| 1337 | 1335 |
| 1338 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 1336 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
| 1339 ASSERT_FALSE(TabDragController::IsActive()); | 1337 ASSERT_FALSE(TabDragController::IsActive()); |
| 1340 EXPECT_EQ("100 0 1", IDString(browser2->tab_strip_model())); | 1338 EXPECT_EQ("100 0 1", IDString(browser2->tab_strip_model())); |
| 1341 | 1339 |
| 1342 // browser() will have been destroyed, but browser2 should remain. | 1340 // browser() will have been destroyed, but browser2 should remain. |
| 1343 ASSERT_EQ(1u, native_browser_list->size()); | 1341 ASSERT_EQ(1u, browser_list->size()); |
| 1344 | 1342 |
| 1345 EXPECT_FALSE(GetIsDragged(browser2)); | 1343 EXPECT_FALSE(GetIsDragged(browser2)); |
| 1346 | 1344 |
| 1347 // Remaining browser window should not be maximized | 1345 // Remaining browser window should not be maximized |
| 1348 EXPECT_FALSE(browser2->window()->IsMaximized()); | 1346 EXPECT_FALSE(browser2->window()->IsMaximized()); |
| 1349 } | 1347 } |
| 1350 | 1348 |
| 1351 #if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_WIN) | 1349 #if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_WIN) |
| 1352 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 1350 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| 1353 // compositor. crbug.com/331924 | 1351 // compositor. crbug.com/331924 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 const gfx::Rect initial_bounds(browser2->window()->GetBounds()); | 1423 const gfx::Rect initial_bounds(browser2->window()->GetBounds()); |
| 1426 | 1424 |
| 1427 // Move to the first tab and drag it enough so that it detaches, but not | 1425 // Move to the first tab and drag it enough so that it detaches, but not |
| 1428 // enough that it attaches to browser2. | 1426 // enough that it attaches to browser2. |
| 1429 gfx::Point tab_0_center( | 1427 gfx::Point tab_0_center( |
| 1430 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1428 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 1431 ASSERT_TRUE(PressInput(tab_0_center)); | 1429 ASSERT_TRUE(PressInput(tab_0_center)); |
| 1432 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1430 ASSERT_TRUE(DragInputToNotifyWhenDone( |
| 1433 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1431 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 1434 base::Bind(&DragAllToSeparateWindowStep2, this, tab_strip, tab_strip2, | 1432 base::Bind(&DragAllToSeparateWindowStep2, this, tab_strip, tab_strip2, |
| 1435 native_browser_list))); | 1433 browser_list))); |
| 1436 QuitWhenNotDragging(); | 1434 QuitWhenNotDragging(); |
| 1437 | 1435 |
| 1438 // Should now be attached to tab_strip2. | 1436 // Should now be attached to tab_strip2. |
| 1439 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); | 1437 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); |
| 1440 ASSERT_TRUE(TabDragController::IsActive()); | 1438 ASSERT_TRUE(TabDragController::IsActive()); |
| 1441 ASSERT_EQ(1u, native_browser_list->size()); | 1439 ASSERT_EQ(1u, browser_list->size()); |
| 1442 | 1440 |
| 1443 // Release the mouse, stopping the drag session. | 1441 // Release the mouse, stopping the drag session. |
| 1444 ASSERT_TRUE(ReleaseInput()); | 1442 ASSERT_TRUE(ReleaseInput()); |
| 1445 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 1443 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
| 1446 ASSERT_FALSE(TabDragController::IsActive()); | 1444 ASSERT_FALSE(TabDragController::IsActive()); |
| 1447 EXPECT_EQ("100 0", IDString(browser2->tab_strip_model())); | 1445 EXPECT_EQ("100 0", IDString(browser2->tab_strip_model())); |
| 1448 | 1446 |
| 1449 EXPECT_FALSE(GetIsDragged(browser2)); | 1447 EXPECT_FALSE(GetIsDragged(browser2)); |
| 1450 | 1448 |
| 1451 // Remaining browser window should not be maximized | 1449 // Remaining browser window should not be maximized |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 | 1494 |
| 1497 // Add another tab to browser(). | 1495 // Add another tab to browser(). |
| 1498 AddTabAndResetBrowser(browser()); | 1496 AddTabAndResetBrowser(browser()); |
| 1499 | 1497 |
| 1500 // Move to the first tab and drag it enough so that it detaches. | 1498 // Move to the first tab and drag it enough so that it detaches. |
| 1501 gfx::Point tab_0_center( | 1499 gfx::Point tab_0_center( |
| 1502 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1500 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 1503 ASSERT_TRUE(PressInput(tab_0_center)); | 1501 ASSERT_TRUE(PressInput(tab_0_center)); |
| 1504 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1502 ASSERT_TRUE(DragInputToNotifyWhenDone( |
| 1505 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1503 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 1506 base::Bind(&CancelOnNewTabWhenDraggingStep2, this, native_browser_list))); | 1504 base::Bind(&CancelOnNewTabWhenDraggingStep2, this, browser_list))); |
| 1507 QuitWhenNotDragging(); | 1505 QuitWhenNotDragging(); |
| 1508 | 1506 |
| 1509 // Should be two windows and not dragging. | 1507 // Should be two windows and not dragging. |
| 1510 ASSERT_FALSE(TabDragController::IsActive()); | 1508 ASSERT_FALSE(TabDragController::IsActive()); |
| 1511 ASSERT_EQ(2u, native_browser_list->size()); | 1509 ASSERT_EQ(2u, browser_list->size()); |
| 1512 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 1510 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 1513 EXPECT_FALSE(GetIsDragged(*it)); | 1511 EXPECT_FALSE(GetIsDragged(*it)); |
| 1514 // Should not be maximized | 1512 // Should not be maximized |
| 1515 EXPECT_FALSE(it->window()->IsMaximized()); | 1513 EXPECT_FALSE(it->window()->IsMaximized()); |
| 1516 } | 1514 } |
| 1517 } | 1515 } |
| 1518 | 1516 |
| 1519 #if defined(OS_CHROMEOS) | 1517 #if defined(OS_CHROMEOS) |
| 1520 // TODO(sky,sad): A number of tests below are disabled as they fail due to | 1518 // TODO(sky,sad): A number of tests below are disabled as they fail due to |
| 1521 // resize locks with a real compositor. crbug.com/331924 | 1519 // resize locks with a real compositor. crbug.com/331924 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 | 1551 |
| 1554 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1552 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
| 1555 | 1553 |
| 1556 // Move to the first tab and drag it enough so that it detaches. | 1554 // Move to the first tab and drag it enough so that it detaches. |
| 1557 gfx::Point tab_0_center( | 1555 gfx::Point tab_0_center( |
| 1558 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1556 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 1559 ASSERT_TRUE(PressInput(tab_0_center)); | 1557 ASSERT_TRUE(PressInput(tab_0_center)); |
| 1560 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1558 ASSERT_TRUE(DragInputToNotifyWhenDone( |
| 1561 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1559 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 1562 base::Bind(&DragInMaximizedWindowStep2, this, browser(), tab_strip, | 1560 base::Bind(&DragInMaximizedWindowStep2, this, browser(), tab_strip, |
| 1563 native_browser_list))); | 1561 browser_list))); |
| 1564 QuitWhenNotDragging(); | 1562 QuitWhenNotDragging(); |
| 1565 | 1563 |
| 1566 ASSERT_FALSE(TabDragController::IsActive()); | 1564 ASSERT_FALSE(TabDragController::IsActive()); |
| 1567 | 1565 |
| 1568 // Should be two browsers. | 1566 // Should be two browsers. |
| 1569 ASSERT_EQ(2u, native_browser_list->size()); | 1567 ASSERT_EQ(2u, browser_list->size()); |
| 1570 Browser* new_browser = native_browser_list->get(1); | 1568 Browser* new_browser = browser_list->get(1); |
| 1571 ASSERT_TRUE(new_browser->window()->IsActive()); | 1569 ASSERT_TRUE(new_browser->window()->IsActive()); |
| 1572 | 1570 |
| 1573 EXPECT_TRUE(browser()->window()->GetNativeWindow()->IsVisible()); | 1571 EXPECT_TRUE(browser()->window()->GetNativeWindow()->IsVisible()); |
| 1574 EXPECT_TRUE(new_browser->window()->GetNativeWindow()->IsVisible()); | 1572 EXPECT_TRUE(new_browser->window()->GetNativeWindow()->IsVisible()); |
| 1575 | 1573 |
| 1576 EXPECT_FALSE(GetIsDragged(browser())); | 1574 EXPECT_FALSE(GetIsDragged(browser())); |
| 1577 EXPECT_FALSE(GetIsDragged(new_browser)); | 1575 EXPECT_FALSE(GetIsDragged(new_browser)); |
| 1578 | 1576 |
| 1579 // The source window should be maximized. | 1577 // The source window should be maximized. |
| 1580 EXPECT_TRUE(browser()->window()->IsMaximized()); | 1578 EXPECT_TRUE(browser()->window()->IsMaximized()); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 this, gfx::Point(600 + tab_0_center.x(), | 1646 this, gfx::Point(600 + tab_0_center.x(), |
| 1649 tab_0_center.y() | 1647 tab_0_center.y() |
| 1650 + GetDetachY(tab_strip))))); | 1648 + GetDetachY(tab_strip))))); |
| 1651 QuitWhenNotDragging(); | 1649 QuitWhenNotDragging(); |
| 1652 | 1650 |
| 1653 // Should no longer be dragging. | 1651 // Should no longer be dragging. |
| 1654 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 1652 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 1655 ASSERT_FALSE(TabDragController::IsActive()); | 1653 ASSERT_FALSE(TabDragController::IsActive()); |
| 1656 | 1654 |
| 1657 // There should now be another browser. | 1655 // There should now be another browser. |
| 1658 ASSERT_EQ(2u, native_browser_list->size()); | 1656 ASSERT_EQ(2u, browser_list->size()); |
| 1659 Browser* new_browser = native_browser_list->get(1); | 1657 Browser* new_browser = browser_list->get(1); |
| 1660 ASSERT_TRUE(new_browser->window()->IsActive()); | 1658 ASSERT_TRUE(new_browser->window()->IsActive()); |
| 1661 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); | 1659 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); |
| 1662 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 1660 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
| 1663 | 1661 |
| 1664 // This other browser should be on the second screen (with mouse drag) | 1662 // This other browser should be on the second screen (with mouse drag) |
| 1665 // With the touch input the browser cannot be dragged from one screen | 1663 // With the touch input the browser cannot be dragged from one screen |
| 1666 // to another and the window stays on the first screen. | 1664 // to another and the window stays on the first screen. |
| 1667 if (input_source() == INPUT_SOURCE_MOUSE) { | 1665 if (input_source() == INPUT_SOURCE_MOUSE) { |
| 1668 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); | 1666 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); |
| 1669 ASSERT_EQ(2u, roots.size()); | 1667 ASSERT_EQ(2u, roots.size()); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 .CenterPoint(); | 2154 .CenterPoint(); |
| 2157 | 2155 |
| 2158 // Move to the first tab and drag it enough so that it detaches, but not | 2156 // Move to the first tab and drag it enough so that it detaches, but not |
| 2159 // enough to move to another display. | 2157 // enough to move to another display. |
| 2160 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 2158 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 2161 ASSERT_TRUE(Press(tab_0_dst)); | 2159 ASSERT_TRUE(Press(tab_0_dst)); |
| 2162 tab_0_dst.Offset(0, GetDetachY(tab_strip)); | 2160 tab_0_dst.Offset(0, GetDetachY(tab_strip)); |
| 2163 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( | 2161 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( |
| 2164 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, | 2162 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, |
| 2165 this, tab_strip, roots[0], final_destination, | 2163 this, tab_strip, roots[0], final_destination, |
| 2166 native_browser_list))); | 2164 browser_list))); |
| 2167 QuitWhenNotDragging(); | 2165 QuitWhenNotDragging(); |
| 2168 | 2166 |
| 2169 ASSERT_EQ(1u, native_browser_list->size()); | 2167 ASSERT_EQ(1u, browser_list->size()); |
| 2170 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 2168 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 2171 ASSERT_FALSE(TabDragController::IsActive()); | 2169 ASSERT_FALSE(TabDragController::IsActive()); |
| 2172 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 2170 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
| 2173 | 2171 |
| 2174 // Release the mouse | 2172 // Release the mouse |
| 2175 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( | 2173 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( |
| 2176 ui_controls::LEFT, ui_controls::UP)); | 2174 ui_controls::LEFT, ui_controls::UP)); |
| 2177 } | 2175 } |
| 2178 | 2176 |
| 2179 // Drags from browser from a second display to primary and releases input. | 2177 // Drags from browser from a second display to primary and releases input. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2202 .CenterPoint(); | 2200 .CenterPoint(); |
| 2203 | 2201 |
| 2204 // Move to the first tab and drag it enough so that it detaches, but not | 2202 // Move to the first tab and drag it enough so that it detaches, but not |
| 2205 // enough to move to another display. | 2203 // enough to move to another display. |
| 2206 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 2204 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 2207 ASSERT_TRUE(Press(tab_0_dst)); | 2205 ASSERT_TRUE(Press(tab_0_dst)); |
| 2208 tab_0_dst.Offset(0, GetDetachY(tab_strip)); | 2206 tab_0_dst.Offset(0, GetDetachY(tab_strip)); |
| 2209 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( | 2207 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( |
| 2210 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, | 2208 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, |
| 2211 this, tab_strip, roots[1], final_destination, | 2209 this, tab_strip, roots[1], final_destination, |
| 2212 native_browser_list))); | 2210 browser_list))); |
| 2213 QuitWhenNotDragging(); | 2211 QuitWhenNotDragging(); |
| 2214 | 2212 |
| 2215 ASSERT_EQ(1u, native_browser_list->size()); | 2213 ASSERT_EQ(1u, browser_list->size()); |
| 2216 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 2214 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 2217 ASSERT_FALSE(TabDragController::IsActive()); | 2215 ASSERT_FALSE(TabDragController::IsActive()); |
| 2218 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 2216 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
| 2219 | 2217 |
| 2220 // Release the mouse | 2218 // Release the mouse |
| 2221 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( | 2219 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( |
| 2222 ui_controls::LEFT, ui_controls::UP)); | 2220 ui_controls::LEFT, ui_controls::UP)); |
| 2223 } | 2221 } |
| 2224 | 2222 |
| 2225 namespace { | 2223 namespace { |
| 2226 | 2224 |
| 2227 void PressSecondFingerWhileDetachedStep2( | 2225 void PressSecondFingerWhileDetachedStep2( |
| 2228 DetachToBrowserTabDragControllerTest* test) { | 2226 DetachToBrowserTabDragControllerTest* test) { |
| 2229 ASSERT_TRUE(TabDragController::IsActive()); | 2227 ASSERT_TRUE(TabDragController::IsActive()); |
| 2230 ASSERT_EQ(2u, test->native_browser_list->size()); | 2228 ASSERT_EQ(2u, test->browser_list->size()); |
| 2231 Browser* new_browser = test->native_browser_list->get(1); | 2229 Browser* new_browser = test->browser_list->get(1); |
| 2232 ASSERT_TRUE(new_browser->window()->IsActive()); | 2230 ASSERT_TRUE(new_browser->window()->IsActive()); |
| 2233 | 2231 |
| 2234 ASSERT_TRUE(test->PressInput2()); | 2232 ASSERT_TRUE(test->PressInput2()); |
| 2235 } | 2233 } |
| 2236 | 2234 |
| 2237 } // namespace | 2235 } // namespace |
| 2238 | 2236 |
| 2239 // Detaches a tab and while detached presses a second finger. | 2237 // Detaches a tab and while detached presses a second finger. |
| 2240 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch, | 2238 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch, |
| 2241 DISABLED_PressSecondFingerWhileDetached) { | 2239 DISABLED_PressSecondFingerWhileDetached) { |
| 2242 gfx::Rect bounds(browser()->window()->GetBounds()); | 2240 gfx::Rect bounds(browser()->window()->GetBounds()); |
| 2243 // Add another tab. | 2241 // Add another tab. |
| 2244 AddTabAndResetBrowser(browser()); | 2242 AddTabAndResetBrowser(browser()); |
| 2245 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 2243 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
| 2246 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 2244 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
| 2247 | 2245 |
| 2248 // Move to the first tab and drag it enough so that it detaches. | 2246 // Move to the first tab and drag it enough so that it detaches. |
| 2249 gfx::Point tab_0_center( | 2247 gfx::Point tab_0_center( |
| 2250 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 2248 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| 2251 ASSERT_TRUE(PressInput(tab_0_center)); | 2249 ASSERT_TRUE(PressInput(tab_0_center)); |
| 2252 ASSERT_TRUE(DragInputToDelayedNotifyWhenDone( | 2250 ASSERT_TRUE(DragInputToDelayedNotifyWhenDone( |
| 2253 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 2251 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| 2254 base::Bind(&PressSecondFingerWhileDetachedStep2, this), | 2252 base::Bind(&PressSecondFingerWhileDetachedStep2, this), |
| 2255 base::TimeDelta::FromMilliseconds(60))); | 2253 base::TimeDelta::FromMilliseconds(60))); |
| 2256 QuitWhenNotDragging(); | 2254 QuitWhenNotDragging(); |
| 2257 | 2255 |
| 2258 // The drag should have been reverted. | 2256 // The drag should have been reverted. |
| 2259 ASSERT_EQ(1u, native_browser_list->size()); | 2257 ASSERT_EQ(1u, browser_list->size()); |
| 2260 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 2258 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 2261 ASSERT_FALSE(TabDragController::IsActive()); | 2259 ASSERT_FALSE(TabDragController::IsActive()); |
| 2262 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 2260 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
| 2263 | 2261 |
| 2264 ASSERT_TRUE(ReleaseInput()); | 2262 ASSERT_TRUE(ReleaseInput()); |
| 2265 ASSERT_TRUE(ReleaseInput2()); | 2263 ASSERT_TRUE(ReleaseInput2()); |
| 2266 } | 2264 } |
| 2267 | 2265 |
| 2268 #if defined(OS_CHROMEOS) | 2266 #if defined(OS_CHROMEOS) |
| 2269 | 2267 |
| 2270 namespace { | 2268 namespace { |
| 2271 | 2269 |
| 2272 void DetachToDockedWindowNextStep( | 2270 void DetachToDockedWindowNextStep( |
| 2273 DetachToBrowserTabDragControllerTest* test, | 2271 DetachToBrowserTabDragControllerTest* test, |
| 2274 const gfx::Point& target_point, | 2272 const gfx::Point& target_point, |
| 2275 int iteration) { | 2273 int iteration) { |
| 2276 ASSERT_EQ(2u, test->native_browser_list->size()); | 2274 ASSERT_EQ(2u, test->browser_list->size()); |
| 2277 Browser* new_browser = test->native_browser_list->get(1); | 2275 Browser* new_browser = test->browser_list->get(1); |
| 2278 ASSERT_TRUE(new_browser->window()->IsActive()); | 2276 ASSERT_TRUE(new_browser->window()->IsActive()); |
| 2279 | 2277 |
| 2280 if (!iteration) { | 2278 if (!iteration) { |
| 2281 ASSERT_TRUE(test->ReleaseInput()); | 2279 ASSERT_TRUE(test->ReleaseInput()); |
| 2282 return; | 2280 return; |
| 2283 } | 2281 } |
| 2284 ASSERT_TRUE(test->DragInputToNotifyWhenDone( | 2282 ASSERT_TRUE(test->DragInputToNotifyWhenDone( |
| 2285 target_point.x(), target_point.y(), | 2283 target_point.x(), target_point.y(), |
| 2286 base::Bind(&DetachToDockedWindowNextStep, | 2284 base::Bind(&DetachToDockedWindowNextStep, |
| 2287 test, | 2285 test, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2315 gfx::Point(0, tab_0_center.y() + GetDetachY(tab_strip)), | 2313 gfx::Point(0, tab_0_center.y() + GetDetachY(tab_strip)), |
| 2316 kNumIterations))); | 2314 kNumIterations))); |
| 2317 // Continue dragging enough times to go through snapping sequence and dock | 2315 // Continue dragging enough times to go through snapping sequence and dock |
| 2318 // the window. | 2316 // the window. |
| 2319 QuitWhenNotDragging(); | 2317 QuitWhenNotDragging(); |
| 2320 // Should no longer be dragging. | 2318 // Should no longer be dragging. |
| 2321 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 2319 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| 2322 ASSERT_FALSE(TabDragController::IsActive()); | 2320 ASSERT_FALSE(TabDragController::IsActive()); |
| 2323 | 2321 |
| 2324 // There should now be another browser. | 2322 // There should now be another browser. |
| 2325 ASSERT_EQ(2u, native_browser_list->size()); | 2323 ASSERT_EQ(2u, browser_list->size()); |
| 2326 Browser* new_browser = native_browser_list->get(1); | 2324 Browser* new_browser = browser_list->get(1); |
| 2327 ASSERT_TRUE(new_browser->window()->IsActive()); | 2325 ASSERT_TRUE(new_browser->window()->IsActive()); |
| 2328 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); | 2326 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); |
| 2329 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 2327 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
| 2330 | 2328 |
| 2331 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); | 2329 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); |
| 2332 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 2330 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
| 2333 | 2331 |
| 2334 // The bounds of the initial window should not have changed. | 2332 // The bounds of the initial window should not have changed. |
| 2335 EXPECT_TRUE(browser()->window()->IsMaximized()); | 2333 EXPECT_TRUE(browser()->window()->IsMaximized()); |
| 2336 | 2334 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2365 DetachToBrowserTabDragControllerTest, | 2363 DetachToBrowserTabDragControllerTest, |
| 2366 ::testing::Values("mouse", "touch")); | 2364 ::testing::Values("mouse", "touch")); |
| 2367 INSTANTIATE_TEST_CASE_P(TabDragging, | 2365 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2368 DetachToBrowserTabDragControllerTestTouch, | 2366 DetachToBrowserTabDragControllerTestTouch, |
| 2369 ::testing::Values("touch")); | 2367 ::testing::Values("touch")); |
| 2370 #elif defined(USE_ASH) | 2368 #elif defined(USE_ASH) |
| 2371 INSTANTIATE_TEST_CASE_P(TabDragging, | 2369 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2372 DetachToBrowserTabDragControllerTest, | 2370 DetachToBrowserTabDragControllerTest, |
| 2373 ::testing::Values("mouse")); | 2371 ::testing::Values("mouse")); |
| 2374 #endif | 2372 #endif |
| OLD | NEW |