#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "extensions/common/api/sockets/sockets_manifest_permission.h"
#include <set>
#include <tuple>
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/ranges/algorithm.h"
#include "base/values.h"
#include "extensions/common/manifest_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
SocketPermissionRequest;
namespace extensions {
namespace {
const char kUdpBindPermission[] = …;
const char kUdpSendPermission[] = …;
const char kTcpConnectPermission[] = …;
const char kTcpServerListenPermission[] = …;
static void AssertEmptyPermission(const SocketsManifestPermission* permission) { … }
static base::Value ParsePermissionJSON(const std::string& json) { … }
static std::unique_ptr<SocketsManifestPermission> PermissionFromValue(
const base::Value& value) { … }
static std::unique_ptr<SocketsManifestPermission> PermissionFromJSON(
const std::string& json) { … }
struct CheckFormatEntry { … };
static testing::AssertionResult CheckFormat(
const std::multiset<CheckFormatEntry>& permissions,
const std::string& json) { … }
static testing::AssertionResult CheckFormat(const std::string& json) { … }
static testing::AssertionResult CheckFormat(const std::string& json,
const CheckFormatEntry& op1) { … }
static testing::AssertionResult CheckFormat(const std::string& json,
const CheckFormatEntry& op1,
const CheckFormatEntry& op2) { … }
static testing::AssertionResult CheckFormat(const std::string& json,
const CheckFormatEntry& op1,
const CheckFormatEntry& op2,
const CheckFormatEntry& op3,
const CheckFormatEntry& op4,
const CheckFormatEntry& op5,
const CheckFormatEntry& op6,
const CheckFormatEntry& op7,
const CheckFormatEntry& op8,
const CheckFormatEntry& op9) { … }
}
TEST(SocketsManifestPermissionTest, Empty) { … }
TEST(SocketsManifestPermissionTest, JSONFormats) { … }
TEST(SocketsManifestPermissionTest, FromToValue) { … }
TEST(SocketsManifestPermissionTest, SetOperations) { … }
}