Commit a4b670d5 authored by Charlene Yan's avatar Charlene Yan Committed by Commit Bot

[Tab Scrolling] Add test for tabstrip resizing when dragging.

When the browser window is large enough, the tabstrip should expand to
accommodate tabs dragging past the last tab. This is a test for
crrev.com/c/2472577

Bug: 1141674
Change-Id: Icfb4b0d6b9ebfa243a0e352b0cef68a2a6f2c263
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2537068Reviewed-by: default avatarTaylor Bergquist <tbergquist@chromium.org>
Commit-Queue: Charlene Yan <cyan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827998}
parent 1833bc9d
......@@ -36,6 +36,7 @@
#include "chrome/browser/ui/tabs/tab_group.h"
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_style.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/native_browser_frame_factory.h"
......@@ -2435,6 +2436,41 @@ IN_PROC_BROWSER_TEST_P(
EXPECT_EQ(browser2_groups[0], group);
}
class DetachToBrowserTabDragControllerTestWithScrollableTabStripEnabled
: public DetachToBrowserTabDragControllerTest {
public:
DetachToBrowserTabDragControllerTestWithScrollableTabStripEnabled() {
scoped_feature_list_.InitWithFeatures({features::kScrollableTabStrip}, {});
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
};
// Creates a browser with two tabs and drags the rightmost tab. Given the
// browser window is large enough, the tabstrip should expand to accommodate
// this tab. Note: There must be at least two tabs because dragging a singular
// tab will drag the window.
IN_PROC_BROWSER_TEST_P(
DetachToBrowserTabDragControllerTestWithScrollableTabStripEnabled,
DraggingRightExpandsTabStripSize) {
TabStrip* tab_strip = GetTabStripForBrowser(browser());
AddTabsAndResetBrowser(browser(), 1);
browser()->window()->SetBounds(
gfx::Rect(0, 0, TabStyle::GetStandardWidth() * 4, 400));
const int tab_strip_width = tab_strip->width();
const gfx::Point tab_1_center =
GetCenterInScreenCoordinates(tab_strip->tab_at(1));
ASSERT_TRUE(PressInput(tab_1_center));
ASSERT_TRUE(DragInputTo(tab_1_center +
gfx::Vector2d(TabStyle::GetStandardWidth(), 0)));
EXPECT_EQ(tab_strip_width + TabStyle::GetStandardWidth(), tab_strip->width());
ASSERT_TRUE(ReleaseInput());
}
namespace {
// Invoked from the nested run loop.
......@@ -4354,6 +4390,10 @@ INSTANTIATE_TEST_SUITE_P(
TabDragging,
DetachToBrowserTabDragControllerTestWithTabGroupsCollapseEnabled,
::testing::Values("mouse", "touch"));
INSTANTIATE_TEST_SUITE_P(
TabDragging,
DetachToBrowserTabDragControllerTestWithScrollableTabStripEnabled,
::testing::Values("mouse", "touch"));
INSTANTIATE_TEST_SUITE_P(TabDragging,
DetachToBrowserInSeparateDisplayTabDragControllerTest,
::testing::Values("mouse"));
......@@ -4379,4 +4419,8 @@ INSTANTIATE_TEST_SUITE_P(
TabDragging,
DetachToBrowserTabDragControllerTestWithTabGroupsCollapseEnabled,
::testing::Values("mouse"));
INSTANTIATE_TEST_SUITE_P(
TabDragging,
DetachToBrowserTabDragControllerTestWithScrollableTabStripEnabled,
::testing::Values("mouse"));
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment