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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/property_bag.h" | 10 #include "base/property_bag.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ui_controls::LEFT, ui_controls::UP)); | 58 ui_controls::LEFT, ui_controls::UP)); |
59 EXPECT_EQ("1 0", IDString(model)); | 59 EXPECT_EQ("1 0", IDString(model)); |
60 EXPECT_FALSE(TabDragController::IsActive()); | 60 EXPECT_FALSE(TabDragController::IsActive()); |
61 EXPECT_FALSE(tab_strip->IsDragSessionActive()); | 61 EXPECT_FALSE(tab_strip->IsDragSessionActive()); |
62 } | 62 } |
63 | 63 |
64 // Creates two browsers, drags from first into second. | 64 // Creates two browsers, drags from first into second. |
65 IN_PROC_BROWSER_TEST_F(TabDragControllerTest, DragToSeparateWindow) { | 65 IN_PROC_BROWSER_TEST_F(TabDragControllerTest, DragToSeparateWindow) { |
66 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 66 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
67 | 67 |
| 68 // Add another tab to browser(). |
| 69 AddTabAndResetBrowser(browser()); |
| 70 |
68 // Create another browser. | 71 // Create another browser. |
69 Browser* browser2 = CreateAnotherWindowBrowserAndRelayout(); | 72 Browser* browser2 = CreateAnotherWindowBrowserAndRelayout(); |
70 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); | 73 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); |
71 | 74 |
72 // Move to the first tab and drag it enough so that it detaches, but not | 75 // Move to the first tab and drag it enough so that it detaches, but not |
73 // enough that it attaches to browser2. | 76 // enough that it attaches to browser2. |
74 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 77 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
75 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(tab_0_center)); | 78 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(tab_0_center)); |
76 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( | 79 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( |
77 ui_controls::LEFT, ui_controls::DOWN)); | 80 ui_controls::LEFT, ui_controls::DOWN)); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 ASSERT_FALSE(GetTabStripForBrowser(new_browser)->IsDragSessionActive()); | 258 ASSERT_FALSE(GetTabStripForBrowser(new_browser)->IsDragSessionActive()); |
256 ASSERT_FALSE(TabDragController::IsActive()); | 259 ASSERT_FALSE(TabDragController::IsActive()); |
257 | 260 |
258 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); | 261 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); |
259 } | 262 } |
260 | 263 |
261 // Creates two browsers, selects all tabs in first and drags into second. | 264 // Creates two browsers, selects all tabs in first and drags into second. |
262 IN_PROC_BROWSER_TEST_F(TabDragControllerTest, DragAllToSeparateWindow) { | 265 IN_PROC_BROWSER_TEST_F(TabDragControllerTest, DragAllToSeparateWindow) { |
263 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 266 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
264 | 267 |
| 268 // Add another tab to browser(). |
| 269 AddTabAndResetBrowser(browser()); |
| 270 |
265 // Create another browser. | 271 // Create another browser. |
266 Browser* browser2 = CreateAnotherWindowBrowserAndRelayout(); | 272 Browser* browser2 = CreateAnotherWindowBrowserAndRelayout(); |
267 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); | 273 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); |
268 | 274 |
269 browser()->tab_strip_model()->AddTabAtToSelection(0); | 275 browser()->tab_strip_model()->AddTabAtToSelection(0); |
270 browser()->tab_strip_model()->AddTabAtToSelection(1); | 276 browser()->tab_strip_model()->AddTabAtToSelection(1); |
271 | 277 |
272 // Move to the first tab and drag it enough so that it detaches, but not | 278 // Move to the first tab and drag it enough so that it detaches, but not |
273 // enough that it attaches to browser2. | 279 // enough that it attaches to browser2. |
274 gfx::Point tab_0_center( | 280 gfx::Point tab_0_center( |
(...skipping 26 matching lines...) Expand all Loading... |
301 ASSERT_FALSE(TabDragController::IsActive()); | 307 ASSERT_FALSE(TabDragController::IsActive()); |
302 EXPECT_EQ("100 0 1", IDString(browser2->tab_strip_model())); | 308 EXPECT_EQ("100 0 1", IDString(browser2->tab_strip_model())); |
303 } | 309 } |
304 | 310 |
305 // Creates two browsers, selects all tabs in first, drags into second, then hits | 311 // Creates two browsers, selects all tabs in first, drags into second, then hits |
306 // escape. | 312 // escape. |
307 IN_PROC_BROWSER_TEST_F(TabDragControllerTest, | 313 IN_PROC_BROWSER_TEST_F(TabDragControllerTest, |
308 DragAllToSeparateWindowAndCancel) { | 314 DragAllToSeparateWindowAndCancel) { |
309 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 315 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
310 | 316 |
| 317 // Add another tab to browser(). |
| 318 AddTabAndResetBrowser(browser()); |
| 319 |
311 // Create another browser. | 320 // Create another browser. |
312 Browser* browser2 = CreateAnotherWindowBrowserAndRelayout(); | 321 Browser* browser2 = CreateAnotherWindowBrowserAndRelayout(); |
313 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); | 322 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); |
314 | 323 |
315 browser()->tab_strip_model()->AddTabAtToSelection(0); | 324 browser()->tab_strip_model()->AddTabAtToSelection(0); |
316 browser()->tab_strip_model()->AddTabAtToSelection(1); | 325 browser()->tab_strip_model()->AddTabAtToSelection(1); |
317 | 326 |
318 // Move to the first tab and drag it enough so that it detaches, but not | 327 // Move to the first tab and drag it enough so that it detaches, but not |
319 // enough that it attaches to browser2. | 328 // enough that it attaches to browser2. |
320 gfx::Point tab_0_center( | 329 gfx::Point tab_0_center( |
(...skipping 23 matching lines...) Expand all Loading... |
344 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 353 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
345 browser2, ui::VKEY_ESCAPE, false, false, false, false)); | 354 browser2, ui::VKEY_ESCAPE, false, false, false, false)); |
346 | 355 |
347 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 356 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
348 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 357 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
349 ASSERT_FALSE(TabDragController::IsActive()); | 358 ASSERT_FALSE(TabDragController::IsActive()); |
350 ASSERT_EQ(2u, BrowserList::size()); | 359 ASSERT_EQ(2u, BrowserList::size()); |
351 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 360 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
352 EXPECT_EQ("100", IDString(browser2->tab_strip_model())); | 361 EXPECT_EQ("100", IDString(browser2->tab_strip_model())); |
353 } | 362 } |
OLD | NEW |