chromium/components/policy/core/common/cloud/encrypted_reporting_job_configuration_unittest.cc

// Copyright 2020 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/core/common/cloud/encrypted_reporting_job_configuration.h"

#include <cstddef>
#include <optional>
#include <string_view>

#include "base/base64.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/cloud_policy_util.h"
#include "components/policy/core/common/cloud/dm_auth.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
#include "components/reporting/proto/synced/record.pb.h"
#include "components/reporting/proto/synced/record_constants.pb.h"
#include "components/reporting/util/encrypted_reporting_json_keys.h"
#include "components/version_info/version_info.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chromeos/ash/components/system/fake_statistics_provider.h"
#endif

_;
ByRef;
ElementsAre;
Eq;
Ge;
IsEmpty;
IsNull;
MockFunction;
NotNull;
ReturnPointee;
StrEq;
StrictMock;

namespace policy {

namespace {
constexpr int64_t kGenerationId =;
constexpr ::reporting::Priority kPriority =;

// Default values for EncryptionInfo
constexpr char kEncryptionKeyValue[] =;
constexpr uint64_t kPublicKeyIdValue =;

constexpr char kDmToken[] =;
constexpr char kClientId[] =;
constexpr char kServerUrl[] =;

uint64_t GetNextSequenceId() {}

class RequestPayloadBuilder {};

class ResponseValueBuilder {};

}  // namespace

class EncryptedReportingJobConfigurationTest : public testing::Test {};

// Validates that the non-Record portions of the payload are generated
// correctly.
TEST_F(EncryptedReportingJobConfigurationTest, ValidatePayload) {}

// Validates that the non-Record portions of the payload are generated
// correctly on unmanaged devices and do not contain any device info.
TEST_F(EncryptedReportingJobConfigurationTest,
       ValidatePayloadWithoutDeviceInfo) {}

// Ensures that records are added correctly and that the payload is Base64
// encoded.
TEST_F(EncryptedReportingJobConfigurationTest, CorrectlyAddEncryptedRecord) {}

// Ensures that multiple records can be added to the request.
TEST_F(EncryptedReportingJobConfigurationTest, CorrectlyAddsMultipleRecords) {}

// Ensures that attach encryption settings request is included when no records
// are present.
TEST_F(EncryptedReportingJobConfigurationTest,
       AllowsAttachEncryptionSettingsAlone) {}

TEST_F(EncryptedReportingJobConfigurationTest,
       CorrectlyAddsMultipleRecordsWithAttachEncryptionSettings) {}

TEST_F(EncryptedReportingJobConfigurationTest,
       AllowsAttachConfigurationFileAlone) {}

TEST_F(EncryptedReportingJobConfigurationTest,
       AllowsAttachConfigurationFileAndEncryptionSettingsWithoutRecords) {}

TEST_F(
    EncryptedReportingJobConfigurationTest,
    CorrectlyAddsMultipleRecordsWithAttachConfigurationFileAndAttachEncryptionKey) {}

TEST_F(EncryptedReportingJobConfigurationTest, AllowsSourceTastAlone) {}

TEST_F(
    EncryptedReportingJobConfigurationTest,
    AllowsAttachConfigurationFileEncryptionSettingsAndSourceTastWithoutRecords) {}

TEST_F(
    EncryptedReportingJobConfigurationTest,
    CorrectlyAddsMultipleRecordsWithAttachConfigurationFileAttachEncryptionKeyAndSourceTast) {}

// Ensures that the context can be updated.
TEST_F(EncryptedReportingJobConfigurationTest, CorrectlyAddsAndUpdatesContext) {}

// Ensures that upload success is handled correctly.
TEST_F(EncryptedReportingJobConfigurationTest, OnURLLoadComplete_Success) {}

// Ensures that upload failure is handled correctly.
TEST_F(EncryptedReportingJobConfigurationTest, OnURLLoadComplete_NetError) {}
TEST_F(EncryptedReportingJobConfigurationTest, ManagedDeviceUmaName) {}

TEST_F(EncryptedReportingJobConfigurationTest, UnmanagedDeviceUmaName) {}

TEST_F(EncryptedReportingJobConfigurationTest, PayloadTopLevelFields) {}
}  // namespace policy