chromium/components/policy/test_support/embedded_policy_test_server_unittest.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/policy/test_support/embedded_policy_test_server.h"

#include <string_view>

#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
#include "components/policy/proto/chrome_extension_policy.pb.h"
#endif  // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
#include "components/policy/test_support/embedded_policy_test_server_test_base.h"
#include "components/policy/test_support/policy_storage.h"
#include "components/policy/test_support/test_server_helpers.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace policy {

namespace {

constexpr char kFakeDeviceId[] =;
constexpr char kFakeRequestType[] =;
constexpr char kInvalidRequestType[] =;
constexpr char kResponseBodyYay[] =;
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
constexpr char kFakeExtensionId[] =;
constexpr char kRawPolicyPayload[] =;
constexpr std::string_view kSHA256HashForRawPolicyPayload(
    "\x42\x6f\xc0\x4f\x04\xbf\x8f\xdb\x58\x31\xdc\x37\xbb\xb6\xdc\xf7\x0f\x63"
    "\xa3\x7e\x05\xa6\x8c\x6e\xa5\xf6\x3e\x85\xae\x57\x93\x76",
    32);
#endif  // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)

class FakeRequestHandler : public EmbeddedPolicyTestServer::RequestHandler {};

}  // namespace

class EmbeddedPolicyTestServerTest : public EmbeddedPolicyTestServerTestBase {};

TEST_F(EmbeddedPolicyTestServerTest, HandleRequest_InvalidRequestType) {}

TEST_F(EmbeddedPolicyTestServerTest, HandleRequest_Success) {}

TEST_F(EmbeddedPolicyTestServerTest, HandleRequest_MissingAppType) {}

TEST_F(EmbeddedPolicyTestServerTest, HandleRequest_MissingDeviceId) {}

TEST_F(EmbeddedPolicyTestServerTest, HandleRequest_MissingDeviceType) {}

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
TEST_F(EmbeddedPolicyTestServerTest, HandleRequest_PolicyViaExternalEndpoint) {}
#endif  // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)

}  // namespace policy