#include "chrome/browser/ui/views/side_panel/side_panel_coordinator.h"
#include <memory>
#include <string>
#include "base/files/file_path.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/icu_test_util.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/extensions/api/side_panel/side_panel_api.h"
#include "chrome/browser/extensions/api/side_panel/side_panel_service.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/tabs/public/tab_features.h"
#include "chrome/browser/ui/toolbar/pinned_toolbar/pinned_toolbar_actions_model.h"
#include "chrome/browser/ui/toolbar/pinned_toolbar/pinned_toolbar_actions_model_factory.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_model.h"
#include "chrome/browser/ui/ui_features.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/frame/test_with_browser_view.h"
#include "chrome/browser/ui/views/side_panel/side_panel.h"
#include "chrome/browser/ui/views/side_panel/side_panel_content_proxy.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_id.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_util.h"
#include "chrome/browser/ui/views/side_panel/side_panel_view_state_observer.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/crx_file/id_util.h"
#include "components/lens/lens_features.h"
#include "components/strings/grit/components_strings.h"
#include "extensions/browser/api_test_utils.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_builder.h"
#include "extensions/test/test_extension_dir.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/views/layout/animating_layout_manager_test_util.h"
#include "ui/views/test/button_test_api.h"
#include "ui/views/test/views_test_utils.h"
_;
namespace {
std::unique_ptr<SidePanelEntry> CreateEntry(const SidePanelEntry::Key& key) { … }
std::unique_ptr<KeyedService> BuildSidePanelService(
content::BrowserContext* context) { … }
}
class SidePanelCoordinatorTest : public TestWithBrowserView { … };
class MockSidePanelViewStateObserver : public SidePanelViewStateObserver { … };
TEST_F(SidePanelCoordinatorTest, ToggleSidePanel) { … }
TEST_F(SidePanelCoordinatorTest, ChangeSidePanelWidth) { … }
TEST_F(SidePanelCoordinatorTest, ChangeSidePanelWidthMaxMin) { … }
TEST_F(SidePanelCoordinatorTest, ChangeSidePanelWidthRTL) { … }
TEST_F(SidePanelCoordinatorTest, ChangeSidePanelWidthWindowResize) { … }
TEST_F(SidePanelCoordinatorTest, ChangeSidePanelAlignment) { … }
TEST_F(SidePanelCoordinatorTest, ChangeSidePanelAlignmentRTL) { … }
TEST_F(SidePanelCoordinatorTest, DontNotifySidePanelObserverOfChangingContent) { … }
TEST_F(SidePanelCoordinatorTest, NotifyingSidePanelObservers) { … }
TEST_F(SidePanelCoordinatorTest, RemovingObserverDoesNotIncrementCount) { … }
TEST_F(SidePanelCoordinatorTest, SidePanelToggleWithEntriesTest) { … }
TEST_F(SidePanelCoordinatorTest, ShowOpensSidePanel) { … }
TEST_F(SidePanelCoordinatorTest, SwapBetweenTabsWithBookmarksOpen) { … }
TEST_F(SidePanelCoordinatorTest, SwapBetweenTabsWithReadingListOpen) { … }
TEST_F(SidePanelCoordinatorTest, ContextualEntryDeregistered) { … }
TEST_F(SidePanelCoordinatorTest, ContextualEntryDeregisteredWhileVisible) { … }
TEST_F(
SidePanelCoordinatorTest,
ContextualEntryDeregisteredWhileVisibleClosesPanelIfNoLastSeenGlobalEntryExists) { … }
TEST_F(SidePanelCoordinatorTest, ShowContextualEntry) { … }
TEST_F(SidePanelCoordinatorTest, SwapBetweenTwoContextualEntryWithTheSameId) { … }
TEST_F(SidePanelCoordinatorTest,
SwapBetweenTabsAfterNavigatingToContextualEntry) { … }
TEST_F(SidePanelCoordinatorTest, TogglePanelWithContextualEntryShowing) { … }
TEST_F(SidePanelCoordinatorTest,
TogglePanelWithGlobalEntryShowingWithTabSwitch) { … }
TEST_F(SidePanelCoordinatorTest,
TogglePanelWithContextualEntryShowingWithTabSwitch) { … }
TEST_F(SidePanelCoordinatorTest,
SwitchBetweenTabWithGlobalEntryAndTabWithLastActiveContextualEntry) { … }
TEST_F(SidePanelCoordinatorTest,
SwitchBetweenTabWithContextualEntryAndTabWithNoEntry) { … }
TEST_F(
SidePanelCoordinatorTest,
SwitchBetweenTabWithContextualEntryAndTabWithNoEntryWhenThereIsALastActiveGlobalEntry) { … }
TEST_F(SidePanelCoordinatorTest,
SwitchBackToTabWithPreviouslyVisibleContextualEntry) { … }
TEST_F(SidePanelCoordinatorTest,
SwitchBackToTabWithContextualEntryAfterClosingGlobal) { … }
TEST_F(SidePanelCoordinatorTest, SidePanelWidthPreference) { … }
class TestSidePanelObserver : public SidePanelEntryObserver { … };
TEST_F(SidePanelCoordinatorTest,
EntryDeregistersOnBeingHiddenFromSwitchToOtherEntry) { … }
TEST_F(SidePanelCoordinatorTest,
EntryDeregistersOnBeingHiddenFromSidePanelClose) { … }
TEST_F(SidePanelCoordinatorTest, ShouldNotRecreateTheSameEntry) { … }
TEST_F(SidePanelCoordinatorTest, GlobalEntryDeregisteredWhenVisible) { … }
TEST_F(SidePanelCoordinatorTest, BrowserClosedBeforeEntryLoaded) { … }
TEST_F(SidePanelCoordinatorTest, ShowGlobalAndContextualExtensionEntries) { … }
TEST_F(SidePanelCoordinatorTest, RegisterExtensionEntries) { … }
TEST_F(SidePanelCoordinatorTest, DeregisterExtensionEntries) { … }
TEST_F(SidePanelCoordinatorTest, ExtensionEntriesTabSwitchNoGlobalEntry) { … }
TEST_F(SidePanelCoordinatorTest, ExtensionEntriesTabSwitchGlobalEntry) { … }
TEST_F(SidePanelCoordinatorTest,
ExtensionEntriesTabSwitchWithActiveContextualEntry) { … }
TEST_F(SidePanelCoordinatorTest, DeregisterAndReturnView) { … }
TEST_F(SidePanelCoordinatorTest, SidePanelTitleUpdates) { … }
TEST_F(SidePanelCoordinatorTest, SidePanelPinButtonsHideInGuestMode) { … }
TEST_F(SidePanelCoordinatorTest, ExtensionSidePanelHasPinButton) { … }
class SidePanelCoordinatorLensOverlayTest : public SidePanelCoordinatorTest { … };
TEST_F(SidePanelCoordinatorLensOverlayTest,
ShowMoreInfoButtonWhenCallbackProvided) { … }
TEST_F(SidePanelCoordinatorLensOverlayTest,
HideMoreInfoButtonWhenNoCallbackProvided) { … }
class SidePanelCoordinatorLoadingContentTest : public SidePanelCoordinatorTest { … };
TEST_F(SidePanelCoordinatorLoadingContentTest, ContentDelaysForLoadingContent) { … }
TEST_F(SidePanelCoordinatorLoadingContentTest,
TriggerSwitchToNewEntryDuringContentLoad) { … }
TEST_F(SidePanelCoordinatorLoadingContentTest,
TriggerSwitchToCurrentVisibleEntryDuringContentLoad) { … }