#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include <memory>
#include <utility>
#include "base/command_line.h"
#include "base/json/json_file_value_serializer.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_test_util.h"
#include "chrome/common/extensions/permissions/chrome_permission_message_provider.h"
#include "chrome/grit/generated_resources.h"
#include "components/version_info/version_info.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/features/feature_channel.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/permissions/permission_message_test_util.h"
#include "extensions/common/permissions/permission_message_util.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/permissions/permissions_info.h"
#include "extensions/common/permissions/socket_permission.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
LoadManifest;
APIPermissionID;
namespace extensions {
namespace {
static void AddPattern(URLPatternSet* extent, const std::string& pattern) { … }
size_t IndexOf(const PermissionMessages& warnings, const std::string& warning) { … }
PermissionIDSet MakePermissionIDSet(APIPermissionID id1, APIPermissionID id2) { … }
PermissionIDSet MakePermissionIDSet(const APIPermissionSet& permissions) { … }
std::string PermissionIDsToString(const PermissionIDSet& ids) { … }
std::string CoalescedPermissionIDsToString(const PermissionMessages& msgs) { … }
testing::AssertionResult PermissionSetProducesMessage(
const PermissionSet& permissions,
Manifest::Type extension_type,
const PermissionIDSet& expected_ids) { … }
}
TEST(PermissionsTest, GetByID) { … }
TEST(PermissionsTest, GetByName) { … }
TEST(PermissionsTest, GetAll) { … }
TEST(PermissionsTest, GetAllByName) { … }
TEST(PermissionsTest, Aliases) { … }
TEST(PermissionsTest, EffectiveHostPermissions) { … }
TEST(PermissionsTest, ExplicitAccessToOrigin) { … }
TEST(PermissionsTest, CreateUnion) { … }
TEST(PermissionsTest, CreateIntersection) { … }
TEST(PermissionsTest, CreateDifference) { … }
TEST(PermissionsTest, IsPrivilegeIncrease) { … }
TEST(PermissionsTest,
IsNotPrivilegeIncreaseWhenSwitchingForLowerPrivilegePermission) { … }
TEST(PermissionsTest, PermissionMessages) { … }
TEST(PermissionsTest, FileSystemPermissionMessages) { … }
TEST(PermissionsTest, HiddenFileSystemPermissionMessages) { … }
TEST(PermissionsTest, SuppressedPermissionMessages) { … }
TEST(PermissionsTest, AccessToDevicesMessages) { … }
TEST(PermissionsTest, MergedFileSystemPermissionComparison) { … }
TEST(PermissionsTest, GetWarningMessages_ManyHosts) { … }
TEST(PermissionsTest, GetWarningMessages_AudioVideo) { … }
TEST(PermissionsTest, GetWarningMessages_CombinedSessions) { … }
TEST(PermissionsTest, GetWarningMessages_DeclarativeWebRequest) { … }
TEST(PermissionsTest, GetWarningMessages_Serial) { … }
TEST(PermissionsTest, GetWarningMessages_Socket_AnyHost) { … }
TEST(PermissionsTest, GetWarningMessages_Socket_OneDomainTwoHostnames) { … }
TEST(PermissionsTest, GetWarningMessages_Socket_TwoDomainsOneHostname) { … }
TEST(PermissionsTest, GetWarningMessages_PlatformAppHosts) { … }
testing::AssertionResult ShowsAllHostsWarning(const std::string& pattern) { … }
TEST(PermissionsTest, GetWarningMessages_TLDWildcardTreatedAsAllHosts) { … }
TEST(PermissionsTest, GetDistinctHosts) { … }
TEST(PermissionsTest, GetDistinctHosts_ComIsBestRcd) { … }
TEST(PermissionsTest, GetDistinctHosts_NetIs2ndBestRcd) { … }
TEST(PermissionsTest, GetDistinctHosts_OrgIs3rdBestRcd) { … }
TEST(PermissionsTest, GetDistinctHosts_FirstInListIs4thBestRcd) { … }
TEST(PermissionsTest, IsHostPrivilegeIncrease) { … }
TEST(PermissionsTest, GetAPIsAsStrings) { … }
TEST(PermissionsTest, IsEmpty) { … }
TEST(PermissionsTest, SyncFileSystemPermission) { … }
TEST(PermissionsTest, ChromeURLs) { … }
TEST(PermissionsTest, IsPrivilegeIncrease_DeclarativeWebRequest) { … }
TEST(PermissionsTest, SettingMembers) { … }
}