Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc

Issue 10986029: Attempt 3 at: Makes tab dragging code set bounds before creating window, that way (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) { 378 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) {
379 if (test->input_source() == INPUT_SOURCE_TOUCH) 379 if (test->input_source() == INPUT_SOURCE_TOUCH)
380 ASSERT_TRUE(test->ReleaseInput()); 380 ASSERT_TRUE(test->ReleaseInput());
381 } 381 }
382 382
383 } // namespace 383 } // namespace
384 384
385 // Drags from browser to separate window and releases mouse. 385 // Drags from browser to separate window and releases mouse.
386 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 386 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
387 DetachToOwnWindow) { 387 DetachToOwnWindow) {
388 const gfx::Rect initial_bounds(browser()->window()->GetBounds());
388 // Add another tab. 389 // Add another tab.
389 AddTabAndResetBrowser(browser()); 390 AddTabAndResetBrowser(browser());
390 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 391 TabStrip* tab_strip = GetTabStripForBrowser(browser());
391 392
392 // Move to the first tab and drag it enough so that it detaches. 393 // Move to the first tab and drag it enough so that it detaches.
393 gfx::Point tab_0_center( 394 gfx::Point tab_0_center(
394 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 395 GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
395 ASSERT_TRUE(PressInput(tab_0_center)); 396 ASSERT_TRUE(PressInput(tab_0_center));
396 ASSERT_TRUE(DragInputToNotifyWhenDone( 397 ASSERT_TRUE(DragInputToNotifyWhenDone(
397 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), 398 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip),
398 base::Bind(&DetachToOwnWindowStep2, this))); 399 base::Bind(&DetachToOwnWindowStep2, this)));
399 if (input_source() == INPUT_SOURCE_MOUSE) { 400 if (input_source() == INPUT_SOURCE_MOUSE) {
400 ASSERT_TRUE(ReleaseMouseAsync()); 401 ASSERT_TRUE(ReleaseMouseAsync());
401 QuitWhenNotDragging(); 402 QuitWhenNotDragging();
402 } 403 }
403 404
404 // Should no longer be dragging. 405 // Should no longer be dragging.
405 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 406 ASSERT_FALSE(tab_strip->IsDragSessionActive());
406 ASSERT_FALSE(TabDragController::IsActive()); 407 ASSERT_FALSE(TabDragController::IsActive());
407 408
408 // There should now be another browser. 409 // There should now be another browser.
409 ASSERT_EQ(2u, BrowserList::size()); 410 ASSERT_EQ(2u, BrowserList::size());
410 Browser* new_browser = *(++BrowserList::begin()); 411 Browser* new_browser = *(++BrowserList::begin());
411 ASSERT_TRUE(new_browser->window()->IsActive()); 412 ASSERT_TRUE(new_browser->window()->IsActive());
412 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); 413 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser);
413 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); 414 ASSERT_FALSE(tab_strip2->IsDragSessionActive());
414 415
415 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); 416 EXPECT_EQ("0", IDString(new_browser->tab_strip_model()));
416 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 417 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
418
419 // The bounds of the initial window should not have changed.
420 EXPECT_EQ(initial_bounds.ToString(),
421 browser()->window()->GetBounds().ToString());
417 } 422 }
418 423
419 // Deletes a tab being dragged before the user moved enough to start a drag. 424 // Deletes a tab being dragged before the user moved enough to start a drag.
420 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 425 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
421 DeleteBeforeStartedDragging) { 426 DeleteBeforeStartedDragging) {
422 // Add another tab. 427 // Add another tab.
423 AddTabAndResetBrowser(browser()); 428 AddTabAndResetBrowser(browser());
424 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 429 TabStrip* tab_strip = GetTabStripForBrowser(browser());
425 430
426 // Click on the first tab, but don't move it. 431 // Click on the first tab, but don't move it.
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 DetachToBrowserInSeparateDisplayTabDragControllerTest, 1133 DetachToBrowserInSeparateDisplayTabDragControllerTest,
1129 ::testing::Values("mouse", "touch")); 1134 ::testing::Values("mouse", "touch"));
1130 INSTANTIATE_TEST_CASE_P(TabDragging, 1135 INSTANTIATE_TEST_CASE_P(TabDragging,
1131 DetachToBrowserTabDragControllerTest, 1136 DetachToBrowserTabDragControllerTest,
1132 ::testing::Values("mouse", "touch")); 1137 ::testing::Values("mouse", "touch"));
1133 #else 1138 #else
1134 INSTANTIATE_TEST_CASE_P(TabDragging, 1139 INSTANTIATE_TEST_CASE_P(TabDragging,
1135 DetachToBrowserTabDragControllerTest, 1140 DetachToBrowserTabDragControllerTest,
1136 ::testing::Values("mouse")); 1141 ::testing::Values("mouse"));
1137 #endif 1142 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698