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

Unified Diff: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc

Issue 1156893008: Fixes tab dragging out of a window with maximzied bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes tab dragging out of a window with maximzied bounds (nits) Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
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 f69b34ce59f61be754a45380facf242d84e7c99a..2790730d2868e73884c11c35c42367615388b730 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
@@ -795,6 +795,74 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
#if defined(OS_CHROMEOS) || defined(OS_LINUX)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
+#define MAYBE_DetachFromFullsizeWindow DISABLED_DetachFromFullsizeWindow
+#else
+#define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow
+#endif
+// Tests that a tab can be dragged from a browser window that is resized to full
+// screen.
+IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
+ MAYBE_DetachFromFullsizeWindow) {
+ // Resize the browser window so that it is as big as the work area.
+ gfx::Rect work_area =
+ gfx::Screen::GetNativeScreen()
+ ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow())
+ .work_area();
+ browser()->window()->SetBounds(work_area);
+ const gfx::Rect initial_bounds(browser()->window()->GetBounds());
+ // Add another tab.
+ AddTabAndResetBrowser(browser());
+ 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(&DetachToOwnWindowStep2, this)));
+ if (input_source() == INPUT_SOURCE_MOUSE) {
+ ASSERT_TRUE(ReleaseMouseAsync());
+ QuitWhenNotDragging();
+ }
+
+ // Should no longer be dragging.
+ ASSERT_FALSE(tab_strip->IsDragSessionActive());
+ ASSERT_FALSE(TabDragController::IsActive());
+
+ // There should now be another browser.
+ ASSERT_EQ(2u, native_browser_list->size());
+ Browser* new_browser = native_browser_list->get(1);
+ ASSERT_TRUE(new_browser->window()->IsActive());
+ TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser);
+ ASSERT_FALSE(tab_strip2->IsDragSessionActive());
+
+ EXPECT_EQ("0", IDString(new_browser->tab_strip_model()));
+ EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
+
+ // The bounds of the initial window should not have changed.
+ EXPECT_EQ(initial_bounds.ToString(),
+ browser()->window()->GetBounds().ToString());
+
+ EXPECT_FALSE(GetIsDragged(browser()));
+ EXPECT_FALSE(GetIsDragged(new_browser));
+ // After this both windows should still be manageable.
+ EXPECT_TRUE(IsWindowPositionManaged(browser()->window()->GetNativeWindow()));
+ EXPECT_TRUE(
+ IsWindowPositionManaged(new_browser->window()->GetNativeWindow()));
+
+ // Only second window should be maximized.
+ EXPECT_FALSE(browser()->window()->IsMaximized());
+ EXPECT_TRUE(new_browser->window()->IsMaximized());
+
+ // The tab strip should no longer have capture because the drag was ended and
+ // mouse/touch was released.
+ EXPECT_FALSE(tab_strip->GetWidget()->HasCapture());
+ EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture());
+}
+
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+// TODO(sky,sad): Disabled as it fails due to resize locks with a real
+// compositor. crbug.com/331924
#define MAYBE_DetachToOwnWindowFromMaximizedWindow \
DISABLED_DetachToOwnWindowFromMaximizedWindow
#else

Powered by Google App Engine
This is Rietveld 408576698