#include "base/files/file_util.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/api/permissions/permissions_api.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_management_test_util.h"
#include "chrome/browser/extensions/extension_with_management_policy_apitest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "content/public/test/browser_test.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/switches.h"
#include "net/dns/mock_host_resolver.h"
namespace extensions {
namespace {
static void AddPattern(URLPatternSet* extent, const std::string& pattern) { … }
}
ContextType;
class ExperimentalApiTest : public ExtensionApiTest { … };
class PermissionsApiTest : public ExtensionApiTest { … };
class PermissionsApiTestWithContextType
: public PermissionsApiTest,
public testing::WithParamInterface<ContextType> { … };
IN_PROC_BROWSER_TEST_P(PermissionsApiTestWithContextType, PermissionsFail) { … }
IN_PROC_BROWSER_TEST_F(ExperimentalApiTest, PermissionsSucceed) { … }
IN_PROC_BROWSER_TEST_P(PermissionsApiTestWithContextType,
ExperimentalPermissionsFail) { … }
#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)) && \
defined(NDEBUG)
#define MAYBE_FaviconPermission …
#else
#define MAYBE_FaviconPermission …
#endif
IN_PROC_BROWSER_TEST_F(PermissionsApiTest, MAYBE_FaviconPermission) { … }
IN_PROC_BROWSER_TEST_F(PermissionsApiTest, AlwaysAllowed) { … }
IN_PROC_BROWSER_TEST_P(PermissionsApiTestWithContextType,
OptionalPermissionsGranted) { … }
IN_PROC_BROWSER_TEST_P(PermissionsApiTestWithContextType,
OptionalPermissionsAutoConfirm) { … }
IN_PROC_BROWSER_TEST_F(PermissionsApiTest, OptionalPermissionsDeny) { … }
IN_PROC_BROWSER_TEST_P(PermissionsApiTestWithContextType,
OptionalPermissionsGesture) { … }
IN_PROC_BROWSER_TEST_F(PermissionsApiTest, OptionalPermissionsRetainGesture) { … }
IN_PROC_BROWSER_TEST_F(ExtensionApiTestWithManagementPolicy,
OptionalPermissionsPolicyBlocked) { … }
IN_PROC_BROWSER_TEST_F(PermissionsApiTest, OptionalPermissionsFileAccess) { … }
IN_PROC_BROWSER_TEST_F(PermissionsApiTest, FileLoad) { … }
IN_PROC_BROWSER_TEST_P(PermissionsApiTestWithContextType, HostSubsets) { … }
IN_PROC_BROWSER_TEST_F(PermissionsApiTest, OptionalPermissionsUpdatesBindings) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
class PermissionsApiSiteAccessRequestsTest : public PermissionsApiTest { … };
IN_PROC_BROWSER_TEST_F(PermissionsApiSiteAccessRequestsTest,
InvalidAddSiteAccessRequests) { … }
IN_PROC_BROWSER_TEST_F(PermissionsApiSiteAccessRequestsTest,
InvalidRemoveSiteAccessRequests) { … }
}