#include "chrome/browser/ui/views/extensions/extensions_toolbar_unittest.h"
#include "base/command_line.h"
#include "base/containers/to_vector.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_tab_util.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/ui/toolbar/toolbar_action_view_controller.h"
#include "components/crx_file/id_util.h"
#include "content/public/test/test_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/mojom/manifest.mojom-shared.h"
#include "extensions/test/permissions_manager_waiter.h"
#include "ui/events/base_event_utils.h"
#include "ui/views/layout/animating_layout_manager_test_util.h"
#include "ui/views/view_utils.h"
PermissionsManager;
SitePermissionsHelper;
ExtensionsToolbarUnitTest::ExtensionsToolbarUnitTest() = default;
ExtensionsToolbarUnitTest::ExtensionsToolbarUnitTest(
base::test::TaskEnvironment::TimeSource time_source)
: … { … }
ExtensionsToolbarUnitTest::~ExtensionsToolbarUnitTest() = default;
void ExtensionsToolbarUnitTest::SetUp() { … }
void ExtensionsToolbarUnitTest::TearDown() { … }
scoped_refptr<const extensions::Extension>
ExtensionsToolbarUnitTest::InstallExtension(const std::string& name) { … }
scoped_refptr<const extensions::Extension>
ExtensionsToolbarUnitTest::InstallExtensionWithHostPermissions(
const std::string& name,
const std::vector<std::string>& host_permissions) { … }
scoped_refptr<const extensions::Extension>
ExtensionsToolbarUnitTest::InstallExtensionWithPermissions(
const std::string& name,
const std::vector<std::string>& permissions) { … }
scoped_refptr<const extensions::Extension>
ExtensionsToolbarUnitTest::InstallEnterpriseExtension(
const std::string& name,
const std::vector<std::string>& host_permissions) { … }
scoped_refptr<const extensions::Extension>
ExtensionsToolbarUnitTest::InstallExtension(
const std::string& name,
const std::vector<std::string>& permissions,
const std::vector<std::string>& host_permissions,
extensions::mojom::ManifestLocation location) { … }
void ExtensionsToolbarUnitTest::ReloadExtension(
const extensions::ExtensionId& extension_id) { … }
void ExtensionsToolbarUnitTest::UninstallExtension(
const extensions::ExtensionId& extension_id) { … }
void ExtensionsToolbarUnitTest::EnableExtension(
const extensions::ExtensionId& extension_id) { … }
void ExtensionsToolbarUnitTest::DisableExtension(
const extensions::ExtensionId& extension_id) { … }
void ExtensionsToolbarUnitTest::WithholdHostPermissions(
const extensions::Extension* extension) { … }
void ExtensionsToolbarUnitTest::ClickButton(views::Button* button) const { … }
void ExtensionsToolbarUnitTest::UpdateUserSiteAccess(
const extensions::Extension& extension,
content::WebContents* web_contents,
PermissionsManager::UserSiteAccess site_access) { … }
void ExtensionsToolbarUnitTest::UpdateUserSiteSetting(
extensions::PermissionsManager::UserSiteSetting site_setting,
const GURL& url) { … }
void ExtensionsToolbarUnitTest::AddSiteAccessRequest(
const extensions::Extension& extension,
content::WebContents* web_contents,
const std::optional<URLPattern>& filter) { … }
void ExtensionsToolbarUnitTest::RemoveSiteAccessRequest(
const extensions::Extension& extension,
content::WebContents* web_contents) { … }
PermissionsManager::UserSiteSetting
ExtensionsToolbarUnitTest::GetUserSiteSetting(const GURL& url) { … }
PermissionsManager::UserSiteAccess ExtensionsToolbarUnitTest::GetUserSiteAccess(
const extensions::Extension& extension,
const GURL& url) const { … }
SitePermissionsHelper::SiteInteraction
ExtensionsToolbarUnitTest::GetSiteInteraction(
const extensions::Extension& extension,
content::WebContents* web_contents) const { … }
std::vector<ToolbarActionView*>
ExtensionsToolbarUnitTest::GetPinnedExtensionViews() { … }
std::vector<std::string> ExtensionsToolbarUnitTest::GetPinnedExtensionNames() { … }
void ExtensionsToolbarUnitTest::WaitForAnimation() { … }
void ExtensionsToolbarUnitTest::LayoutContainerIfNecessary() { … }
content::WebContentsTester*
ExtensionsToolbarUnitTest::AddWebContentsAndGetTester() { … }