chromium/chrome/browser/ui/views/frame/tab_strip_region_view_unittest.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/frame/tab_strip_region_view.h"

#include <memory>
#include <string>

#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/features.h"
#include "chrome/browser/ui/tabs/tab_strip_prefs.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h"
#include "chrome/browser/ui/views/tabs/new_tab_button.h"
#include "chrome/browser/ui/views/tabs/tab.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/tabs/tab_strip_control_button.h"
#include "chrome/browser/ui/views/tabs/tab_strip_scroll_container.h"
#include "chrome/browser/ui/views/tabs/tab_style_views.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "tab_strip_region_view.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/animation/animation_test_api.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/test/views_test_utils.h"
#include "ui/views/view.h"
#include "ui/views/view_utils.h"
#include "ui/views/widget/widget.h"

// TabStripRegionViewTestBase contains no test cases.
class TabStripRegionViewTestBase : public ChromeViewsTestBase {};

// TabStripRegionViewTest contains tests that will run with scrolling enabled
// and disabled.
class TabStripRegionViewTest : public TabStripRegionViewTestBase,
                               public testing::WithParamInterface<bool> {};

// TODO (crbug/1520595): Skip for now due to test failing when CR2023 enabled.
TEST_P(TabStripRegionViewTest, DISABLED_GrabHandleSpaceStaysVisible) {}

// TODO (crbug/1520595): Skip for now due to test failing when CR2023 enabled.
TEST_P(TabStripRegionViewTest, DISABLED_NewTabButtonStaysVisible) {}

// TODO (crbug/1520595): Skip for now due to test failing when CR2023 enabled.
TEST_P(TabStripRegionViewTest, DISABLED_NewTabButtonRightOfTabs) {}

// TODO (crbug/1523257): Skip for now due to test failing when CR2023 enabled.
TEST_P(TabStripRegionViewTest, DISABLED_NewTabButtonInkDrop) {}

// We want to make sure that the following children views sits flush with the
// top of tab strip region view:
// * tab strip
// * new tab button
// This is important in ensuring that we maximise the targetable area of these
// views when the tab strip is flush with the top of the screen when the window
// is maximized (Fitt's Law).
TEST_P(TabStripRegionViewTest, ChildrenAreFlushWithTopOfTabStripRegionView) {}

TEST_P(TabStripRegionViewTest, TabSearchPositionLoggedOnConstruction) {}

TEST_P(TabStripRegionViewTest, HasMultiselectableState) {}

class TabStripRegionViewTestWithScrollingDisabled
    : public TabStripRegionViewTestBase {};

// When scrolling is disabled, the tab strip cannot be larger than the container
// so tabs that do not fit in the tabstrip will become invisible. This is the
// opposite behavior from
// TabStripRegionViewTestWithScrollingEnabled.TabStripCanBeLargerThanContainer.
TEST_F(TabStripRegionViewTestWithScrollingDisabled,
       TabStripCannotBeLargerThanContainer) {}

class TabStripRegionViewTestWithScrollingEnabled
    : public TabStripRegionViewTestBase {};

// When scrolling is enabled, the tab strip can grow to be larger than the
// container. This is the opposite behavior from
// TabStripRegionViewTestWithScrollingDisabled.
// TabStripCannotBeLargerThanContainer.
TEST_F(TabStripRegionViewTestWithScrollingEnabled,
       TabStripCanBeLargerThanContainer) {}

TEST_F(TabStripRegionViewTestWithScrollingEnabled,
       TabStripScrollButtonsNotInWindowCaption) {}

INSTANTIATE_TEST_SUITE_P();