#include <optional>
#include <sstream>
#include "base/functional/overloaded.h"
#include "base/strings/stringprintf.h"
#include "base/test/metrics/user_action_tester.h"
#include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/toolbar/pinned_toolbar/pinned_toolbar_actions_model.h"
#include "chrome/browser/ui/toolbar_controller_util.h"
#include "chrome/browser/ui/views/extensions/extensions_toolbar_container.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/side_panel/side_panel_coordinator.h"
#include "chrome/browser/ui/views/side_panel/side_panel_util.h"
#include "chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_button.h"
#include "chrome/browser/ui/views/toolbar/pinned_toolbar_actions_container.h"
#include "chrome/browser/ui/views/toolbar/toolbar_controller.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/interaction/feature_engagement_initialized_observer.h"
#include "chrome/test/interaction/interactive_browser_test.h"
#include "chrome/test/user_education/interactive_feature_promo_test.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/test/scoped_iph_feature_list.h"
#include "components/user_education/common/feature_promo_result.h"
#include "components/user_education/views/help_bubble_view.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/test/test_extension_dir.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/ui_base_features.h"
#include "ui/views/layout/animating_layout_manager_test_util.h"
#include "ui/views/test/views_test_utils.h"
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"
namespace {
constexpr int kBrowserContentAllowedMinimumWidth = …;
}
class ToolbarControllerUiTest : public InteractiveFeaturePromoTest { … };
#if BUILDFLAG(IS_WIN)
#define MAYBE_StartBrowserWithThresholdWidth …
#else
#define MAYBE_StartBrowserWithThresholdWidth …
#endif
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
MAYBE_StartBrowserWithThresholdWidth) { … }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS)
#define MAYBE_StartBrowserWithWidthSmallerThanThreshold …
#else
#define MAYBE_StartBrowserWithWidthSmallerThanThreshold …
#endif
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
MAYBE_StartBrowserWithWidthSmallerThanThreshold) { … }
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
StartBrowserWithWidthLargerThanThreshold) { … }
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest, MenuMatchesOverflowedElements) { … }
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest, ActivateActionElementFromMenu) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
#define MAYBE_ActionItemsOverflowAndReappear …
#else
#define MAYBE_ActionItemsOverflowAndReappear …
#endif
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
MAYBE_ActionItemsOverflowAndReappear) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_ActionItemsShowInMenuAndActivateFromMenu …
#else
#define MAYBE_ActionItemsShowInMenuAndActivateFromMenu …
#endif
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
MAYBE_ActionItemsShowInMenuAndActivateFromMenu) { … }
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
ActivatedActionItemsDoNotOverflow) { … }
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
DISABLED_DeactivatedActionItemsOverflow) { … }
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
EveryElementHasActionMetricName) { … }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
#define MAYBE_ExtensionHasNoAnimationLoop …
#else
#define MAYBE_ExtensionHasNoAnimationLoop …
#endif
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
MAYBE_ExtensionHasNoAnimationLoop) { … }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_DoNotShowIphWhenOverflowed …
#else
#define MAYBE_DoNotShowIphWhenOverflowed …
#endif
IN_PROC_BROWSER_TEST_F(ToolbarControllerUiTest,
MAYBE_DoNotShowIphWhenOverflowed) { … }