#include "chrome/browser/ui/views/tabs/tab.h"
#include <stddef.h>
#include <memory>
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_tick_clock.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_style.h"
#include "chrome/browser/ui/tabs/tab_types.h"
#include "chrome/browser/ui/tabs/tab_utils.h"
#include "chrome/browser/ui/views/tabs/alert_indicator_button.h"
#include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h"
#include "chrome/browser/ui/views/tabs/fake_tab_slot_controller.h"
#include "chrome/browser/ui/views/tabs/tab_close_button.h"
#include "chrome/browser/ui/views/tabs/tab_icon.h"
#include "chrome/browser/ui/views/tabs/tab_slot_controller.h"
#include "chrome/browser/ui/views/tabs/tab_slot_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/tabs/tab_style_views.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/views/chrome_views_test_base.h"
#include "components/content_settings/core/common/features.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/models/list_selection_model.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/favicon_size.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/test/views_test_utils.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"
Widget;
class TabTest : public ChromeViewsTestBase { … };
class AlertIndicatorButtonTest : public ChromeViewsTestBase { … };
TEST_F(TabTest, HitTest) { … }
TEST_F(TabTest, LayoutAndVisibilityOfElements) { … }
TEST_F(TabTest, CloseButtonLayout) { … }
TEST_F(TabTest, CloseButtonFocus) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(TabTest, CloseButtonHiddenWhenLockedForOnTask) {
const auto tab_slot_controller = std::make_unique<FakeTabSlotController>();
tab_slot_controller->SetLockedForOnTask(true);
const std::unique_ptr<views::Widget> widget =
CreateTestWidget(views::Widget::InitParams::CLIENT_OWNS_WIDGET);
Tab* const tab =
widget->SetContentsView(std::make_unique<Tab>(tab_slot_controller.get()));
TabCloseButton* const tab_close_button = GetCloseButton(tab);
EXPECT_FALSE(tab_close_button->GetVisible());
}
TEST_F(TabTest, CloseButtonShownWhenNotLockedForOnTask) {
const auto tab_slot_controller = std::make_unique<FakeTabSlotController>();
tab_slot_controller->SetLockedForOnTask(false);
const std::unique_ptr<views::Widget> widget =
CreateTestWidget(views::Widget::InitParams::CLIENT_OWNS_WIDGET);
Tab* const tab =
widget->SetContentsView(std::make_unique<Tab>(tab_slot_controller.get()));
TabCloseButton* const tab_close_button = GetCloseButton(tab);
EXPECT_TRUE(tab_close_button->GetVisible());
}
#endif
TEST_F(TabTest, LayeredThrobber) { … }
TEST_F(TabTest, TitleHiddenWhenSmall) { … }
TEST_F(TabTest, FaviconDoesntMoveWhenShowingAlertIndicator) { … }
TEST_F(TabTest, SmallTabsHideCloseButton) { … }
TEST_F(TabTest, ExtraLeftPaddingShownOnSiteWithoutFavicon) { … }
TEST_F(TabTest, ExtraAlertPaddingNotShownOnSmallActiveTab) { … }
TEST_F(TabTest, TitleTextHasSufficientContrast) { … }
TEST_F(AlertIndicatorButtonTest, ShowsAndHidesAlertIndicator) { … }
TEST_F(AlertIndicatorButtonTest, MinHoldDurationTest) { … }
TEST_F(AlertIndicatorButtonTest, 1SecondFadeoutAnimationTest) { … }
TEST_F(TabTest, DiscardIndicatorResponsiveness) { … }
TEST_F(TabTest, AccessibleProperties) { … }