#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 = …;
constexpr char kEncryptionKeyValue[] = …;
constexpr uint64_t kPublicKeyIdValue = …;
constexpr char kDmToken[] = …;
constexpr char kClientId[] = …;
constexpr char kServerUrl[] = …;
uint64_t GetNextSequenceId() { … }
class RequestPayloadBuilder { … };
class ResponseValueBuilder { … };
}
class EncryptedReportingJobConfigurationTest : public testing::Test { … };
TEST_F(EncryptedReportingJobConfigurationTest, ValidatePayload) { … }
TEST_F(EncryptedReportingJobConfigurationTest,
ValidatePayloadWithoutDeviceInfo) { … }
TEST_F(EncryptedReportingJobConfigurationTest, CorrectlyAddEncryptedRecord) { … }
TEST_F(EncryptedReportingJobConfigurationTest, CorrectlyAddsMultipleRecords) { … }
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) { … }
TEST_F(EncryptedReportingJobConfigurationTest, CorrectlyAddsAndUpdatesContext) { … }
TEST_F(EncryptedReportingJobConfigurationTest, OnURLLoadComplete_Success) { … }
TEST_F(EncryptedReportingJobConfigurationTest, OnURLLoadComplete_NetError) { … }
TEST_F(EncryptedReportingJobConfigurationTest, ManagedDeviceUmaName) { … }
TEST_F(EncryptedReportingJobConfigurationTest, UnmanagedDeviceUmaName) { … }
TEST_F(EncryptedReportingJobConfigurationTest, PayloadTopLevelFields) { … }
}