#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/extensions/extension_action_view_controller.h"
#include <stddef.h>
#include <memory>
#include "base/command_line.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/api/side_panel/side_panel_service.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/extensions/extension_action_runner.h"
#include "chrome/browser/extensions/extension_action_test_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/load_error_reporter.h"
#include "chrome/browser/extensions/permissions/scripting_permissions_modifier.h"
#include "chrome/browser/extensions/permissions/site_permissions_helper.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/extensions/user_script_listener.h"
#include "chrome/browser/ui/extensions/extension_action_test_helper.h"
#include "chrome/browser/ui/extensions/extensions_container.h"
#include "chrome/browser/ui/extensions/icon_with_badge_image_source.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_model.h"
#include "chrome/common/extensions/api/side_panel.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "components/sessions/content/session_tab_helper.h"
#include "extensions/browser/extension_action.h"
#include "extensions/browser/extension_action_manager.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/permissions_manager.h"
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/common/api/extension_action/action_info.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/mojom/run_location.mojom-shared.h"
#include "extensions/test/test_extension_dir.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/image_model.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/native_theme/native_theme.h"
ManifestLocation;
SiteInteraction;
UserSiteSetting;
HoverCardState;
namespace {
std::unique_ptr<KeyedService> BuildSidePanelService(
content::BrowserContext* context) { … }
}
class ExtensionActionViewControllerUnitTest : public BrowserWithTestWindowTest { … };
TEST_F(ExtensionActionViewControllerUnitTest,
ExtensionActionWantsToRunAppearance) { … }
TEST_F(ExtensionActionViewControllerUnitTest, BrowserActionBlockedActions) { … }
TEST_F(ExtensionActionViewControllerUnitTest, PageActionBlockedActions) { … }
TEST_F(ExtensionActionViewControllerUnitTest, OnlyHostPermissionsAppearance) { … }
TEST_F(ExtensionActionViewControllerUnitTest,
ExtensionActionContextMenuVisibility) { … }
class ExtensionActionViewControllerGrayscaleTest
: public ExtensionActionViewControllerUnitTest { … };
void ExtensionActionViewControllerGrayscaleTest::RunGrayscaleTest(
PermissionType permission_type) { … }
scoped_refptr<const extensions::Extension>
ExtensionActionViewControllerGrayscaleTest::CreateExtension(
PermissionType permission_type) { … }
extensions::PermissionsData::PageAccess
ExtensionActionViewControllerGrayscaleTest::GetPageAccess(
content::WebContents* web_contents,
scoped_refptr<const extensions::Extension> extension,
PermissionType permission_type) { … }
TEST_F(ExtensionActionViewControllerGrayscaleTest,
GrayscaleIcon_ExplicitHosts) { … }
TEST_F(ExtensionActionViewControllerGrayscaleTest,
GrayscaleIcon_ScriptableHosts) { … }
TEST_F(ExtensionActionViewControllerUnitTest, RuntimeHostsTooltip) { … }
TEST_F(ExtensionActionViewControllerUnitTest, ActiveTabIconAppearance) { … }
TEST_F(ExtensionActionViewControllerUnitTest, GetSiteInteractionWithActiveTab) { … }
TEST_F(ExtensionActionViewControllerUnitTest,
GetSiteInteractionActiveTabWithFileURL) { … }
TEST_F(ExtensionActionViewControllerUnitTest, TestGetIconWithNullWebContents) { … }
class ExtensionActionViewControllerFeatureUnitTest
: public ExtensionActionViewControllerUnitTest { … };
TEST_F(ExtensionActionViewControllerFeatureUnitTest, GetHoverCardStatus) { … }
TEST_F(ExtensionActionViewControllerFeatureUnitTest, GetTooltip) { … }
class ExtensionActionViewControllerFeatureWithPermittedSitesUnitTest
: public ExtensionActionViewControllerFeatureUnitTest { … };
TEST_F(ExtensionActionViewControllerFeatureWithPermittedSitesUnitTest,
GetHoverCardStatus) { … }
class ExtensionActionViewControllerWithSidePanelUnitTest
: public ExtensionActionViewControllerUnitTest { … };
TEST_F(ExtensionActionViewControllerWithSidePanelUnitTest,
ActionEnabledIfSidePanelPresent) { … }