#include "base/feature_list.h"
#include "base/memory/ref_counted.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/extensions/api/side_panel/side_panel_api.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_context_menu_model.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_actions.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/extensions/extension_action_test_helper.h"
#include "chrome/browser/ui/extensions/extensions_container.h"
#include "chrome/browser/ui/tabs/tab_model.h"
#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.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/extensions/extension_side_panel_coordinator.h"
#include "chrome/browser/ui/views/side_panel/extensions/extension_side_panel_manager.h"
#include "chrome/browser/ui/views/side_panel/side_panel_coordinator.h"
#include "chrome/browser/ui/views/side_panel/side_panel_entry.h"
#include "chrome/browser/ui/views/side_panel/side_panel_entry_observer.h"
#include "chrome/browser/ui/views/side_panel/side_panel_registry.h"
#include "chrome/browser/ui/views/side_panel/side_panel_registry_observer.h"
#include "chrome/browser/ui/views/side_panel/side_panel_test_utils.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/crx_file/id_util.h"
#include "components/sessions/content/session_tab_helper.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/api_test_utils.h"
#include "extensions/browser/test_image_loader.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/test_extension_dir.h"
#include "ui/actions/actions.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/image/image_unittest_util.h"
namespace extensions {
namespace {
enum class CommandState { … };
CommandState GetCommandState(const ExtensionContextMenuModel& menu,
int command_id) { … }
SidePanelEntry::Key GetKey(const ExtensionId& id) { … }
class TestSidePanelEntryWaiter : public SidePanelEntryObserver { … };
class ExtensionSidePanelRegistryWaiter : public SidePanelRegistryObserver { … };
class ExtensionSidePanelBrowserTest : public ExtensionBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
ExtensionEntryVisibleInSidePanel) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
ExtensionViewVisibleInsideSidePanel) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest, MultipleBrowsers) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest, SidePanelQuicklyClosed) { … }
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
#define MAYBE_EntryShowsExtensionIcon …
#else
#define MAYBE_EntryShowsExtensionIcon …
#endif
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
MAYBE_EntryShowsExtensionIcon) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest, SetOptions_Enabled) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest, SetOptions_Path) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest, WindowCloseCalled) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
WindowCloseCalledFromTabSpecificPanel) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
DISABLED_WindowCloseCalledWhenLoading) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest, HideGlobalPanelForTab) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
DisableGlobalPanelWhileHidden) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest, ReEnabledPanelNotShown) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
TabSpecificPanelShownOnOptionsUpdate) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
ShowTabSpecificPaneOnTabSwitch) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
TabSpecificPanelsOwnViewState) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
UnloadExtensionAfterMovingTab) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
ToggleExtensionEntryOnUserAction) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
FallbackActionWithoutSidePanel) { … }
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelBrowserTest,
CloseSidePanelButtonVisibleWhenExtensionsSidePanelOpen) { … }
class ExtensionOpenSidePanelBrowserTest : public ExtensionSidePanelBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_OpenGlobalPanelOnActiveTab) { … }
IN_PROC_BROWSER_TEST_F(ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_OpenGlobalPanelOnActiveTab_Incognito) { … }
IN_PROC_BROWSER_TEST_F(ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_OpenGlobalPanelOnInactiveTab) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_OverridesGlobalPanelWithActiveTabIdProvided) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_OverridesGlobalPanelWithInactiveTabIdProvided) { … }
IN_PROC_BROWSER_TEST_F(ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_OpenContextualPanelInActiveTab) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_DoesNotOverrideActiveContextualPanelIfOtherTabIdProvided) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_OverridesContextualEntryInInactiveTabIfTabIdMatches) { … }
IN_PROC_BROWSER_TEST_F(ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_OverridesActiveContextualPanelOnSameTab) { … }
IN_PROC_BROWSER_TEST_F(ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_OpenContextualPanelInInactiveTab) { … }
IN_PROC_BROWSER_TEST_F(ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_WindowId_OpenWithNoActivePanel) { … }
IN_PROC_BROWSER_TEST_F(ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_WindowId_OpenWithNoActivePanel_Incognito) { … }
IN_PROC_BROWSER_TEST_F(ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_WindowId_OverridesActiveGlobalPanel) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_WindowId_DoesNotOverrideActiveContextualPanel) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_WindowId_DoesNotOverrideInactiveContextualPanel) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_ContextMenu_GlobalPanel_ToggleSidePanelVisibility) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_ContextMenu_ContextualPanel_ToggleSidePanelVisibility) { … }
IN_PROC_BROWSER_TEST_F(
ExtensionOpenSidePanelBrowserTest,
OpenSidePanel_ContextMenu_ContextualPanel_PageNavigations) { … }
class ExtensionSidePanelDisabledBrowserTest : public ExtensionBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ExtensionSidePanelDisabledBrowserTest,
NoSidePanelEntry) { … }
}
}