#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/enterprise/browser/reporting/report_uploader.h"
#include <utility>
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/enterprise/browser/reporting/report_request.h"
#include "components/enterprise/browser/reporting/report_type.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
#include "device_management_backend.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
_;
Eq;
InSequence;
Property;
WithArgs;
em;
namespace enterprise_reporting {
namespace {
constexpr const char* kBrowserVersionNames[] = …;
constexpr char kResponseMetricsName[] = …;
auto ScheduleResponse(policy::CloudPolicyClient::Result result) { … }
}
class ReportUploaderTest : public ::testing::Test { … };
class ReportUploaderTestWithTransientError
: public ReportUploaderTest,
public ::testing::WithParamInterface<policy::DeviceManagementStatus> { … };
class ReportUploaderTestWithReportType
: public ReportUploaderTest,
public ::testing::WithParamInterface<ReportType> { … };
#if defined(GTEST_HAS_DEATH_TEST) && !BUILDFLAG(IS_ANDROID)
TEST_F(ReportUploaderTest, NotRegisteredCrashes) { … }
#endif
TEST_F(ReportUploaderTest, PersistentError) { … }
TEST_F(ReportUploaderTest, RequestTooBigError) { … }
TEST_F(ReportUploaderTest, RetryAndSuccess) { … }
TEST_F(ReportUploaderTest, RetryAndFailedWithPersistentError) { … }
TEST_F(ReportUploaderTest, RetryAndFailedWithTransientError) { … }
TEST_F(ReportUploaderTest, MultipleReports) { … }
TEST_P(ReportUploaderTestWithTransientError, WithoutRetry) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ReportUploaderTestWithReportType, Success) { … }
INSTANTIATE_TEST_SUITE_P(…);
}