diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-28 16:56:26 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-28 16:56:26 +0000 |
commit | 05adeba6452d76ab39c0c407660df9ec4291e0f7 (patch) | |
tree | 6bb30f7112a4ccb4e3dd47f8b9f7e4a789f4ba3b /chrome/browser/ui | |
parent | ed1ca9f5cf1855e44c706de33091ad467716792e (diff) | |
download | chromium_src-05adeba6452d76ab39c0c407660df9ec4291e0f7.zip chromium_src-05adeba6452d76ab39c0c407660df9ec4291e0f7.tar.gz chromium_src-05adeba6452d76ab39c0c407660df9ec4291e0f7.tar.bz2 |
Fixes dragging a tab out of a mazimixed window. We needed to honor the
'tracked by workspace' property. I added test coverage of this too.
BUG=151218
TEST=covered by tests now, but see bug for repro steps.
R=ben@chromium.org
Review URL: https://codereview.chromium.org/10993071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r-- | chrome/browser/ui/views/tabs/tab_drag_controller.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc | 54 |
2 files changed, 57 insertions, 0 deletions
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc index 3f50828..7458b11 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc @@ -1953,6 +1953,9 @@ Browser* TabDragController::CreateBrowserForDrag( create_params.initial_bounds = new_bounds; Browser* browser = new Browser(create_params); SetTrackedByWorkspace(browser->window()->GetNativeWindow(), false); + // If the window is created maximized then the bounds we supplied are ignored. + // We need to reset them again so they are honored. + browser->window()->SetBounds(new_bounds); return browser; } diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc index 0677143..11d183b 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc @@ -843,6 +843,60 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, #if defined(USE_ASH) +namespace { + +void DragInMaximizedWindowStep2(DetachToBrowserTabDragControllerTest* test, + Browser* browser, + TabStrip* tab_strip) { + // There should be another browser. + ASSERT_EQ(2u, BrowserList::size()); + Browser* new_browser = *(++BrowserList::begin()); + EXPECT_NE(browser, new_browser); + ASSERT_TRUE(new_browser->window()->IsActive()); + TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); + + ASSERT_TRUE(tab_strip2->IsDragSessionActive()); + ASSERT_FALSE(tab_strip->IsDragSessionActive()); + + // Both windows should be visible. + EXPECT_TRUE(tab_strip->GetWidget()->IsVisible()); + EXPECT_TRUE(tab_strip2->GetWidget()->IsVisible()); + + // Stops dragging. + ASSERT_TRUE(test->ReleaseInput()); +} + +} // namespace + +// Creates a browser with two tabs, maximizes it, drags the tab out. +IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, + DragInMaximizedWindow) { + AddTabAndResetBrowser(browser()); + browser()->window()->Maximize(); + + TabStrip* tab_strip = GetTabStripForBrowser(browser()); + + // Move to the first tab and drag it enough so that it detaches. + gfx::Point tab_0_center( + GetCenterInScreenCoordinates(tab_strip->tab_at(0))); + ASSERT_TRUE(PressInput(tab_0_center)); + ASSERT_TRUE(DragInputToNotifyWhenDone( + tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), + base::Bind(&DragInMaximizedWindowStep2, this, browser(), tab_strip))); + QuitWhenNotDragging(); + + ASSERT_FALSE(TabDragController::IsActive()); + + // Should be two browsers. + ASSERT_EQ(2u, BrowserList::size()); + Browser* new_browser = *(++BrowserList::begin()); + ASSERT_TRUE(new_browser->window()->IsActive()); + + // Only the new browser should be visible. + EXPECT_FALSE(browser()->window()->GetNativeWindow()->IsVisible()); + EXPECT_TRUE(new_browser->window()->GetNativeWindow()->IsVisible()); +} + // Subclass of DetachToBrowserInSeparateDisplayTabDragControllerTest that // creates multiple displays. class DetachToBrowserInSeparateDisplayTabDragControllerTest |