#include "chrome/browser/policy/messaging_layer/util/reporting_server_connector_test_util.h"
#include <cstddef>
#include <memory>
#include <optional>
#include <utility>
#include "base/check.h"
#include "base/check_op.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/memory/singleton.h"
#include "chrome/browser/policy/device_management_service_configuration.h"
#include "chrome/browser/policy/messaging_layer/upload/encrypted_reporting_client.h"
#include "chrome/browser/policy/messaging_layer/util/reporting_server_connector.h"
#include "chrome/browser/policy/messaging_layer/util/test_response_payload.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chromeos/ash/components/system/fake_statistics_provider.h"
#include "components/policy/core/common/cloud/cloud_policy_client.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/cloud_policy_core.h"
#include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h"
#include "components/policy/core/common/cloud/cloud_policy_store.h"
#include "components/policy/core/common/cloud/device_management_service.h"
#include "components/policy/core/common/cloud/dm_token.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_service.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_store.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/reporting/util/status_macros.h"
#include "components/reporting/util/statusor.h"
#include "services/network/public/cpp/data_element.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_network_connection_tracker.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chromeos/ash/components/system/fake_statistics_provider.h"
#include "chromeos/ash/components/system/statistics_provider.h"
#endif
namespace reporting {
namespace {
constexpr char kServerUrl[] = …;
}
class FakeDelegate : public EncryptedReportingClient::Delegate { … };
ReportingServerConnector::TestEnvironment::TestEnvironment()
: … { … }
ReportingServerConnector::TestEnvironment::~TestEnvironment() { … }
base::Value::Dict ReportingServerConnector::TestEnvironment::request_body(
size_t index) { … }
void ReportingServerConnector::TestEnvironment::SimulateResponseForRequest(
size_t index) { … }
void ReportingServerConnector::TestEnvironment::
SimulateCustomResponseForRequest(size_t index,
StatusOr<base::Value::Dict> response) { … }
void ReportingServerConnector::TestEnvironment::SetDMToken(
const std::string& dm_token) const { … }
void ReportingServerConnector::TestEnvironment::SetEncryptedReportingClient(
std::unique_ptr<EncryptedReportingClient> encrypted_reporting_client) { … }
}