#include <algorithm>
#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/test/metrics/histogram_tester.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/browsertest_util.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_context_menu_model.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/install_verifier.h"
#include "chrome/browser/extensions/permissions/scripting_permissions_modifier.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/extensions/extension_install_ui.h"
#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
#include "chrome/browser/ui/views/controls/hover_button.h"
#include "chrome/browser/ui/views/extensions/extensions_menu_button.h"
#include "chrome/browser/ui/views/extensions/extensions_menu_item_view.h"
#include "chrome/browser/ui/views/extensions/extensions_menu_view.h"
#include "chrome/browser/ui/views/extensions/extensions_toolbar_button.h"
#include "chrome/browser/ui/views/extensions/extensions_toolbar_container.h"
#include "chrome/browser/ui/views/extensions/extensions_toolbar_interactive_uitest.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/hover_button_controller.h"
#include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "extensions/browser/disable_reason.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/permissions_manager.h"
#include "extensions/browser/pref_names.h"
#include "extensions/common/extension.h"
#include "extensions/test/permissions_manager_waiter.h"
#include "extensions/test/test_extension_dir.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/bubble/bubble_dialog_model_host.h"
#include "ui/views/layout/animating_layout_manager.h"
#include "ui/views/layout/animating_layout_manager_test_util.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/any_widget_observer.h"
ElementsAre;
class ExtensionsMenuViewInteractiveUITest : public ExtensionsToolbarUITest { … };
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest, InvokeUi_default) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
#define MAYBE_InvokeUi_ReloadPageBubble …
#else
#define MAYBE_InvokeUi_ReloadPageBubble …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
MAYBE_InvokeUi_ReloadPageBubble) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
ExtensionsMenuButtonHighlight) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest, TriggerPopup) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
ContextMenuKeepsExtensionPoppedOut) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
RemoveExtensionShowingPopup) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
RemoveMultipleExtensionsWhileShowingPopup) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
TriggeringExtensionClosesMenu) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
CreatesOneMenuItemPerExtension) { … }
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
#define MAYBE_PinningDisabledInIncognito …
#else
#define MAYBE_PinningDisabledInIncognito …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
MAYBE_PinningDisabledInIncognito) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
PinnedExtensionShowsCorrectContextMenuPinOption) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
UnpinnedExtensionShowsCorrectContextMenuPinOption) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
ManageExtensionsOpensExtensionsPage) { … }
#if BUILDFLAG(IS_LINUX)
#define MAYBE_ClickingContextMenuButton …
#else
#define MAYBE_ClickingContextMenuButton …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
MAYBE_ClickingContextMenuButton) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
InvokeUi_InstallDialog) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_InvokeUi_UninstallDialog_Accept …
#else
#define MAYBE_InvokeUi_UninstallDialog_Accept …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
MAYBE_InvokeUi_UninstallDialog_Accept) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#define MAYBE_InvokeUi_UninstallDialog_Cancel …
#else
#define MAYBE_InvokeUi_UninstallDialog_Cancel …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
MAYBE_InvokeUi_UninstallDialog_Cancel) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
InvocationSourceMetrics) { … }
IN_PROC_BROWSER_TEST_F(ExtensionsMenuViewInteractiveUITest,
MenuGetsUpdatedAfterPermissionsChange) { … }
class ActivateWithReloadExtensionsMenuInteractiveUITest
: public ExtensionsMenuViewInteractiveUITest,
public ::testing::WithParamInterface<bool> { … };
IN_PROC_BROWSER_TEST_P(ActivateWithReloadExtensionsMenuInteractiveUITest,
ActivateWithReload) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);